GD32F20x User Manual
494
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 is shown in
Configuration step when using DMA for USART transmission
Figure 19-5. Configuration step 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
After all of the data frames are transmitted, the TC bit in USART_STAT0 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 step is 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
Summary of Contents for GD32F20 Series
Page 191: ...GD32F20x User Manual 191 Bits Fields Descriptions 31 0 TRNDATA 31 0 32 Bit Random data ...
Page 290: ...GD32F20x User Manual 290 conversion is ongoing ...
Page 325: ...GD32F20x User Manual 325 15 0 ALRM 15 0 RTC alarm value low ...
Page 385: ...GD32F20x User Manual 385 ...
Page 523: ...GD32F20x User Manual 523 clears AERR bit by writing 0 to it ...