EasyDMA is a module implemented by some peripherals to gain direct access to Data RAM.

EasyDMA is an AHB bus master similar to CPU and is connected to the AHB multilayer interconnect for direct access to Data RAM. EasyDMA is not able to access flash.

A peripheral can implement multiple EasyDMA instances to provide dedicated channels. For example, for reading and writing of data between the peripheral and RAM. This concept is illustrated in Figure 1.

Figure 1. EasyDMA example

An EasyDMA channel is usually implemented like illustrated by the code below, but some variations may occur:


  uint8_t readerBuffer[READERBUFFER_SIZE]  __at__ 0x20000000;
  uint8_t writerBuffer[WRITERBUFFER_SIZE]  __at__ 0x20000005;

  // Configuring the READER channel

  // Configure the WRITER channel

This example shows a peripheral called MYPERIPHERAL that implements two EasyDMA channels - one for reading called READER, and one for writing called WRITER. When the peripheral is started, it is assumed that the peripheral will:

The memory layout of these buffers is illustrated in Figure 2.

Figure 2. EasyDMA memory layout

The WRITER.MAXCNT register should not be specified larger than the actual size of the buffer (writerBuffer). Otherwise, the channel would overflow the writerBuffer.

Once an EasyDMA transfer is completed, the AMOUNT register can be read by the CPU to see how many bytes were transferred. For example, CPU can read MYPERIPHERAL->WRITER.AMOUNT register to see how many bytes WRITER wrote to RAM.

EasyDMA array list

EasyDMA is able to operate in a mode called array list.

The array list does not provide a mechanism to explicitly specify where the next item in the list is located. Instead, it assumes that the list is organized as a linear array where items are located one after the other in RAM.

The EasyDMA array list can be implemented by using the data structure ArrayList_type as illustrated in the code example below:

  #define BUFFER_SIZE  4

  typedef struct ArrayList
    uint8_t buffer[BUFFER_SIZE];
  } ArrayList_type;

  ArrayList_type ReaderList[3];

  READER.PTR = &ReaderList;

The data structure only includes a buffer with size equal to the size of READER.MAXCNT register. EasyDMA uses the READER.MAXCNT register to determine when the buffer is full.

Figure 3. EasyDMA array list

Documentation feedback | Developer Zone | Updated 2017-07-06