General-purpose timers (TIM15/TIM16/TIM17)
RM0365
639/1080
DocID025202 Rev 7
As the preload registers are transferred to the shadow registers only when an update event
occurs, before starting the counter, you have to initialize all the registers by setting the UG
bit in the TIMx_EGR register.
OCx polarity is software programmable using the CCxP bit in the TIMx_CCER register. It
can be programmed as active high or active low. OCx output is enabled by a combination of
the CCxE, CCxNE, MOE, OSSI and OSSR bits (TIMx_CCER and TIMx_BDTR registers).
Refer to the TIMx_CCER register description for more details.
In PWM mode (1 or 2), TIMx_CNT and TIMx_CCRx are always compared to determine
whether TIMx_CCRx
≤
TIMx_CNT or TIMx_CNT
≤
TIMx_CCRx (depending on the direction
of the counter).
The TIM15/TIM16/TIM17 are capable of upcounting only. Refer to
.
In the following example, we consider PWM mode 1. The reference PWM signal OCxREF is
high as long as TIMx_CNT < TIMx_CCRx else it becomes low. If the compare value in
TIMx_CCRx is greater than the auto-reload value (in TIMx_ARR) then OCxREF is held at
‘1’. If the compare value is 0 then OCxRef is held at ‘0’.
shows some edge-
aligned PWM waveforms in an example where TIMx_ARR=8.
Figure 258. Edge-aligned PWM waveforms (ARR=8)
22.4.11
Combined PWM mode (TIM15 only)
Combined PWM mode allows two edge or center-aligned PWM signals to be generated with
programmable delay and phase shift between respective pulses. While the frequency is
determined by the value of the TIMx_ARR register, the duty cycle and delay are determined
069
&RXQWHUUHJLVWHU
µ¶
2&;5()
&&[,)
2&;5()
&&[,)
2&;5()
&&[,)
2&;5()
&&[,)
&&5[
&&5[
&&5[!
&&5[
µ¶