![ARTERY AT32F435 Series Reference Manual Download Page 248](http://html1.mh-extra.com/html/artery/at32f435-series/at32f435-series_reference-manual_2977592248.webp)
AT32F435/437
Series Reference Manual
2022.11.11
Page 248
Rev 2.03
counter overflow/underflow triggers an overflow event.
Setting 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.
Figure 14-3 Counter structure
Overflow event
(CNT_overflow)
Overflow event
TMRx_PR
Preload
Overflow event
PR_shadow
1
0
TMRx_DIV
Preload
PRBEN
DIV_shadow
0
1
PRBEN
DIV_counter
CNT_counter
TMR_CLK
DIV_overflow
Upcounting mode
Set CMSEL[1:0]=2’b00 and OWCDIR=1’b0 in the TMRx_CTRL1 register to enable upcounting mode. In
this mode, the counter counts from 0 to the value programmed in the TMRx_PR register, 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 at an overflow event.
Figure 14-4 Overflow event when PRBEN=0
0
1
2
3
...
31
32
0
1
2
3
...
31
32
0
1
2
3
COUNTER
31
32
0
1
32
...
PR[15:0]
OVFIF
TMR_CLK
0
DIV[15:0]
22
Clear
Clear
Clear
Figure 14-5 Overflow event when PRBEN=1
0
1
2
3
...
21
22
0
1
2
3
...
31
32
0
1
2
3
COUNTER
31
32
0
1
32
...
PR[15:0]
OVFIF
TMR_CLK
0
DIV[15:0]
22
Clear
Clear
Clear
Figure 14-6 Counter timing diagram with internal clock divided by 4
TMR_CLK
CNT_CLK
COUNTER
OVFIF
32
31
30
2F
4
DIV[15
:
0]
0
1
2
32
PR[15
:
0]
Clear