7.2 Module Overview
SAM devices with DMAC enables high data transfer rates with minimum CPU intervention and frees up CPU time. With access to all peripherals, the DMAC can handle automatic transfer of data to/from modules. It supports static and incremental addressing for both source and destination.
The DMAC when used with Event System or peripheral triggers, provides a considerable advantage by reducing the power consumption and performing data transfer in the background. For example if the ADC is configured to generate an event, it can trigger the DMAC to transfer the data into another peripheral or into SRAM. The CPU can remain in sleep during this time to reduce power consumption.
Device | Dma channel number |
---|---|
SAM D21/R21/C20/C21 | 12 |
SAM D09/D10/D11 | 6 |
SAM L21 | 16 |
The basic transfer unit is a beat which is defined as a single bus access. There can be multiple beats in a single block transfer and multiple block transfers in a DMA transaction. DMA transfer is based on descriptors, which holds transfer properties such as the source and destination addresses, transfer counter, and other additional transfer control information. The descriptors can be static or linked. When static, a single block transfer is performed. When linked, a number of transfer descriptors can be used to enable multiple block transfers within a single DMA transaction.
The implementation of the DMA driver is based on the idea that DMA channel is a finite resource of entities with the same abilities. A DMA channel resource is able to move a defined set of data from a source address to destination address triggered by a transfer trigger. On the SAM devices there are 12 DMA resources available for allocation. Each of these DMA resources can trigger interrupt callback routines and peripheral events. The other main features are
- Selectable transfer trigger source
Software
Event System
Peripheral
Event input and output is supported for the four lower channels
Four level channel priority
Optional interrupt generation on transfer complete, channel error or channel suspend
Supports multi-buffer or circular buffer mode by linking multiple descriptors
Beat size configurable as 8-bit, 16-bit, or 32-bit
A simplified block diagram of the DMA Resource can be seen in Figure 7-1.