8.3.9 Interrupts
The LDMA_IF Interrupt flag register contains one DONE bit for each channel and one combined ERROR bit. When enabled, these in-
terrupts are available as interrupts to the Cortex-M4 core. They are combined into one interrupt vector, DMA_INT. If the interrupt for the
DMA is enabled in the ARM Cortex-M4 core, an interrupt will be made if one or more of the interrupt flags in LDMA_IF and their corre-
sponding bits in LDMA_IEN are set.
When a descriptor finishes execution the interrupt flag for that channel will be set if the DONEIFSEN field of the LDMA_CHx_LOOP
register is set. If LINK and DONEIFSEN are both set when the descriptor completes the interrupt and the linked descriptor will be imme-
diatly loaded. When the final descriptor in a linked list (LINK = 0) is finished the interrupt flag is always set regardless of the state of
DONEIFSEN.
8.3.10 Debugging
For a peripheral request DMA transfer, if software sets a bit for a channel in the LDMA_DBGHALT register then the DMA will halt dur-
ring a debug halt and the SRC and DST registers in the debug window will show the transfer in progress. Otherwise, during debug halt
the DMA will continue to run and complete the entire transfer causing the descriptor registers to indicate the transfer has completed.
8.4 Examples
This section provides examples of common LDMA usage. All examples assume the LDMA is in the reset state with the channel being
configured disabled and LDAM_CHx_CFG, LDMA_CHx_LOOP, and LDMA_CHx_LINK cleared.
8.4.1 Single Direct Register DMA Transfer
This simple example uses only the Channel Descriptor registers directly and does not use linking. Software writes directly to the LDMA
channel registers. This example does not use a memory based descriptor list.
This example is suitable for most simple transfers that are limited to transferring one block of data. It supports anything that can be
done using a single descriptor. This includes endian conversion and packing/unpacking data. Channel 0 is used for this example.
The LDMA will be used to copy 127 contiguous half words (254 bytes) from 0x0 to 0x1000. It will allow arbitration every 4 transfers and
is triggered by a CPU write to the LDMA_SWREQ register. The CH0 interrupt flag will be set when the transfer completes since the
descriptor does not link to another descriptor.
• Configure LDMA_CH0_CTRL
• DSTMODE = 0 (absolute)
• SRCMODE = 0 (absolute)
• SIZE = HALFWORD (16 bits)
• DSTINC = 0 (1 half-word)
• SRCINC = 0 (1 half-word)
• DECLOOPCNT=0 (unused)
• REQMODE = 1 (one request transfers all data)
• BLOCKSIZE = 3 (4 transfers)
• BYTESWAP=0 (no byte swap)
• XFERCNT=127 (transfer 127 half words)
• STRUCTTPYE=0 (TRANSFER)
• Write source address to LDMA_CH0_SRC register
• Write destination address to LDMA_CH0_DST register
• Configure the LDMA_CH0REQSEL register for the desired peripheral or select none for a memory-to-memory transfer
• Clear and enable interrupts.
• Write a 1 to bit 0 of the LDMA_IFC register to clear the CH0 DONE flag
• Write a 1 to bit 0 of the LDMA_IEN register to enable the CH0 interrupt
• Write a 1 to bit 0 of the LDMA_CHEN register to enable CH0
The REQMODE field is normally cleared to zero for a peripheral request transfer and will transfer the specified block size for each pe-
ripheral request. The REQMODE may be set to 1 for a memory-to-memory transfer or any time it is desired for a single DMA request to
initiate complete transfer.
Reference Manual
LDMA - Linked DMA Controller
silabs.com
| Building a more connected world.
Rev. 1.1 | 168