29.01.2015 Views

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

RM0008<br />

Advanced-control timers (TIM1&TIM8)<br />

13.3.14 6-step PWM generation<br />

When complementary outputs are used on a channel, preload bits are available on the<br />

OCxM, CCxE <strong>and</strong> CCxNE bits. The preload bits are transferred to the shadow bits at the<br />

COM commutation event. Thus you can program in advance the configuration for the next<br />

step <strong>and</strong> change the configuration of all the channels at the same time. COM can be<br />

generated by software by setting the COM bit in the TIMx_EGR register or by hardware (on<br />

TRGI rising edge).<br />

A flag is set when the COM event occurs (COMIF bit in the TIMx_SR register), which can<br />

generate an interrupt (if the COMIE bit is set in the TIMx_DIER register) or a DMA request<br />

(if the COMDE bit is set in the TIMx_DIER register).<br />

The Figure 90 describes the behavior of the OCx <strong>and</strong> OCxN outputs when a COM event<br />

occurs, in 3 different examples of programmed configurations.<br />

Figure 90.<br />

6-step generation, COM example (OSSR=1)<br />

counter (CNT)<br />

(CCRx)<br />

OCxREF<br />

Write COM to 1<br />

COM event<br />

Example 1<br />

OCx<br />

OCxN<br />

CCxE=1<br />

write OCxM to 100<br />

CCxNE=0<br />

OCxM=100 (forced inactive)<br />

CCxE=1<br />

CCxNE=0<br />

OCxM=100<br />

Example 2<br />

OCx<br />

OCxN<br />

Write CCxNE to 1<br />

<strong>and</strong> OCxM to 101<br />

CCxE=1<br />

CCxNE=0<br />

OCxM=100 (forced inactive)<br />

CCxE=0<br />

CCxNE=1<br />

OCxM=101<br />

Example 3<br />

OCx<br />

OCxN<br />

write CCxNE to 0<br />

CCxE=1<br />

<strong>and</strong> OCxM to 100<br />

CCxNE=0<br />

OCxM=100 (forced inactive)<br />

CCxE=1<br />

CCxNE=0<br />

OCxM=100<br />

ai14910<br />

Doc ID 13902 Rev 9 283/995

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!