29.01.2015 Views

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

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

RM0008<br />

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

However, the counter restarts from 0, as well as the counter of the prescaler (but the<br />

prescale rate does not change). In addition, if the URS bit (update request selection) in<br />

TIMx_CR1 register is set, setting the UG bit generates an update event UEV but without<br />

setting the UIF flag (thus no interrupt or DMA request is sent). This is to avoid generating<br />

both update <strong>and</strong> capture interrupts when 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 repetition counter is reloaded with the content of TIMx_RCR register,<br />

● The auto-reload shadow register is updated with the preload value (TIMx_ARR),<br />

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

register).<br />

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

frequencies when TIMx_ARR=0x36.<br />

Figure 54. Counter timing diagram, internal clock divided by 1<br />

CK_PSC<br />

CNT_EN<br />

Timer clock = CK_CNT<br />

Counter register<br />

31<br />

32 33 34 35 36 00 01 02 03 04 05 06 07<br />

Counter overflow<br />

Update event (UEV)<br />

Update interrupt flag (UIF)<br />

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

CK_PSC<br />

CNT_EN<br />

Timer clock = CK_CNT<br />

Counter register<br />

0034 0035 0036 0000 0001 0002 0003<br />

Counter overflow<br />

Update event (UEV)<br />

Update interrupt flag (UIF)<br />

258/995 Doc ID 13902 Rev 9

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

Saved successfully!

Ooh no, something went wrong!