cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 Timer event in foreground vs hardware Timer

Chris Pad
Associate II

I've a colleague who is using the 32-bit timer of an STM32 to trigger and interrupt handled pin toggle rather than using the 16-bit hardware Timer on the pin that needs toggling. The frequency on that pin varies a lot in use. When I wrote bringup code I used the 16bit Timer and a prescaler and that is a very small sacrifice compared to using 32bit resolution, particularly as the more interesting frequencies are high enough to have ARR below 2^6 for a PSC value of 0.

Presuming the interrupt is of the highest priority, I can't think of a good argument other than the intelligence of the interrupt approach. Is it correct to assume that the propagation delay of the pin toggle will be constant and therefore not a source of jitter? The frequency in use doesn't get high enough for the propagation delay to limit the operating frequency.

The colleague is a software developer rather than an embedded one and I often find I know that something isn't the way I would do it, but I can't put my finger on why.

20 REPLIES 20

> The inter-timer (TRGO-TRGI) mechanism is poorly described by ST. It is known to include an undefined delay, and it is unknown whether running timers on different clocks (e.g. different APB buses clocked differently) does or does not introduce a variable portion of this delay (i.e. jitter).

Do you have any references to support this concern? I'd like to learn more about it.