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.

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

The UEV update event can be disabled by software by setting the UDIS bit in the TIMx_CR1<br />

register. This is to avoid updating the shadow registers while writing new values in the<br />

preload registers. Then no update event occurs until UDIS bit has been written to 0.<br />

However, the counter continues counting up and down, based on the current auto-reload<br />

value.<br />

In addition, if the URS bit (update request selection) in TIMx_CR1 register is set, setting the<br />

UG bit generates an UEV update event but without setting the UIF flag (thus no interrupt or<br />

DMA request is sent). This is to avoid generating both update and capture interrupts when<br />

clearing the counter on the capture event.<br />

When an update event occurs, all the registers are updated and the update flag (UIF bit in<br />

TIMx_SR register) is set (depending on the URS bit):<br />

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

● The buffer of the prescaler is reloaded with the preload value (content of the TIMx_PSC<br />

register)<br />

● The auto-reload active register is updated with the preload value (content of the<br />

TIMx_ARR register). Note that if the update source is a counter overflow, the autoreload<br />

is updated before the counter is reloaded, so that the next period is the expected<br />

one (the counter is loaded with the new value).<br />

The following figures show some examples of the counter behavior for different clock<br />

frequencies.<br />

Figure 85. Counter timing diagram, internal clock divided by 1, TIMx_ARR = 0x6<br />

CK_PSC<br />

CNT_EN<br />

Timer clock = CK_CNT<br />

Counter register<br />

Counter underflow<br />

Counter overflow<br />

Update event (UEV)<br />

Update interrupt flag (UIF)<br />

1. Here, center-aligned mode 1 is used (for more details refer to Section 14.4: TIM1&TIM8 registers on page 390).<br />

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

04<br />

03 02 01 00 01 02 03 04 05 06 05 04 03

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

Saved successfully!

Ooh no, something went wrong!