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.

<strong>RM0090</strong> General-purpose timers (TIM2 to TIM5)<br />

15.3.3 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 (TIx)<br />

● External clock mode2: external trigger input (ETR) available on TIM2, TIM3 and TIM4<br />

only.<br />

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

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

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

Internal clock source (CK_INT)<br />

If the slave mode controller is disabled (SMS=000 in the TIMx_SMCR register), then the<br />

CEN, DIR (in the TIMx_CR1 register) and UG bits (in the TIMx_EGR register) are actual<br />

control bits and can be changed only by software (except UG which remains cleared<br />

automatically). As soon as the CEN bit is written to 1, the prescaler is clocked by the internal<br />

clock CK_INT.<br />

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

without prescaler.<br />

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

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

Doc ID 018909 Rev 3 430/1416

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

Saved successfully!

Ooh no, something went wrong!