GD32F10x User Manual
433
3.
Set the STB[1:0] bits in USART_CTL1.
4.
Enable DMA (DENR bit) in USART_CTL2 if multibuffer communication is selected.
5.
Set the baud rate in USART_BAUD.
6.
Set the REN bit in USART_CTL0.
After being enabled, the receiver receives a bit stream after a valid start pulse has been
detected. Detection on noisy error, parity error, frame error and overrun error is performed
during the reception of a frame.
When a frame is received, the RBNE bit in USART_STAT is asserted, an interrupt is
generated if the corresponding interrupt enable bit (RBNEIE) is set in the USART_CTL0
register. The status bits of the received are stored in the USART_STAT register.
The software can get the received data by reading the USART_DATA register directly, or
through DMA. The RBNE status is cleared by a read operation on the USART_DATA register,
whatever it is performed by software directly, or through DMA.
The REN bit should not be disabled when reception is ongoing, or the current frame will be
lost.
By default, the receiver gets three samples to evaluate the value of a frame bit. While in the
oversampling 16 mode, the 7th, 8th, and 9th samples are used. If two or more samples of a
frame bit is 0, the frame bit is confirmed as a 0, else 1. If the three samples of any bit of a
frame 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 is generated, if the receive DMA
is enabled and the ERRIE bit in USART_CTL2 register is set.
Figure 16-4. Oversampling method of a receive frame bit
0
2
4
6
8
10
12
14
1
3
5
7
9
11
13
15
one frame bit
sample bits
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 receive DMA is enabled and the ERRIE
bit in USART_CTL2 register is set.
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 receive DMA is enabled and the ERRIE bit in USART_CTL2
Summary of Contents for GD32F10 Series
Page 63: ...GD32F10x User Manual 63 programmed during the chip production ...
Page 117: ...GD32F10x User Manual 117 010 1 0 011 0 9 ...
Page 416: ...GD32F10x User Manual 416 shadow register updates every update event ...
Page 427: ...GD32F10x User Manual 427 value ...
Page 518: ...GD32F10x User Manual 518 These bits are not used in SPI mode ...