AT32F425
Series Reference Manual
2022.03.30
Page 154
Ver 2.01
If RDBF=1, it indicates that the last valid data is still stored in the receive data buffer, and
can be read.
If RDBF=0, it indicates that the last valid data in the receive data buffer has already been
read.
Note: The REN bit cannot be reset during data reception, or the byte that is currently being received will
be lost.
12.8.3 Start bit and noise detection
A start bit detection occurs when the REN bit is set. With the oversampling techniques, the USART
receiver samples data on the 3rd, 5th, 7th, 8th, 9th and 10th bits to detect the valid start bit and noise.
shows the data sampling over start bit and noise detection.
Table 12-2 Data sampling over start bit and noise detection
Sampled value (3·5·7)
Sampled value (8·9·10)
NERR bit
Start bit validity
000
000
0
Valid
001/010/100
001/010/100
1
Valid
001/010/100
000
1
Valid
000
001/010/100
1
Valid
111/110/101/011
Any value
1
Invalid
Any value
111/110/101/011
1
Invalid
Note: If the sampling values on the 3rd, 5th, 7th, 8th, 9th, and 10th bits do not match the above
mentioned requirements, the USART receiver does not think that a correct start bit is
received, and thus it will abort the start bit detection and return to idle state waiting for a
falling edge.
The USART receiver has the ability to detect noise. In the non-synchronous mode, the USART receiver
samples data on the 7
th
, 8
th
and 9
th
bits, with its oversampling techniques, to distinguish valid data input
from noise based on different sampling values, and recover data as well as set NERR (Noise Error Flag)
bit.
Table 12-3 Data sampling over valid data and noise detection
Sampled value
NERR bit
Received bit value
Data validity
000
0
0
Valid
001
1
0
Invalid
010
1
0
Invalid
011
1
1
Invalid
100
1
0
Invalid
101
1
1
Invalid
110
1
1
Invalid
111
0
1
Valid
When noise is detected in a data frame:
The NERR bit is set at the same time as the RDBF bit
The invalid data is transferred from the receive shift register to the receive data buffer.
No interrupt is generated in non-DMA mode. However, since the NERR bit is set at the same
time as the RDBF bit, the RDBF bit will generae an interrupt. In DMA mode, an interrupt will be issued
if the ERRIEN is set.
The NERR bit is cleared by read access to USART_STS register followed by the USART_DT read
operation.
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, they can be swapped 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.