
AT32F413
Series Reference Manual
2022.06.27
Page 185
Rev 2.00
Internal trigger input (ISx)
Interconnection and synchronization are supported between timers. The TMR_CLK of one timer can be
provided by the TRGOUT signal output of another timer. Set the STIS[2: 0] bit to select internal trigger
signal to enable counting.
Each timer (TMR2 to TMR5) consists of a 16-bit prescaler, which is used to generate the CK_CNT that
enables the counter to count. The frequency division relationship between the CK_CNT and TMR_CLK
can be adjusted by setting the value of the TMRx_DIV register. The prescaler value can be modified at
any time, but it takes effect only when the next overflow event occurs.
Table 14-2
TMRx internal trigger connection
Slave controler
IS0
(STIS = 000)
IS1
(STIS = 001)
IS2
(STIS = 010)
IS3
(STIS = 011)
TMR2
TMR1
TMR8/USB_SOF
(2)
TMR3
TMR4
TMR3
TMR1
TMR2
TMR5
TMR4
TMR4
TMR1
TMR2
TMR3
TMR8
TMR5
TMR2
TMR3
TMR4
TMR8
Note 1: If there is no corresponding timer in a device, the corresponding trigger signal ISx is not present.
Note 2: TMR8 or USB_SOF is available for IS1 to select, depending on the TMR2IS1_IRMP bit of the
IOMUX_MAP4 register.
Figure 14-7
Counter timing with prescaler value changing from 1 to 4
TMR_CLK
CK_CNT
COUNTER
OVFIF
DIV[15
:
0]
18
17
19
1A
1B
1C
0
3
00
01
Clear
PR[15
:
0]
1C
14.1.3.2 Counting mode
The timer (TMR2 to TMR5) supports several counting modes to meet different application scenarios.
Each timer has an internal 16-bit up, down, up/down counter. TMR2/5 can be extended to 32-bit by
setting the PMEN bit. The TMRx_PR register is loaded with the counter value. The value in the
TMRx_PR is immediately moved to the shadow register by deault. When the periodic buffer is enabled
(PRBEN=1), the value in the TMRx_PR register is transferred to the shadow register only at an overflow
event. The OVFEN and OVFS bits are used to configure the overflow event.
Settng the TMREN bit (TMREN=1) enables the timer to start counting. Base on synchronization logic,
however, the actual enable signal TMR_EN is set 1 clock cycle after the TMREN is set.
Upcounting mode
In upcounting mode, the counter counts from 0 to the value programmed in the TMRx_PR register, then
restarts from 0, and generates a counter overflow event, with the OVFIF bit being set to 1. If the overflow
event is disabled, the counter is no longer reloaded with the preload value and period value at a counter
overflow event, otherwise, the counter is updated with the preload value and period value on an overflow
event.