AT32F425
Series Reference Manual
2022.03.30
Page 201
Ver 2.01
Starting master and slave timers synchronously by an external trigger:
In this example, configure the master timer as master/slave mode synchronously and enable its slave
timer synchronization function. This mode is used for synchronization between master timer and slave
timer.
Set the STS bit of the master timer.
Configure master timer output signal TRGOUT as an overflow event (PTOS[2: 0]=3’b010). The
master timer outputs a pulse signal at each counter overflow event, which is used as the counting
clock of the slave timer.
Configure the slave timer mode of the master timer as trigger mode, and select C1IN as trigger
source
Configure slave timer trigger input signal TRGIN as master timer output
Configure slave timer as trigger mode (SMSEL=3’b110 in the TMR2_STCTRL register)
Figure 14-31
Starting master and slave timers synchronously by an external trigger
COUNTER
PR[15:0]
TMREN
TMR_CLK
0
DIV[15:0]
32
22
PR[15:0]
TRGIN
1
...
21
22
0
1
2
3
...
21
COUNTER
0
1
2
3
22
0
0
DIV[15:0]
TMR_CLK
Master
TMR
Slave
TMR
1
...
31
32
0
1
2
3
...
31
0
1
2
3
32
0
TMR_EN
14.2.3.6 Debug mode
When the microcontroller enters debug mode (Cortex
TM
-M4 core halted), the TMRx counter stops
counting by setting the TMRx_PAUSE in the DEBUG module.
14.2.4 TMR2 and TMR3 registers
These peripheral registers must be accessed by word (32 bits).
TMR2 and TMR3 register are mapped into a 32-bit addressable space.
Table 14-5 TMR2 and TMR3 register map and reset value
Register
Offset
Reset value
TMRx_CTRL1
0x00
0x0000
TMRx_CTRL2
0x04
0x0000
TMRx_STCTRL
0x08
0x0000
TMRx_IDEN
0x0C
0x0000
TMRx_ISTS
0x10
0x0000
TMRx_SWEVT
0x14
0x0000
TMRx_CM1
0x18
0x0000
TMRx_CM2
0x1C
0x0000
TMRx_CCTRL
0x20
0x0000
TMRx_CVAL
0x24
0x0000
TMRx_DIV
0x28
0x0000