cancel
Showing results for 
Search instead for 
Did you mean: 

I am using STM32CubeMX to generate an MDK-ARM project for NUCLEO-L552ZE-Q. If, in the clock configuration tab, I select HCLK/8 as SysTick clock source, the SysTick initialization code generated produces a wrong time base.

GRizz.1
Associate

The problem arises because by selecting both HCLK and HCLK/8 the SysTick is always initialized like this:

SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_ENABLE_Msk;

thus selecting HCLK as clock source in both cases.

Maybe the correct code should be:

SysTick->CTRL = SysTick_CTRL_ENABLE_Msk;

if HCLK/8 is to be taken as clock source.

0 REPLIES 0