
GD32L23x User Manual
312
Figure 17-20. TIMER1 Master/Slave mode timer example
TIMER1
TIMER 2
Pre scaler
Counter
Master
mode
control
Trigger
selection
ITI0
CI0F_ED
CI0FE0
CI1FE1
ETIFP
TRGS
Slave mode
control
Pre scaler
Counter
TRG O
Other interconnection examples:
TIMER2 as prescaler for TIMER1
We configure TIMER2 as a prescaler for TIMER1. Refer to
Master/Slave mode timer example
for connections. Do as follow:
1. Configure TIMER2 in master mode and select its Update Event (UPE) as trigger output
(MMC=010 in the TIMER2_CTL1 register). Then TIMER2 drives a periodic signal on each
counter overflow.
2. Configure the TIMER2 period (TIMER2_CAR registers).
3. Select the TIMER1 input trigger source from TIMER2 (TRGS=000 in the
TIMER1_SMCFG register).
4. Configure TIMER1 in external clock mode 1 (SMC=111 in TIMER1_SMCFG register).
5. Start TIMER1 by w
riting ‘1 in the CEN bit (TIMER1_CTL0 register).
6.
Start TIMER2 by writing ‘1 in the CEN bit (TIMER2_CTL0 register).
Start TIMER1
with TIMER2’s Enable/Update signal
First, we enable TIMER1 with the enable out of TIMER2. Refer to
TIMER1 starts counting from its current value on the divided
internal clock after trigger by TIMER2 enable output.
When TIMER1 receives the trigger signal its CEN bit is automatically set and the counter
counts until we disable TIMER1. Both counter clock frequencies are divided by 3 by the