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 />

General-purpose timer (TIMx)<br />

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

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

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

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

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

TIMx_SR register) is set (depending on the URS bit):<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 113. Counter timing diagram, internal clock divided by 1, TIMx_ARR=0x6<br />

CK_INT<br />

CNT_EN<br />

Timer clock = CK_CNT<br />

Counter register<br />

04<br />

03 02 01 00 01 02 03 04 05 06 05 04 03<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.1: TIMx control register 1 (TIMx_CR1) on<br />

page 355).<br />

Figure 114. Counter timing diagram, internal clock divided by 2<br />

CK_INT<br />

CNT_EN<br />

TImer clock = CK_CNT<br />

Counter register<br />

0003 0002 0001 0000 0001 0002 0003<br />

Counter underflow<br />

Update event (UEV)<br />

Update interrupt flag (UIF)<br />

Doc ID 13902 Rev 9 329/995

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

Saved successfully!

Ooh no, something went wrong!