cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 timer wrong prescaler behavior until first event after reset

lastMcu
Associate II

I found that STM32F4 timers might count incorrectly until first update event if using a prescaler.

I can consistently reproduce this with multiple general purpose timers in a least two different STM32F4 variants, a STMF32407 and a STM32F429.

Is this a known issue? I cannot find any mention at the errata sheet.

2 REPLIES 2
lastMcu
Associate II

I think I found the issue. It is the normal behavior that the prescaler doesn't take effect until the next event "if changed on the fly". But seems that even if you change it not on the fly, while the counter is not enabled, the new prescaler still takes effect only after the next event. Not sure that make much sense to me. I would expect that writing to the prescaler before enabling the counter would take effect immediately. But as long as the exact behavior is clear is not very important. It is just, perhaps, a bit misleading that all the examples in the manual are only for changing the prescaler on the fly.

PSC is unconditionally preloaded, i.e. the value written to PSC does not get used until the next Update event (usually next overflow, but Update is a signal with complex source, read the TIM chapter in RM).

JW