General-purpose timer (TIM2)
Counter register
CCRx = 4
CCRx=7
CCRx=8
CCRx>8
CCRx=0
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
in the TIMx_CR1 register. Moreover, the DIR and CMS bits must not be changed at the
same time by the software.
•
Writing to the counter while running in center-aligned mode is not recommended as it
can lead to unexpected results. In particular:
–
–
•
The safest way to use center-aligned mode is to generate an update by software
(setting the UG bit in the TIMx_EGR register) just before starting the counter and not to
write the counter while it is running.
856/1461
Figure 219. Center-aligned PWM waveforms (ARR=8)
0
1
2
OCxREF
CMS=01
CCxIF
CMS=10
CMS=11
OCxREF
CMS=10 or 11
CCxIF
'1'
OCxREF
CMS=01
CCxIF
CMS=10
CMS=11
'1'
OCxREF
CMS=01
CCxIF
CMS=10
CMS=11
'0'
OCxREF
CMS=01
CCxIF
CMS=10
CMS=11
The direction is not updated if a value greater than the auto-reload value is written
in the counter (TIMx_CNT>TIMx_ARR). For example, if the counter was counting
up, it continues to count up.
The direction is updated if 0 or the TIMx_ARR value is written in the counter but no
Update Event UEV is generated.
3
4
5
6
7
8
RM0453 Rev 1
7
6
5
4
3
2
RM0453
1
0
1
AI14681b
Need help?
Do you have a question about the STM32WL5 Series and is the answer not in the manual?
Questions and answers