09.12.2012 Views

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

The repetition counter is decremented:<br />

● At each counter overflow in upcounting mode,<br />

● At each counter underflow in downcounting mode,<br />

● At each counter overflow and at each counter underflow in center-aligned mode.<br />

Although this limits the maximum number of repetition to 128 PWM cycles, it makes it<br />

possible to update the duty cycle twice per PWM period. When refreshing compare<br />

registers only once per PWM period in center-aligned mode, maximum resolution is<br />

2xT ck , due to the symmetry of the pattern.<br />

The repetition counter is an auto-reload type; the repetition rate is maintained as defined by<br />

the TIMx_RCR register value (refer to Figure 91). When the update event is generated by<br />

software (by setting the UG bit in TIMx_EGR register) or by hardware through the slave<br />

mode controller, it occurs immediately whatever the value of the repetition counter is and the<br />

repetition counter is reloaded with the content of the TIMx_RCR register.<br />

In center-aligned mode, for odd values of RCR, the update event occurs either on the<br />

overflow or on the underflow depending on when the RCR register was written and when the<br />

counter was started. If the RCR was written before starting the counter, the UEV occurs on<br />

the overflow. If the RCR was written after starting the counter, the UEV occurs on the<br />

underflow. For example for RCR = 3, the UEV is generated on each 4th overflow or<br />

underflow event depending on when RCR was written.<br />

Figure 91. Update rate examples depending on mode and TIMx_RCR register<br />

settings<br />

Counter<br />

TIMx_CNT<br />

TIMx_RCR = 0<br />

TIMx_RCR = 1<br />

TIMx_RCR = 2<br />

TIMx_RCR = 3 UEV<br />

TIMx_RCR = 3<br />

and<br />

re-synchronization<br />

UEV<br />

UEV<br />

UEV<br />

UEV<br />

Center-aligned mode Edge-aligned mode<br />

(by SW) (by SW)<br />

Upcounting Downcounting<br />

(by SW)<br />

UEV Update Event: Preload registers transferred to active registers and update interrupt generated<br />

Doc ID 018909 Rev 3 362/1416

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

Saved successfully!

Ooh no, something went wrong!