STM32 gotchas
290. In Up-Down (Center-Aligned) mode, Timer runs somewhat faster than expected - not twice the period in plain Up or Down mode

The total period of timer set in up-down (center-aligned) mode (i.e. TIMx_CR1.CMS > 0b00) - established e.g. by observing the output waveform in PWM mode - is somewhat surprisingly not twice the period in plain up-counting (or plain down-counting) mode.

The reason is, that while in up-counting and down-counting mode the timer's counter goes through every value from 0 to TIMx_ARR (inclusive) once; in up-down mode it goes through values 1 to (TIMx_ARR - 1) twice (once when counting up and once when counting down), but it dwells on values 0 and TIMx_ARR only once per total timer period.

Thus, the total period of timer in up-down mode is ((TIMx_PSC + 1) * 2 * TIMx_ARR).


See also g291