
CH32V003
Reference Manual
V1.3
88
10.2.2 Clock input
Figure 10-2 Block diagram of CK_PSC source for advanced-control timer
The advanced-control timer CK_PSC has many clock sources and can be divided into 4 categories.
1)
The advanced-control timer CK_PSC has many clock sources and can be divided into 4 categories.
2)
Internal APB clock input route: CK_INT.
3)
Route from the comparison capture channel pin (TIMx_CHx): TIMx_CHx
→
TIx
→
TIxFPx, this route
is also used in encoder mode.
4)
Inputs from other internal timers: ITRx.
The actual operation can be divided into 4 categories by determining the choice of input pulse for the SMS of
the CK_PSC source.
1)
Selection of the internal clock source (CK_INT).
2)
External clock source mode 1.
3)
External clock source mode 2.
4)
Encoder mode.
All 4 clock source sources mentioned above can be selected by these 4 operations.
10.2.2.1 Internal clock source (CK_INT)
If the SMS field is held at 000b to start the advanced-control timer, then it is the internal clock source (CK_INT)
that is selected as the clock. At this point CK_INT is CK_PSC.
10.2.2.2 External clock source mode1
When the SMS domain is set to 111b, external clock source mode 1 is enabled. When external clock source 1
is enabled, TRGI is selected as the source of CK_PSC. it is worth noting that the source of TRGI also needs
to be selected by configuring the TS domain. the TS domain can select the following types of pulses as clock
sources.
1)
Internal trigger (ITRx, x is 0,1,2,3).
2)
Comparison of the signal after capturing channel 1 through the edge detector (TI1F_ED).
3)
Comparison of signals TI1FP1, TI2FP2 of the capture channel.
4)
The signal ETRF from the external clock pin input.
10.2.2.3 External clock source mode2
Use external trigger mode 2 to count on every rising or falling edge of the external clock pin input. When the
Encoder
mode
External clock
mode 1
External clock
mode 2
Internal clock
mode
CK_PSC
TI2F
TI1F
or
or
TRGI
ETRF
CK_INT
or
(internal clock)
TS[2:0]
TIMx_SMCR
0xx
100
101
110
111
ITRx
TI1_ED
TI1FP1
TI2FP2
ETRF
0
1
CC2P
TIMx_CCER
Edge
detector
TI2F_Rising
TI2F_Falling
Filter
ICF[3:0]
TIMx_CCMR1
TI2
ETR pin
ETP
TIMx_SMCR
0
1
ETR
Divider
/1,/2,/4,/8
ETPS[1:0]
TIMx_SMCR
ETF[3:0]
TIMx_SMCR
ETRP
f
DTS
Filter
downcounter
ECE
TIMx_SMCR
SMS[2:0]