AT32F421
Series Reference Manual
2022.11.11
Page 242
Rev 2.02
Figure 14-82
Input/output channel 1 main circuit
Capture
CNT counter
C1DT
Compare
C1DT
preload
0
1
C1OBEN
C1DT_shadow
C1OCTRL
Overflow event
DTC
Dead time
C1ORAW
1
0
C1EN
1
0
0
1
disable
C1P
FCSOEN
OEN
1
0
C1CEN
1
0
0
1
disable
C1CP
FCSOEN
OEN
C1P/C1CP
edge detector
C1IN
TMRx_CH1
C1IRAW
filter
C1DF
C1IFP1
C2IFP1
STCI
C1C
C1IDIV
input divider
Capture trigger
C1P
polarity select
C1CP
polarity select
BRK
BRK
C1OUT
C1COUT
to GPIO
to GPIO
0
1
disable
frozen
state
0
1
0
1
C1IOS
FCSODIS
0
1
disable
frozen
state
0
1
0
1
C1CIOS
FCSODIS
C1EN
Figure 14-83 Channel 1 input stage
Capture
CNT counter
C1DT
C1P/C1CP
edge detector
C1IF
C1IN
C1IFP1
C2IFP1
STCI
C1C
C1IDIV
input divider
C1IPS
TMRx_CH1
filter
C1DF
C1SWTR
C1EN
AND
Input mode
In input mode, the TMRx_CxDT registers latch the current counter values after the selected trigger signal
is detected, and the capture compare interrupt flag bit (CxIF) is set. An interrupt or a DMA request will
be generated if the CxIEN and CxDEN bits are enabled. If the selected trigger signal is detected when
the CxIF is set to 1, a capture overflow event occurs. The TMRx_CxDT register overwrites the recorded
value with the current counter value, and the CxRF is set to 1.
To capture the rising edge of C1IN input, following the configuration procedure mentioned below:
Set C1C=01 in the TMRx_CM1 register to select the C1IN as channel 1 input
Set the filter bandwidth of C1IN signal (CxDF[3: 0])
Set the active edge on the C1IN channel by writing C1P=0 (rising edge) in the TMRx_CCTRL
register
Program the capture frequency division of C1IN signal (C1DIV[1: 0])
Enable channel 1 input capture (C1EN=1)
If needed, enable the relevant interrupt or DMA request by setting the C1IEN bit in the TMRx_IDEN
register or the C1DEN bit in the TMRx_IDEN register
14.5.3.4 TMR output function
The TMR output consists of a comparator and an output controller. It is used to program the period, duty
cycle and polarity of the output signal.
Figure 14-84 Channel 1 output stage
TMRx_CM1
C1ORAW
C1OUT
CNT_value>C1DT
CNT_value = C1DT
To the master mode
controller
CNT_value
C1DT
Compare
C1P
TMRx_BRK
Output
Compare
Mode
C1COUT
Output mode
controller
Dead time
generate
C1CP
Polarity selection
Polarity selection
C1EN
C1CEN
Output enable
Output enable
Output mode
Write CxC[2: 0]≠2’b00 to configure the channel as output to implement multiple output modes. In this
case, the counter value is compared with the value in the TMRx_CxDT register, and the intermediate