GD32W51x User Manual
332
step can be skipped.
5.
Configure the memory and peripheral burst types, the target memory buffer, switch-
buffer mode, priority of the channel, memory and peripheral transfer width, memory and
peripheral address generation algorithm, circular mode, the transfer flow controller in the
DMA_CHxCTL register.
6.
Configure multi-data mode, and the FCCV bits to set the FIFO counter critical value if
multi-data mode is enabled in the DMA_CHxFCTL register.
7.
Configure the enable bit for full transfer finish interrupt, half transfer finish interrupt,
transfer access error interrupt, single-data mode exception interrupt in the
DMA_CHxCTL register and the enable bit for FIFO error and exception interrupt in the
DMA_CHxFCTL register.
8.
Configure the DMA_CHxPADDR register for setting the peripheral base address.
9.
If the switch-buffer mode is enabled, configure the DMA_CHxM0ADDR and
DMA_CHxM1ADDR register for setting the memory base address. If only one memory
buffer is to be used, configure the DMA_CHxM0ADDR or DMA_CHxM1ADDR
corresponding with the MBS bit in the DMA_CHxCTL register.
10. Configure the DMA_CHxCNT register to set the total transfer data number.
11.
Configure the CHEN bit with ‘1’ in the DMA_CHxCTL register to enable the channel.
When restarting the suspended DMA transfer, it is recommended to respect the following
steps:
1.
Read the CHEN bit and ensure the DMA suspend operation has been completed. When
the CHEN bit is read as ‘0’, restarting the DMA transfer is allowed.
2.
Clear the FTFIFx bit in the DMA_INTF0 or DMA_INTF1 register, or the DMA transfer can
not be re-enabled.
3.
Read the DMA_CHxCNT register to obtain the number of the remaining data items and
calculate the number of the data items had already been transferred.
4.
Configure the DMA_CHxPADDR register to update the peripheral address pointer.
5.
Configure the DMA_CHxM0ADDR or the DMA_CHxM1ADDR register to update the
memory address pointer.
6.
Configure the DMA_CHxCNT with the number of the remaining data items.
7.
Configure the CHEN bit with ‘1’ in the DMA_CHxCTL register to restart the channel.
12.5.
Interrupts
Each DMA channel has a dedicated interrupt. There are five interrupt events connected to
each interrupt, including full transfer finish interrupt, half transfer finish interrupt, transfer