DocID025202 Rev 7
576/1080
RM0365
General-purpose timers (TIM2/TIM3/TIM4)
618
compare flag is set when the counter counts up, when it counts down or both when it counts
up and down depending on the CMS bits configuration. The direction bit (DIR) in the
TIMx_CR1 register is updated by hardware and must not be changed by software. Refer to
Center-aligned mode (up/down counting) on page 560
shows some center-aligned PWM waveforms in an example where:
•
TIMx_ARR=8,
•
PWM mode is the PWM mode 1,
•
The flag is set when the counter counts down corresponding to the center-aligned
mode 1 selected for CMS=01 in TIMx_CR1 register.
Figure 220. Center-aligned PWM waveforms (ARR=8)
Hints on using center-aligned mode:
•
When starting in center-aligned mode, the current up-down configuration is used. It
means that the counter counts up or down depending on the value written in the DIR bit
&&[,)
&RXQWHUUHJLVWHU
&&5[
2&[5()
&06
&06
&06
&&[,)
&&5[
2&[5()
&06 RU
&&[,)
&&5[
2&[5()
&06
&06
&06
µ¶
&&[,)
&&5[!
2&[5()
&06
&06
&06
µ¶
&&[,)
&&5[
2&[5()
&06
&06
&06
µ¶
$,E