Course contentsShow
← Embedded Systems & Computer Architecture
Lesson 213 of 9363. Microcontroller Fundamentals and Bare-Metal CFree lesson

Configuring DMA Transfer Modes and Request Channels

Distinguish between hardware and software triggering mechanisms to initiate data transfers between peripheral registers and SRAM.

In this lesson, you will learn how to distinguish between hardware and software triggering mechanisms to initiate DMA data transfers between peripherals and SRAM.

Understanding DMA Triggers

A Direct Memory Access (DMA) controller acts as an autonomous "data mover." While it handles the heavy lifting of copying bytes, it must be told exactly when to start. We categorize these initiation methods into two primary modes: Hardware Triggers and Software Triggers.

Hardware Triggering (Peripheral-Driven)

Hardware triggering is the most common mode for high-speed I/O. In this scenario, the peripheral (such as an ADC or UART) is physically connected to the DMA controller via a dedicated Request Channel. When the peripheral is ready to send or receive data, it asserts a hardware request line. The DMA controller senses this signal and initiates the transfer automatically without CPU intervention. This is ideal for streaming data where timing is governed by the peripheral’s clock or external physical events.

Software Triggering (CPU-Driven)

In software-triggered mode, the DMA request is initiated by the CPU. Instead of waiting for a peripheral signal, the CPU writes to a specific bit in a DMA control register to manually kick off the transfer. This is particularly useful for moving blocks of data within memory (memory-to-memory) or triggering a transfer where the "start" signal is determined by a software algorithm rather than a hardware event.

Configuration Example

When configuring the DMA, you select the trigger source via the request channel multiplexer. Here is a conceptual view of how you might configure a channel:

// Concept: Selecting the Trigger Source
// 0x01: Assigning Hardware Request Line (e.g., UART_RX)
// 0x00: Assigning Software Trigger Mode
DMA_Channel1->CONFIG |= (TRIGGER_TYPE_HARDWARE << CHANNEL_MUX_BIT);
DMA_Channel1->REQUEST_ID = UART_RX_REQUEST_ID;

// Manual Trigger Start (only if in Software Mode)
DMA_Channel1->CONTROL |= DMA_SW_START_BIT;

By choosing the correct mode, you ensure that data movement stays in sync with your system’s requirements—either reacting instantly to physical hardware signals or executing precisely when your logic decides the time is right.

Key Takeaway: Hardware triggers allow peripherals to autonomously request data transfers via dedicated request channels, while software triggers empower the CPU to manually initiate transfers for non-peripheral-dependent tasks.