09.12.2012 Views

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

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.

General-purpose timers (TIM2 to TIM5) <strong>RM0090</strong><br />

PWM edge-aligned mode<br />

Upcounting configuration<br />

Upcounting is active when the DIR bit in the TIMx_CR1 register is low. Refer to Section :<br />

Upcounting mode on page 421.<br />

In the following example, we consider PWM mode 1. The reference PWM signal OCxREF is<br />

high as long as TIMx_CNT 8<br />

CCxIF<br />

OCxREF<br />

CCRx=0<br />

CCxIF<br />

Downcounting configuration<br />

Downcounting is active when DIR bit in TIMx_CR1 register is high. Refer to Section :<br />

Downcounting mode on page 424.<br />

In PWM mode 1, the reference signal ocxref is low as long as TIMx_CNT>TIMx_CCRx else<br />

it becomes high. If the compare value in TIMx_CCRx is greater than the auto-reload value in<br />

TIMx_ARR, then ocxref is held at ‘1. 0% PWM is not possible in this mode.<br />

PWM center-aligned mode<br />

Center-aligned mode is active when the CMS bits in TIMx_CR1 register are different from<br />

‘00 (all the remaining configurations having the same effect on the ocxref/OCx signals). The<br />

compare flag is set when the counter counts up, when it counts down or both when it counts<br />

up and down depending on the CMS bits configuration. The direction bit (DIR) in the<br />

TIMx_CR1 register is updated by hardware and must not be changed by software. Refer to<br />

Section : Center-aligned mode (up/down counting) on page 426.<br />

Figure 150 shows some center-aligned PWM waveforms in an example where:<br />

● TIMx_ARR=8,<br />

● PWM mode is the PWM mode 1,<br />

● The flag is set when the counter counts down corresponding to the center-aligned<br />

mode 1 selected for CMS=01 in TIMx_CR1 register.<br />

439/1416 Doc ID 018909 Rev 3<br />

‘1<br />

‘0<br />

0 1 2 3 4 5 6 7 8 0 1

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

Saved successfully!

Ooh no, something went wrong!