Skip to main content
e d
Associate III
May 11, 2017
Solved

SysTick discrepancy compared to regular timers

  • May 11, 2017
  • 1 reply
  • 661 views
Posted on May 11, 2017 at 22:51

I am using the STM32L437 part and I run into some confusion with SysTick. I set up the SysTick to run at 1ms with timer 5 as Timebase source (for comparison). As a sanity check, I also set up timers 3, 4, 6 and 7 independently at 1ms as well, thinking they would all match up pretty closely but the results for SysTick and timer 5 are a bit different from the other 4 timers. In this test code I only use one clock source at a time (either internal OR external, no mixing... when using internal clock source the difference is even more pronounced). As you can see here the SysTick and timer 5 show 2669 seconds elapsed, but the other 4 regular timers show 2612 seconds, a difference of 57 seconds. Does SysTick run on a different clock than the other timers? Is there anything special about SysTick compared to other timers that I am not aware of. Thanks!

ED

0690X00000606x4QAA.png
    This topic has been closed for replies.
    Best answer by Tesla DeLorean
    Posted on May 11, 2017 at 23:40

    Prescaler and Period values for timers are programmed as N-1, people frequently program them wrong and get slower time (longer periods)

    TIMs and SysTick should all share a common synchronous clock source.

    1 reply

    Tesla DeLorean
    Tesla DeLoreanBest answer
    Guru
    May 11, 2017
    Posted on May 11, 2017 at 23:40

    Prescaler and Period values for timers are programmed as N-1, people frequently program them wrong and get slower time (longer periods)

    TIMs and SysTick should all share a common synchronous clock source.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..