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

14.3.4 Clock selection<br />

The counter clock can be provided by the following clock sources:<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 Using<br />

one timer as prescaler for another 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) and UG bits (in the TIMx_EGR register) are actual control bits and 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 92 shows the behavior of the control circuit and the upcounter in normal mode,<br />

without prescaler.<br />

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

Internal clock<br />

CEN=CNT_EN<br />

Counter clock = CK_CNT = CK_PSC<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 93. TI2 external clock connection example<br />

TI2<br />

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

UG<br />

CNT_INIT<br />

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

TIMx_SMCR<br />

TS[2:0]<br />

ITRx<br />

0xx<br />

TI2F<br />

or<br />

TI1F<br />

or<br />

or encoder<br />

mode<br />

Filter<br />

TI2F_Rising<br />

Edge<br />

Detector TI2F_Falling<br />

0<br />

1<br />

TI1_ED<br />

TI1FP1<br />

TI2FP2<br />

ETRF<br />

100<br />

101<br />

110<br />

111<br />

TRGI<br />

ETRF<br />

external clock<br />

mode 1 CK_PSC<br />

external clock<br />

mode 2<br />

ICF[3:0]<br />

TIMx_CCMR1<br />

CC2P<br />

TIMx_CCER<br />

CK_INT internal clock<br />

mode<br />

(internal clock)<br />

ECE SMS[2:0]<br />

TIMx_SMCR

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

Saved successfully!

Ooh no, something went wrong!