GD32VF103 User Manual
334
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
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.
16.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 steps are shown in
Configuration steps when using DMA for USART transmission
Figure 16-5. Configuration steps when using DMA for USART transmission
Set the address of USART_DATA as
the DMA destination address
Set the address of data in internal
sram as the DMA source address
Set the number of data as the DMA
transfer number
Set other configurations of DMA,
interrupt enable, priority, etc
Clear the TC bit in USART_STAT0
Enable the DMA channel for USART
Wait the TC bit to be set