
GD32L23x User Manual
414
frame bit is 0, the frame bit is confirmed as a 0, else 1. If the value of the three samples of
any bit are not the same, whatever it is a start bit, data bit, parity bit or stop bit, a noisy error
(NERR) status will be generated for the frame. An interrupt will be generated, If the ERRIE
bit in USART_CTL2 register is set. If the OSB bit in USART_CTL2 register is set, the receiver
gets only one sample to evaluate a bit value. In this situation, no noisy error will be detected.
Figure 19-4. Oversampling method of a receive frame bit (OSB=0)
0
1
2
3
4
5
6
7
0
2
4
6
8
10
12
14
1
3
5
7
9
11
13
15
one frame bit
sample bits
sample bits
oversampling
8 mode
oversampling
16 mode
RX pin
If the parity check function is enabled by setting the PCEN bit in the USART_CTL0 register,
the receiver calculates the expected parity value while receiving a frame. The received parity
bit will be compared with this expected value. If they are not the same, the parity error (PERR)
bit in USART_STAT register will be set. An interrupt is generated, if the PERRIE bit in
USART_CTL0 register is set.
If the RX pin is evaluated as 0 during a stop bit, the frame error (FERR) bit in USART_STAT
register will be set. An interrupt is generated, If the ERRIE bit in USART_CTL2 register is set.
According to the configuration of the stop bit, there are the following situations:
–
0.5 stop bit: When 0.5 stop bit, stop bit is not sampled
–
1 stop bit: When 1 stop bit, sampling in the middle of stop bit.
–
1.5 stop bits: When 1.5 stop bits, the 1.5 stop bits are divided into 2 parts: the 0.5 stop
bit part is not sampled and sampling in the middle of 1 stop bit.
–
2 stop bits: When 2 stop bits, if a frame error is detected during the first stop bit, the
frame error flag is set, the second stop bit is not checked frame error. If no frame error is
detected during the first stop bit, then continue to check the second stop bit for frame
error.
When a frame is received, if the RBNE bit is not cleared yet, the last frame will not be stored
in the receive data buffer. The overrun error (ORERR) bit in USART_STAT register will be set.
An interrupt is generated, if the ERRIE bit in USART_CTL2 register is set, or if the RBNEIE
is set.
The RBNE, NERR, PERR, FERR and ORERR flags are always set at the same time in a
reception. If the receive DMA is not enabled, software can check NERR, PERR, FERR and
ORERR flags when serving the RBNE interrupt.