GD32F403xx User Manual
256
0x1, 0x2 or 0x3.
◼
SMC1== 1’b1 (external clock mode 1). External input is selected as timer clock source
(ETI)
The TIMER_CK, which drives counter’s prescaler to count, can be triggered by the event of
rising or falling edge on the external pin ETI. This mode can be selected by setting the SMC1
bit in the TIMERx_SMCFG register to 1. The other way to select the ETI signal as the clock
source is to set the SMC [2:0] to 0x7 and the TRGS [2:0] to 0x7 respectively. Note that the
ETI signal is derived from the ETI pin sampled by a digital filter. When the ETI signal is
selected as clock source, the trigger controller including the edge detection circuitry will
generate a clock pulse on each ETI signal rising edge to clock the counter prescaler.
Clock prescaler
The counter clock (PSC_CK) is obtained by the TIMER_CK through the prescaler, and the
prescale f actor can be configured f rom 1 to 65536 through the prescaler register
(TIMERx_PSC). The new written prescaler value will not take effect until the next update
event.
Figure 16-3. Timing chart of PSC value change from 0 to 2
TIMER_CK
CEN
PSC_CLK
CNT_REG
Reload Pulse
Prescaler CNT
Prescaler
shadow
94
95
96
97
98
99
0
2
0
2
0
1
2
0
1
2
0
1
PSC value
UPG
0
2
0
1
2
Counter up counting
In this mode, the counter counts up continuously from 0 to the counter-reload value, which is
def ined in the TIMERx_CAR register, in a count-up direction. Once the counter reaches the
counter reload value, the counter will start counting up f rom 0 again and an o verf low event
will be generated. In addition, the update events will be generated af ter (TIME1)