• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Microcontroller Tips

Microcontroller engineering resources, new microcontroller products and electronics engineering news

  • Products
    • 8-bit
    • 16-bit
    • 32-bit
    • 64-bit
  • Applications
    • 5G
    • Automotive
    • Connectivity
    • Consumer Electronics
    • EV Engineering
    • Industrial
    • IoT
    • Medical
    • Security
    • Telecommunications
    • Wearables
    • Wireless
  • Learn
    • eBooks / Tech Tips
    • EE Training Days
    • FAQs
    • Learning Center
    • Tech Toolboxes
    • Webinars/Digital Events
  • Resources
    • Design Guide Library
    • DesignFast
    • LEAP Awards
    • Podcasts
    • White Papers
  • Videos
    • EE Videos & Interviews
    • Teardown Videos
  • EE Forums
    • EDABoard.com
    • Electro-Tech-Online.com
  • Engineering Training Days
  • Advertise
  • Subscribe

How does DMA enable efficient data transfer in microcontrollers?

September 27, 2024 By Rakesh Kumar Leave a Comment

Direct memory access (DMA) allows peripherals to transfer data directly to and from memory without requiring the CPU to handle each cycle. As the CPU’s role is minimized, DMA enables the CPU to perform other high-priority tasks and ensures faster data transfers in the background.

How does the DMA controller work to reduce the load on the CPU?

The key benefits of the DMA controller in microcontrollers are that it offloads data transfer tasks from the CPU, allows the CPU to perform other operations during transfers, and enables high-speed data transfer between I/O and memory. The working of a DMA controller can be broken down into six steps, as shown in Figure 1.

dma
Figure 1. The six stages of DMA controller operation. (Image: Rakesh Kumar, Ph.D.)

In the first step, the CPU initializes the DMA controller by programming its registers with source address, destination address, number of bytes/words to transfer, direction of transfer, and transfer mode. While the direction of memory can be either read-from-memory or write-to-memory, the transfer mode can be single, block, or demand.

The second step is when an I/O device sends a DMA request signal to the DMA controller for data transfer. In the next step, known as bus arbitration, the DMA controller requests control of the system buses from the CPU by asserting the bus request signal. Once the CPU completes its ongoing instruction, it grants bus control to the DMA controller by asserting the bus grant signal.

Data transfer happens in the fourth step when the DMA controller generates memory addresses and control signals to read/write data directly between memory and the I/O device. It increments the addresses and decrements the transfer count after each byte/word transfer.

In the fifth step, when the specified number of bytes have been transferred, the DMA controller terminates the transfer and releases control of the system buses back to the CPU. The controller also generates an interrupt to signal the completion process to the CPU. In the last step, the CPU services the interrupt and resumes standard processing.

How is DMA used in Smartwatch for efficient data transfer?

One of the several use cases of DMA can be seen in smartwatches (Figure 2). The DMA has been used in high throughput data flow, such as Bluetooth, gyroscope, accelerometer, and LCD screen. The DMA ensures that there is a smooth flow of data between RAM and peripherals.

dma
Figure 2. Architecture of a microcontroller-based smart watch illustrating the use of DMA to interact with the peripherals of the device directly. (Image: NDSS Symposium)

The core processor is seen to be behind the memory protection unit (MPU), where the data flow is regulated through memory-mapped I/O (MMIO) operations. Therefore, the DMA takes up the load of the CPU to ensure that routine data transfer is taken care of by itself to free up the CPU for higher-priority tasks.

Case study

Researchers at the University of Castilla-La Mancha, Spain, and the Ulster University, Belfast, have successfully used DMA to improve energy efficiency and writing speed compared to existing file systems when using microSD cards as a storage system for wearable devices.

A PSoC (CYBLE-222014-01) microcontroller with an ARM Cortex-M0 architecture was used along with two microSD as storage systems, one with 4 GB and the other with 8 GB. The serial peripheral interface (SPI) protocol was used as an interface because of its lower power consumption compared to standard interfaces such as UART, I2C, and SPI.

The evaluation comparison was conducted between FatFs, a standard embedded file system used in wearable devices, and the proposed DMA system with an SPI interface. The results are shown in Figure 3, where both the processes were compared for average energy consumption and time required for writing 15,872 bytes from RAM to the microSD card.

dma
Figure 3. Charts show how the use of DMA resulted in reduced average energy consumption (mJ) (left) and reduced average time required (ms) (right) for writing 15,872 bytes. (Image: MDPI)

It is clear from the chart that the use of DMA at 2 Hz resulted in lesser energy consumption, 3.4 times and 7.8 times compared to FatFs, for the 4 GB and 8 GB cards, respectively. At 5 Hz, DMA’s energy savings had increased to 3.7 times and 10.6 times compared to FatFs for 4 GB and 8 GB cards, respectively.

The writing speed has also increased using DMA for 15,872 bytes from RAM to the SD card. DMA at 2 Hz led to a faster performance at 2.3 times and 3.9 times compared to FatFs for the 4 GB and 8 GB cards, respectively. While at 5 Hz, the improvements were 2.2 times and 7.8 times compared to FatFs for the 4 GB and 8 GB cards, respectively.

Summary

DMA helps speed up data transfer and lower power consumption by reducing the CPU’s involvement. As seen in the smartwatch example, DMA efficiently handles streaming data like accelerometers, heart rate monitors, etc. This is because DMA transfers this data to memory buffers without waking the CPU for every sample.

DMA is also helpful in parallel operation, depending on the microcontroller architecture, and improves real-time responsiveness. In the long run, it leads to enhanced battery life, an essential feature in low-power applications such as smart watches, drones, etc., where connection to a reliable and continuous power supply is absent.

References

D-Box: DMA-enabled Compartmentalization for Embedded Application, NDSS Symposium
What Is Direct Memory Access (DMA)? Meaning, Types, Principles, Working, and Benefits, spiceworks
Direct Memory Access (DMA) Controller in Computer Architecture, Geeksforgeeks
Direct Memory Access-Based Data Storage for Long-Term Acquisition Using Wearables in an Energy-Efficient Manner, MDPI

You may also like:


  • How can in-package optical interconnects enhance chiplet generative AI performance?

  • What is the heterogeneous integration roadmap, and how does it…

  • What is the MIPI I3C HCI good for?

  • How timing propagates in a 5G network

  • What embedded protocols can you use for optical connectivity?

Filed Under: FAQ, Featured Tagged With: FAQ

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Featured Contributions

Five challenges for developing next-generation ADAS and autonomous vehicles

Securing IoT devices against quantum computing risks

RISC-V implementation strategies for certification of safety-critical systems

What’s new with Matter: how Matter 1.4 is reshaping interoperability and energy management

Edge AI: Revolutionizing real-time data processing and automation

More Featured Contributions

EE TECH TOOLBOX

“ee
Tech Toolbox: 5G Technology
This Tech Toolbox covers the basics of 5G technology plus a story about how engineers designed and built a prototype DSL router mostly from old cellphone parts. Download this first 5G/wired/wireless communications Tech Toolbox to learn more!

EE Learning Center

EE Learning Center

EE ENGINEERING TRAINING DAYS

engineering
“bills
“microcontroller
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

DesignFast

Design Fast Logo
Component Selection Made Simple.

Try it Today
design fast globle

Footer

Microcontroller Tips

EE World Online Network

  • 5G Technology World
  • EE World Online
  • Engineers Garage
  • Analog IC Tips
  • Battery Power Tips
  • Connector Tips
  • DesignFast
  • EDA Board Forums
  • Electro Tech Online Forums
  • EV Engineering
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips

Microcontroller Tips

  • Subscribe to our newsletter
  • Advertise with us
  • Contact us
  • About us

Copyright © 2025 · WTWH Media LLC and its licensors. All rights reserved.
The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media.

Privacy Policy