![GigaDevice Semiconductor GD32F20 Series User Manual Download Page 357](http://html.mh-extra.com/html/gigadevice-semiconductor/gd32f20-series/gd32f20-series_user-manual_2225801357.webp)
GD32F20x User Manual
357
We configure the start of Timer0 triggered by the enable signal 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 in 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 flags are set.
Figure 18-31. Triggering TIMER0 and TIMER2 with TIMER2
’s CI0 input
TIMER_CK
CNT_REG
CNT_REG
CI0
00
01
CEN
02
03
00
01
02
03
CNT_CK
TRGIF
CEN
TRGIF
TIMER2
TIMER0
Timer DMA mode
Timer’s DMA mode is the function that configures timer’s register by DMA module. The
relative registers are TIMERx_DMACFG and TIMERx_DMATB. Of course, you have to
enable a DMA request which will be asserted by some internal event. When the interrupt
event was asserted, TIMERx will send a request to DMA, which is configured to M2P mode
and PADDR is TIMERx_DMATB, then DMA will access the TIMERx_DMATB. In fact, register
TIMERx_DMATB is only a buffer; timer will map the TIMERx_DMATB to an internal register,
Summary of Contents for GD32F20 Series
Page 191: ...GD32F20x User Manual 191 Bits Fields Descriptions 31 0 TRNDATA 31 0 32 Bit Random data ...
Page 290: ...GD32F20x User Manual 290 conversion is ongoing ...
Page 325: ...GD32F20x User Manual 325 15 0 ALRM 15 0 RTC alarm value low ...
Page 385: ...GD32F20x User Manual 385 ...
Page 523: ...GD32F20x User Manual 523 clears AERR bit by writing 0 to it ...