2021-01-21 01:14 PM
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.