Course contentsShow
← Embedded Systems & Computer Architecture
Lesson 399 of 9365. Communication Protocols and Data TransferFree lesson

Managing DMA Transfer Modes and Addressing

Configure single-block, burst, and circular transfer modes to optimize throughput for specific peripheral data requirements.

In this lesson, you will learn how to select and configure specific DMA transfer modes to maximize data throughput based on your peripheral’s unique communication requirements.

When moving data between memory and peripherals, the DMA controller acts as an autonomous courier. To handle different data streams efficiently, we use three primary transfer modes: Single-Block, Burst, and Circular.

Single-Block Transfer

Use this mode when you need to transfer a specific, finite amount of data once. The DMA is triggered, moves a defined number of elements (e.g., a single 8-bit sensor reading), and then generates an interrupt to notify the CPU. This is ideal for low-frequency events where exact timing of the completion is necessary.

Burst Transfer

If you are working with high-speed peripherals like an SPI interface or a high-bandwidth ADC, single-cycle transfers become inefficient due to bus arbitration overhead. In Burst Mode, the DMA takes control of the bus and moves a large "chunk" of data in one continuous sequence without releasing the bus between bytes.

// Example: Setting up a burst transfer
dma_channel_config(DMA1_CH1, {
    .mode = DMA_MODE_BURST,
    .burst_size = 8,           // Move 8 beats per request
    .increment_mode = ENABLE   // Auto-increment memory address
});

Circular Transfer

Circular mode is the gold standard for continuous data streams, such as audio buffers or real-time signal logging. When the DMA reaches the end of the destination buffer, it automatically resets the memory pointer back to the start address without CPU intervention. This allows the processor to process the "first half" of a buffer while the DMA simultaneously fills the "second half," preventing data loss or gaps in the stream.

Addressing Strategy

Always ensure your DMA Address Increment is configured correctly. For peripheral-to-memory transfers, the peripheral address usually remains fixed (the register location), while the memory address increments to populate an array. If you configure the peripheral side to increment, you will inadvertently read from the wrong hardware registers, leading to data corruption.

Key Takeaway: Match your DMA mode to your data flow: use Single-Block for discrete events, Burst for high-speed throughput, and Circular for infinite, continuous data streams.