GD32W51x User Manual
331
the FIFO is not enough for a burst memory transfer, these data items are transferred in
single transaction. If the remaining byte number is less than the memory transfer width,
these data items are still written in memory transfer width with MSBs filled with zero. The
software can read the CNT bits to calculate the number of valid data items in the memory.
After the contents of the FIFO has been entirely transferred into the memory, the CHEN
bit is cleared automatically by hardware and the FTFIFx bit in the DMA_INTF0 or
DMA_INTF1 register is set.
Memory-to-peripheral: After the software cleared operation, the DMA transfer is stopped
when the current memory and peripheral transfer are completed. Then the CHEN bit is
cleared and the FTFIFx bit is set.
Memory-to-memory: The same as the peripheral-to-memory mode with the source
memory transfer is implemented through the peripheral port.
Error detection
Three types error can disable the DMA transfer:
FIFO error: When a wrong FIFO configuration is detected, the DMA channel is disabled
immediately without starting any transfers. In this situation, the FTFIFx is not asserted.
For more information about the FIFO error, refer to section
.
Bus error: When the memory or peripheral port attempts to access an address beyond
the access scope, a bus error is detected and the DMA transfer is stopped immediately
without setting the FTFIFx. If this error is aroused by the peripheral port, the CNT bits
are still decreased by 1. For more information about the bus error, refer to section
Register access error: In switch-buffer mode, an access error is detected when a write
command is active on the memory base address register which is being accessed by
DMA. When this error occurs, the DMA operation is the same as it after the CHEN bit
software cleared. For more information about the register access error, refer to section
12.4.10.
Channel configuration
When starting a new DMA transfer, it is recommended to respect the following steps:
1.
Read the CHEN bit and judge whether the channel is enabled or not. If the channel is
enabled, clear the CHEN bit by software or wait the current DMA transfer finished. When
the CHEN bit is read as ‘0’, configuring and starting a new DMA transfer is allowed.
2.
Clear the FTFIFx bit in the DMA_INTF0 or DMA_INTF1 register, or a new DMA transfer
can not be re-enabled.
3.
Configure the TM bits in the DMA_CHxCTL register to set the transfer mode.
4.
Configure the PERIEN bits in the DMA_CHxCTL register to select the target peripheral.
If the transfer mode is memory-to-memory, the PERIEN bits have no meaning and this