cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G070CB: STM32CubeMX V5.3.0 with STM32Cube_FW_G0_V1.3.0 fails to configure SYSCLK above 16MHz via the PLL

DBroo.1
Associate III

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)

1 ACCEPTED SOLUTION

Accepted Solutions
DBroo.1
Associate III

​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.

View solution in original post

4 REPLIES 4
DBroo.1
Associate III

​Hey All, I could use some help with this. Something wrong with the post?

TDK
Guru

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?

If you feel a post has answered your question, please click "Accept as Solution".
DBroo.1
Associate III

​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).

DBroo.1
Associate III

​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.