STM32 - Timers - Measuring Time

From Embedded Workshop
Revision as of 10:32, 4 October 2022 by JMerkle (talk | contribs) (Created page with "Each of the STM32 parts has multiple timers, and some are better than others for measuring the duration of a function. I firmly believe until you actually measure the time a...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Each of the STM32 parts has multiple timers, and some are better than others for measuring the duration of a function.

I firmly believe until you actually measure the time a function takes, you are just guessing,
thinking "the function is working just fine"....
But, to measure the duration of many functions, you need a time base much finer than an OS Tick.
Micro-second resolution is required.
Although I'd like a 32 bit timer, not all the STM32 parts have one.
I'm pretty sure all have at least a 16-bit timer.  Let's choose an unused timer, and get it
counting micro-second units of time.