I'm coming from 8 bit MCUs, and I've used a system timer to generate a periodic interrupt that seems to be the motivation behind the Cortex M SysTick timer?

Is there some kind of architectural significance to using the SysTick timer versus any other timer on the Cortex M MCUs?

Is it just a matter of coding preference, that programmers have used the SysTick timer as the primary every few ms timer?

The 800 page reference manual is pretty silent on SysTick other than how you apply post/prescalars.

I see it is a default high priority interrupt, so it kind of the path of least resistance for the system tick. But the interrupt priority is settable.

(The origin of this question is that I am using the STM32CubeMX to generate a project template, and when you go to add FreeRTOS, the Cube generates a warning that FreeRTOS should use a separate timer from SysTick... what makes me wonder if there something else at play here? I has just assumed you would the SysTick because that is "how things are done"...).

  • 3
    \$\begingroup\$ SysTick is a standard ARM-defined timer. While the others are peripherals specific to the MCUs and not part of the core. \$\endgroup\$ – Eugene Sh. Jan 17 '18 at 17:52
  • 1
    \$\begingroup\$ I would guess the latency difference is negligible. It's a part of the core definition. I would say a core in it's minimum should have some minimal set of HW to be able to run some minimal SW. Without timers at all it won't be possible. \$\endgroup\$ – Eugene Sh. Jan 17 '18 at 17:59
  • 1
    \$\begingroup\$ And I think this is always designed with an OS in mind. So one can have a somewhat universal portable kernel, and just have "drivers" for the variable hardware. \$\endgroup\$ – Eugene Sh. Jan 17 '18 at 18:07
  • 1
    \$\begingroup\$ @Leroy105 Put in other words, you need to understand that ARM is a company (sold a year ago?) that does NOT fabricate CPUs but instead offers intellectual property (masks and/or synthesizable source) to those who will be directly fabricating such devices or brokering it out for fabrication. They stay out of the competition there. Those buying the IP from ARM will add their own peripherals to differentiate themselves from others. The SysTick is part of the ARM CORE IP. So all ARM manufacturers have it. Not all ARM have anything else, though. This makes SysTick unique. Make sense? \$\endgroup\$ – jonk Jan 17 '18 at 18:10
  • 3
    \$\begingroup\$ @EugeneSh. FreeRTOS is often clocked by SysTick, but not always. I'm working on a low-power application where SysTick gets shut down in some states so FreeRTOS is clocked by one of the other timers. \$\endgroup\$ – brhans Jan 17 '18 at 18:28

As answered in comments.

The SysTick if present is part of the ARM core, the other timers are from the chip vendor. SysTick has a more direct event (think interrupt) to the core where the other times come in through interrupts, not that that matters. And other timers tend to have more features.

You tagged Cortex-M so this is likely a microcontroller which means you might be doing baremetal which means you can do whatever you want, you decide what timers do what. If you take some already made RTOS or OS for that chip then they have decided what resources they want to consume and why. Primarily opinion based as far as that goes.

The systick timer is a lot easier and simpler to get going, and isnt always present, some cores dont have it as an option at all and some as an option (for the chip vendor to decide at compile time), so it has that advantage, although there may be some timers in some chips that are equally simple.

Chip vendor timers can sometimes drive I/O pins or have some external involvement where the systick is AFAIK contained within the core.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.