GD32W51x User Manual
596
Configuration step when using DMA for USART transmission
.
Figure 18-5. Configuration step when using DMA for USART transmission
Set the address of USART_TDATA
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_STAT
Enable the DMA channel for USART
Wait the TC bit to be set
After all of the data frames are transmitted, the TC bit in USART_STAT is set. An interrupt
occurs if the TCIE bit in USART_CTL0 is set.
When DMA is used for USART reception, DMA transfers data from the receive data buffer of
the USART to the internal SRAM. The configuration steps are shown in
Configuration step when using DMA for USART reception
. If the ERRIE bit in
USART_CTL2 is set, interrupts can be generated by the Error status bits (FERR, ORERR
and NERR) in USART_STAT.