
AT32F435/437
Series Reference Manual
2022.11.11
Page 311
Rev 2.03
Figure 14-539 Channel output stage (channel 1 to 3)
TMRx_CM1
/CM2
CxORAW
CxOUT
CNT_value>CxDT
CNT_value = CxDT
To the master mode
controller
CNT_value
CxDT
Compare
CxP
TMRx_BRK
Output
Compare
Mode
CxCOUT
EXT
Output mode
controller
Dead time
generate
CxCP
Polarity selection
Polarity selection
CxEN
CxCEN
Output enable
Output enable
Figure 14-80 Channel 4 output stage
TMRx_CM2
C4ORAW
C4EN
C4OUT
CNT_value>C4DT
CNT_value=C4DT
To the master mode
controller
CNT_value
C4DT
Compare
C4P
Output mode
controller
Polarity
selection
Output enable
EXT
Output mode
Write CxC[1: 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
signal CxORAW is generated according to the output mode selected by CxOCTRL[2: 0], which is sent
to IO after being processed by the output control circuit. The period of the output signal is configured by
the TMRx_PR register, while the duty cycle by the TMRx_CxDT register.
Output compare modes include:
PWM mode A:
Set CxOCTRL=3’b110 to enable PWM mode A. In upcounting, when
TMRx_C1DT>TMRx_CVAL, C1ORAW outputs high; otherwise, outputs low. In downcounting,
when TMRx_C1DT<TMRx_CVAL, C1ORAW outputs low; otherwise, outputs high. To set PWM
mode A, the following process is recommended:
-
Set the TMRx_PR register to set PWM period;
-
Set the TMRx_CxDT register to set PWM duty cycle;
-
Set CxOCTRL=3
’b110 in the TMRx_CM1/CM2 register to set output mode as PWM mode A;
-
Set the TMRx_DIV register and set the counting frequency;
-
Set the TWCMSEL[1:0] bit in the TMRx_CTRL1 register to set the count mode;
-
Set CxP bit and CxCP bit in the TMRx_CCTRL register to set output polarity;
-
Set CxEN bit and CxCEN bit in the TMRx_CCTRL register to enable channel output;
-
Set the OEN bit in the TMRx_BRK register to enable TMRx output;
-
Set the corresponding GPIO of TMR output channel as the multiplexed mode;
-
Set the TMREN bit in the TMRx_CTRL1 register to enable TMRx counter.
PWM mode B:
Set CxOCTRL=3’b111 to enable PWM mode B. In upcounting, when
TMRx_C1DT>TMRx_CVAL, C1ORAW outputs low; otherwise, outputs high. In downcounting,
when TMRx_C1DT<TMRx_CVAL, C1ORAW outputs high; otherwise, outputs low.
Forced output mode:
Set CxOCTRL=3’b100/101 to enable forced output mode. In this case,
the CxORAW is forced to be the programmed level, irrespective of the counter value. Despite
this, the channel flag bit and DMA request still depend on the compare result.
Output compare mode:
Set CxOCTRL=3’b001/010/011 to enable output compare mode. In this
case, when the counter value matches the value of the CxDT register, the CxORAW is forced
high (CxOCTRL=3’b001), low (CxOCTRL=3’b010) or toggling (CxOCTRL=3’b011).