2025-06-24 8:36 PM - last edited on 2025-06-25 1:18 AM by Andrew Neil
I configured STM32CubeMX to have a timebase source as SysTick. I'm using this for my scheduler. its running at 1ms. I also configured tim3 for 1ms sortof.
But for some reason this will not stay in synch with systick. They are drifting constantly apart.
The green lines are racing across my screen. Even though they are 1ms period as well. But obviously they couldn't be. I just don't understand why. Or maybe I have an issue with my data??
2025-06-24 8:37 PM
I should add that if I set the ARR to 500 then they stay in synch.
2025-06-24 10:03 PM
Well, then SysTick divider is set incorrectly.
JW
2025-06-25 2:11 AM
Hello @Carl_G
Please specify the STM32 series you are working on.
If the clock sources for SysTick and TIM3 are not derived from the same base clock or are configured differently, they may not stay synchronized
Note that there is a driver that can be used generate systick from timer (stm32xxxx_hal_timebase_tim_template.c)). To do this you need to choose TIMx as timebase in CubeMX.
2025-06-25 3:02 AM
Stm32G071. I checked systick in software and the debugger and it's 15999. I want to believe it's an illusion on my oscilloscope but the fact that setting the period to 500 works is confusing.