![GigaDevice Semiconductor GD32A50 Series Скачать руководство пользователя страница 475](http://html.mh-extra.com/html/gigadevice-semiconductor/gd32a50-series/gd32a50-series_user-manual_2225782475.webp)
GD32A50x User Manual
475
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.
19.3.5.
Use DMA for data buffer access
To reduce the burden of the processor, DMA can be used to access the transmitting and
receiving data buffer. The DENT bit in USART_CTL2 is used to enable the DMA transmission,
and the DENR bit in USART_CTL2 is used to enable the DMA reception.
When DMA is used for USART transmission, DMA transfers data from internal SRAM to the
transmit data buffer of the USART. The configuration step are shown in