AT32F421 Series Reference Manual
2022.11.11 Page 142 Rev 2.02
Figure 12-11 Data sampling for noise detection
RX pin
one bit time
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Sample bits
Oversampling
16
12.9 Tx/Rx swap
When the TRPSWAP bit (USART_CTRL2[15]) is set, Tx/Rx pin can be swapped. Two common scenes
are listed below:
If the Tx/Rx were reversed while the user attempts to connect the device externally to a RS-232
chip, it is possible to swap the Tx/Rx through the TRPSWAP bit, without the need of hardware
intervention.
If the user only connected the master Tx to the slave Rx in full-duplex mode, the Tx/Rx can be
interchangeable with the TRPSWAP bit, after the master and slave are swapped, without the need of
hardware intervention.
Figure 12-12 Tx/Rx swap
TX TX
RX RX
MCU MCU
USART_TX
USART_TX
USART_RX
USART_RX
USART
USART
TRPSWAP=0
TRPSWAP=1
Note: The SWAP (USART_CTRL2[15]) can be modified only when the USART is disabled (UEN=0)
12.10 Interrupt requests
USART interrupt generator serves as a control center of USART interrupts. It is used to monitor the
interrupt source inside the USART in real time, and to define the generation of interrupts by configuring
the corresponding interrupt enable bits. Table 12-4 shows the USART interrupt sources and their
interrupt enable bits. An interrupt will be generated over an event when the corresponding interrupt
enable bit is set.
Table 12-4 USART interrupt request
Transmit data register empty
Noise error, overflow error or framing error