Advanced control timer (TIM1) UM0306
180/519
12.4.14 6-step PWM generation
When complementary outputs are used on a channel, preload bits are available on the
OCxM, CCxE and CCxNE bits. The preload bits are transferred to the shadow bits at the
COM commutation event. Thus you can program in advance the configuration for the next
step and change the configuration of all the channels at the same time. COM can be
generated by software by setting the COM bit in the TIM1_EGR register or by hardware (on
TRGI rising edge).
A flag is set when the COM event occurs (COMIF bit in the TIM1_SR register), which can
generate an interrupt (if the COMIE bit is set in the TIM1_DIER register) or a DMA request
(if the COMDE bit is set in the TIM1_DIER register).
The Figure 63 describes the behavior of the OCx and OCxN outputs when a COM event
occurs, in 3 different examples of programmed configurations.
Figure 63. 6-step generation, COM example (OSSR=1)
counter (CNT)
OCxREF
(CCRx)
OCx
OCxN
CCxE=1
CCxNE=0
OCxM=110 (PWM1)
Write CCxE to 0
Write COM to 1
COM event
CCxE=1
CCxNE=0
OCxM=100
OCx
OCxN
CCxE=1
CCxNE=0
OCxM=100 (forced active)
Write CCxNE to 1 CCxE=0
CCxNE=1
OCxM=101
OCx
OCxN
CCxE=1
CCxNE=1
OCxM=110 (PWM1)
Write CCxE and CxNE to 0 CCxE=1
CCxNE=0
OCxM=100
EXAMPLE 1
EXAMPLE 2
EXAMPLE 3