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.

RM0008<br />

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

13.3.4 Clock selection<br />

The counter clock can be provided by the following clock sources:<br />

●<br />

●<br />

●<br />

●<br />

Internal clock (CK_INT)<br />

External clock mode1: external input pin<br />

External clock mode2: external trigger input ETR<br />

Internal trigger inputs (ITRx): using one timer as prescaler for another timer, for<br />

example, you can configure Timer 1 to act as a prescaler for Timer 2. Refer to Section :<br />

Using one timer as prescaler for another timer on page 353 for more details.<br />

Internal clock source (CK_INT)<br />

If the slave mode controller is disabled (SMS=000), then the CEN, DIR (in the TIMx_CR1<br />

register) <strong>and</strong> UG bits (in the TIMx_EGR register) are actual control bits <strong>and</strong> can be changed<br />

only by software (except UG which remains cleared automatically). As soon as the CEN bit<br />

is written to 1, the prescaler is clocked by the internal clock CK_INT.<br />

Figure 72 shows the behavior of the control circuit <strong>and</strong> the upcounter in normal mode,<br />

without prescaler.<br />

Figure 72. Control circuit in normal mode, internal clock divided by 1<br />

Internal clock<br />

CEN=CNT_EN<br />

UG<br />

CNT_INIT<br />

Counter clock = CK_CNT = CK_PSC<br />

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

External clock source mode 1<br />

This mode is selected when SMS=111 in the TIMx_SMCR register. The counter can count<br />

at each rising or falling edge on a selected input.<br />

Figure 73.<br />

TI2 external clock connection example<br />

TIMx_SMCR<br />

TS[2:0]<br />

TI2<br />

Filter<br />

ICF[3:0]<br />

TIMx_CCMR1<br />

TI2F_Rising<br />

Edge<br />

Detector TI2F_Falling<br />

TI2F or<br />

or<br />

TI1F or<br />

ITRx<br />

0xx<br />

TI1_ED<br />

100<br />

TI1FP1<br />

TRGI<br />

101<br />

0<br />

TI2FP2 110<br />

1 ETRF<br />

ETRF<br />

111<br />

CC2P<br />

CK_INT<br />

TIMx_CCER<br />

(internal clock)<br />

encoder<br />

mode<br />

external clock<br />

mode 1<br />

external clock<br />

mode 2<br />

internal clock<br />

mode<br />

CK_PSC<br />

ECE SMS[2:0]<br />

TIMx_SMCR<br />

Doc ID 13902 Rev 9 267/995

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

Saved successfully!

Ooh no, something went wrong!