We detect you are using an unsupported browser. For the best experience, please visit the site using Chrome, Firefox, Safari, or Edge. X

What Is Direct Memory Access (DMA)?

Direct Memory Access (DMA) is a feature of computer systems that allows hardware subsystems to access main system memory (RAM) independent of the Central Processing Unit (CPU).

The Direct Memory Access (DMA) hardware peripheral on PIC® microcontrollers (MCUs) allows for direct memory-to-memory mapping and multitasking behavior through concurrent operation of the DMA and the CPU. This enables more flexible usage of eXtreme Low Power (XLP) technologies through core-independent movement of data in low-power modes and significant improvements in data throughput and latency.


Why Is DMA Used?

Most CPU operations in MCU-based systems involve the movement of data. In many cases, this can significantly limit the throughput and responsiveness of a system. For example, an interrupt can cause the CPU to stop what it is currently doing to service the interrupt. In low-power applications, this can significantly increase overall power consumption.

The DMA provides a method of offloading data movement operations from the CPU, allowing for concurrency and true multitasking behavior in the system. This ultimately reduces interrupt latency, thereby improving system responsiveness and power consumption. The DMA peripheral can move data through two methods:

  • Moving data while the CPU clock is disabled (e.g. low-power modes and XLP technology)
  • Utilizing unused CPU cycles that occur when the CPU is idle or waiting for an event

How Is DMA Used?

Configuration Context Switching

Having multiple configurations of peripherals can greatly expand the functionality of a device and lowers unit costs as well as overall BOM cost. However, changing configurations can be CPU intensive as the registers and configuration bits for peripherals need to be completely altered, which could bring about performance issues in some applications.

The DMA allows for more efficient and robust context-based configuration through a combination of customizable software- and hardware-based triggers that permit automated context-based device configuration independent of the CPU.

System Automation

The DMA peripheral can be used to automate any system process involving data transfer. This includes the management of state machine implementations and reconfiguration of other Core Independent Peripherals (CIPs), providing you with an efficient method of using a single peripheral in a variety of ways in response to hardware- or software-defined triggers.

Additionally, loop-based processes can be automated due to the recursive nature of calling and processing data, drastically accelerating the throughput of the device, and by extension, your system.

Arbitrary Waveform Generation

Many applications require arbitrary waveform data, which can be difficult to manage with a software-centric system. Arbitrary waveforms are traditionally generated using complex Digital Signal Processing (DSP) techniques that require high-end and expensive devices, large amounts of computation and loads of code.

The DMA can be used to create these same arbitrary waveforms by reading data sequentially from memory in the form of a lookup table and feeding this to other peripherals such as a Pulse-Width Modulator (PWM).

Tutorials and Examples


Title Download
TB3228 True DC RMS Meter Using Core Independent Peripherals Download
AN3312 - Arbitrary Waveform Generator Using DAC and DMA Download
3-Axis Stepper Motor Control Using an 8-Bit PIC Microcontroller Download
TB3164 - Direct Memory Access on 8-Bit PIC Microcontroller Download
AN2773 - 8-Bit Thermal Camera Application Note Download

New/Popular 8-bit Microcontrollers with Direct Memory Access

View All Parametrics
Product Status Direct Memory Access (DMA) Channels Pin Count Program Memory Size (KB) Data EEPROM (bytes)
PIC18F24K42 In Production 2 28 16 256
PIC18F25K42 In Production 2 28 32 256
PIC18F25Q43 In Production 6 28 32 1024
PIC18F26K42 In Production 2 28 64 1024
PIC18F26Q43 In Production 6 28 64 1024
PIC18F27K42 In Production 2 28 128 1024
PIC18F27Q43 In Production 6 28 128 1024
PIC18F45K42 In Production 2 40 32 256
PIC18F45Q43 In Production 6 40 32 1024
PIC18F46K42 In Production 2 40 64 1024
PIC18F46Q43 In Production 6 40 64 1024
PIC18F47K42 In Production 2 40 128 1024
PIC18F47Q43 In Production 6 40 128 1024
PIC18F55K42 In Production 2 48 32 256
PIC18F55Q43 In Production 6 48 32 1024
PIC18F56Q43 In Production 6 48 64 1024
PIC18F57Q43 In Production 6 48 128 1024

MM - MPLAB® Xpress IDE Edition Episode 15 - How to use Direct Memory Access (DMA) controller on a Microcontroller