2019-09-26 12:10 PM
The following statement inside HAL_InitTick() is not dividing SystemCoreClock by 1000, as it should be. It's dividing by 1. So later, in SysTick_Config(), when argument ticks=64,000,000 which exceeds SysTick_LOAD_RELOAD_Msk of 0xFF'FFFF, a HAL_ERROR occurs.
The compiler also thinks uwTickFreq = 3550975298. It should be 1. But that value in the following statement should result in a divide by 0, which doesn't happen either. Is this a Cube issue or am I doing something wrong?
if (HAL_SYSTICK_Config(SystemCoreClock / (1000U /uwTickFreq)) == 0U)
Solved! Go to Solution.
2019-10-01 09:00 AM
I found the problem. As mentioned above, uwTickFreq was incorrect. On the debugger with the Memory Window open, I noticed that clicking Reset did not reset uwTickFreq or any surrounding addresses. Note that I am porting code from an LPC844 to the ST part. So I went back to the new linker file. The old linker file did the following, although I am not sure why as I have not found any manual initialization code:
initialize manually { section .textrw };
initialize manually { section .textrw };
So, I replaced these lines with the usual:
initialize by copy { readwrite };
RAM is now being initialized and the problem has been resolved.
2019-09-27 02:20 PM
Hey All, I could use some help with this. Something wrong with the post?
2019-09-28 03:09 PM
What clock setting are you trying to use? The question isnt super clear to me. Did you forget to include the statement you refer to in the first sentence?
2019-09-30 05:07 AM
The clock in Cube is set up as follows: HSI, PLLM=1, PLLN=8, PLLR=2 resulting in SYSCLK =64MHz. The statement I am referring to is:
if (HAL_SYSTICK_Config(SystemCoreClock / (1000U /uwTickFreq)) == 0U).
2019-10-01 09:00 AM
I found the problem. As mentioned above, uwTickFreq was incorrect. On the debugger with the Memory Window open, I noticed that clicking Reset did not reset uwTickFreq or any surrounding addresses. Note that I am porting code from an LPC844 to the ST part. So I went back to the new linker file. The old linker file did the following, although I am not sure why as I have not found any manual initialization code:
initialize manually { section .textrw };
initialize manually { section .textrw };
So, I replaced these lines with the usual:
initialize by copy { readwrite };
RAM is now being initialized and the problem has been resolved.