
GD32F403xx User Manual
279
divided internal clock after trigger by timer2 enable output.
When Timer0 receives the trigger signal its CEN bit is set and the counter counts until we
disable timer0. Both counter clock frequencies are divided by 3 by the prescaler compared to
TIMER_CK (f CNT_CLK = f TIMER_CK /3). Do as follow:
1.
Configure Timer2 master mode to send its enable signal as trigger output(MMC=3’b001
in the TIMER2_C
TL1 register)
2. Conf igure Timer0 to select the input trigger f rom
Timer2 (TRGS=3’b010 in the
TIMERx_SMCFG register).
3.
Configure Timer0 in event mode (SMC=3’b 110 in TIMERx_SMCFG register).
4. Start Timer2 by writing 1 in the CEN bit (TIMER2_CTL0 register).
Figure 16-27. Triggering TIMER0 with enable signal of TIMER2
TIMER_CK
CNT_REG
CNT_REG
CEN
61
62
63
11
12
13
TRGIF
14
TIMER2
TIMER0
◼
Using an external trigger to start 2 timers synchronously
We conf igure the start of Timer0 is triggered by the enable of Timer2, and Timer2 is triggered
by its CI0 input rises edge. To ensure 2 timers start synchronously, Timer2 must be configured
in Master/Slave mode. Do as follow:
1.
Configure Timer2 slave mode to get the input trigger from CI0 (TRGS=3’b100 in the
TIMER2_SMCFG register).
2.
Configure Timer2 in event mode (SMC=3’b110 in the TIMER2_SMCFG register).
3.
Configure the Timer2 in Master/Slave mode by writing MSM=1 (TIMER2_SMCFG
register).
4.
Configure Timer0 to get the input trigger from Timer2 (TRGS=3’b010 in the
TIMERx_SMCFG register).
5.
Configure Timer0 in event mode (SMC=3’b110 in the TIMER0_SMCFG register).
When a rising edge occurs on Timer2’s CI0, two timer’s counters start counting synchronously
on the internal clock and both TRGIF f lags are set.
Содержание GD32F403 Series
Страница 1: ...GigaDevice Semiconductor Inc GD32F403xx Arm Cortex M4 32 bit MCU User Manual Revision 2 6 Jul 2022 ...
Страница 177: ...GD32F403xx UserManual 177 Peripheral Channel 0 Channel 1 Channel 2 Channel 3 Channel 4 SDIO SDIO ...
Страница 217: ...GD32F403xx UserManual 217 ensures that no conversion is in progress ...