Nations Technologies Inc.
Tel
:
+86-755-86309900
:
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
137
/
631
Notice:
DMA always provide full 32-bits data to HWDATA[31:0] no matter what destination size it is (HSIZE still follows
destination size setting for device supports byte/half-word operation). The HWDATA[31:0] it provides follow rules
as follow:
When source size is smaller than destination size, DMA pads the MSB with 0 until their sizes match and
duplicates it to be 32 bits. E.g., source is 8 bits data 0x55 and destination size is 16 bits. DMA pads the source
data with 0 to make it 16 bits and become 0x0055, then duplicate it to 32-bit data 0x0055_0055 and provide to
HWDATA[31:0]; (if destination size is 32-bit then DMA will only pad source data with 0).
When source size is larger or equal to destination size and smaller than 32 bits, DMA duplicates source data to
32 bits data. E.g., source data is 8 bits data 0x1F, HWDATA[31:0] = 0x1F1F_1F1F. If source data is 16 bits data
0x2345, then HWDATA[31:0] = 0x2345_2345.
This guarantees peripherals that only support word operation won’t generate bus error and the desired data can still
move to the place we want with extra bits i.e. 0 padding. If user wants to configure an 8-bit register but is aligned to
a 32-bit address boundary, the source size should be set to 8 bits and destination to 32 bits so extra bits will be padded
with 0.
Peripheral/Memory address incrementation
DMA_CHCFGx.PINC and DMA_CHCFGx.MINC respectively control whether the peripheral address and memory
address are enabled in auto-increment mode. The software cannot (can read) write the address register during transfer.
In auto-increment mode, the next address to be transferred is automatically increased according to the data bit
width (1, 2 or 4) after each transfer. The address of the first transfer is stored in DMA_PADDRx or
DMA_MADDRx register.
In fixed mode, the address is always fixed to the initial address.
At the end of transfer (i.e. the transfer count changes to 0), different processes will be carried out according to whether
the current work is under circular mode or not.
In acyclic mode, DMA stops after the transfer is completed. To start a new DMA transfer, need to rewrite the
transfer number in the DMA_TXNUMx register with the DMA channel disabled.
In circular mode, at the end of a transfer, the content of the DMA_TXNUMx register will be automatically
reloaded to its initial value, and the current internal peripheral or memory address register will also be reloaded
to the initial base address set by the DMA_PADDRx or DMA_MADDRx register.
Channel configuration procedure
The detail configuration flow is as below
:
1.
Configure interrupt mask bits, 1: enable interrupts, 0 disable interrupts.
2.
Configure channel peripheral address and memory address and transfer direction.