EasyManuals Logo

ST STM32F10 Series User Manual

ST STM32F10 Series
519 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #165 background imageLoading...
Page #165 background image
UM0306 Advanced control timer (TIM1)
165/519
For example, to configure the up-counter to count in response to a rising edge on the TI2
input, use the following procedure:
1. Configure channel 2 to detect rising edges on the TI2 input by writing CC2S= ‘01’ in the
TIM1_CCMR1 register.
2. Configure the input filter duration by writing the IC2F[3:0] bits in the TIM1_CCMR1
register (if no filter is needed, keep IC2F=0000).
3. Select rising edge polarity by writing CC2P=0 in the TIM1_CCER register.
4. Configure the timer in external clock mode 1 by writing SMS=111 in the TIM1_SMCR
register.
5. Select TI2 as the trigger input source by writing TS=110 in the TIM1_SMCR register.
6. Enable the counter by writing CEN=1 in the TIM1_CR1 register.
Note: The capture prescaler is not used for triggering, so you don’t need to configure it.
When a rising edge occurs on TI2, the counter counts once and the TIF flag is set.
The delay between the rising edge on TI2 and the actual clock of the counter is due to the
resynchronization circuit on TI2 input.
Figure 47. Control circuit in external clock mode 1
External clock source mode 2
This mode is selected by writing ECE=1 in the TIM1_SMCR register.
The counter can count at each rising or falling edge on the external trigger input ETR.
The Figure 48 gives an overview of the external trigger input block.
Figure 48. External trigger input block
COUNTER CLOCK = CK_CNT = CK_PSC
COUNTER REGISTER
35 3634
TI2
CNT_EN
TIF
Write TIF=0
ETR
0
1
TIM1_SMCR
ETP
divider
/1, /2, /4, /8
ETPS[1:0]
ETRP
filter
ETF[3:0]
down-counter
f
DTS
TIM1_SMCR
TIM1_SMCR
ETR pin
CK_INT
encoder
mode
external clock
mode 1
external clock
mode 2
internal clock
mode
ETRF
trgi
ti1f
ti2f
or
or
or
(internal clock)
ck_psc
ECE
TIM1_SMCR
SMS[2:0]
www.BDTIC.com/ST

Table of Contents

Other manuals for ST STM32F10 Series

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the ST STM32F10 Series and is the answer not in the manual?

ST STM32F10 Series Specifications

General IconGeneral
BrandST
ModelSTM32F10 Series
CategoryMicrocontrollers
LanguageEnglish

Related product manuals