Introduction to Direct Memory Access (DMA) in AUTOSAR, illustrating the role of DMA in data transfer between memory and peripherals without CPU intervention.

Direct Memory Access (DMA)

Modes of Operation of Direct Memory Access (DMA)

Direct Memory Access (DMA) operates in several modes to manage data transfer between peripherals and memory. Each mode is designed to optimize the use of system resources, and the cho

ice of mode depends on the specific requirements of the application. The primary modes of DMA operation are:

How DMA operates in AUTOSAR, illustrating the process of direct memory-to-memory or memory-to-peripheral data transfer, reducing CPU load and improving system efficiency.

1. Burst Mode

In Burst Mode, the DMA controller takes full control of the system bus to transfer a block of data in a single, uninterrupted burst. Key characteristics include:

  • Full Control: The DMA controller gains exclusive control of the system bus for the entire duration of the transfer.
  • Uninterrupted Transfer: The data transfer is completed in one continuous operation, with no interruptions.
  • Efficiency: Burst mode is efficient for transferring large amounts of data because it minimizes overhead and eliminates frequent bus contention.
  • Disadvantage: While it maximizes transfer efficiency, the CPU and other peripherals are locked out of the system bus during the entire transfer, which can lead to delays in other tasks.

Use case example: When transferring a large file from an external storage device to system memory, the DMA controller may take over the bus and transfer the data in one uninterrupted burst.

2. Cycle Stealing Mode

In Cycle Stealing Mode, the DMA controller takes control of the system bus for one cycle (a single memory read or write operation), transfers a small piece of data, and then releases control back to the CPU. Key features include:

  • Partial Control: The DMA controller steals the system bus for only one bus cycle at a time.
  • Minimal Interruption: The CPU is only momentarily interrupted, allowing it to resume execution after each cycle.
  • Lower Efficiency: Because control is frequently handed back and forth between the DMA controller and the CPU, cycle stealing incurs more overhead and can be less efficient for transferring large data blocks.

Use case example: A network card using cycle stealing mode can transfer small chunks of data from a buffer to memory without interrupting the CPU for extended periods.

3. Block Mode

In Block Mode, the DMA controller transfers a block of data without releasing control of the bus until the entire block is transferred. Unlike burst mode, the transfer is done in multiple cycles, but the bus is not relinquished until the transfer is complete. Key characteristics include:

  • Continuous Transfer: Data is transferred in blocks, without interruption, but the bus control is retained throughout the entire transfer.
  • Higher Efficiency: Compared to cycle stealing, block mode is more efficient for larger data transfers because the bus is not released after each individual data transfer.
  • Moderate CPU Interruption: The CPU is blocked for a longer duration than in cycle stealing, but the transfer is still more efficient.

Use case example: Transferring a large data block, such as a chunk of audio or video data, from a peripheral to memory, where continuous transfer is needed for the task.

4. Demand Mode

In Demand Mode, the DMA controller only transfers data when a peripheral explicitly requests it. The key features of demand mode include:

  • Peripheral-Driven: The peripheral signals the DMA controller when it is ready to send or receive data.
  • Asynchronous: The DMA controller waits for the peripheral’s request before performing any transfer.
  • CPU Control: The CPU maintains control of the bus until the peripheral requests data transfer, making this mode more efficient in scenarios where data transfer is not continuous or frequent.

Use case example: A printer requesting DMA transfer to send data from memory when it is ready to print a document.

5. Chain Mode (Linked Mode)

In Chain Mode (also called Linked Mode), multiple DMA controllers are linked together to handle complex data transfers that involve several peripherals. The key features of chain mode include:

  • Multiple DMA Controllers: Several DMA controllers work in tandem to transfer data across different devices or memory segments.
  • Sequential Data Transfers: One DMA controller will complete its task and trigger the next one, allowing complex, sequential data transfer operations.
  • Efficient for Complex Systems: This mode is suited for systems with multiple peripherals that need to work together for data transfer.

Use case example: A video processing system where one DMA controller transfers image data from a camera, while another DMA controller compresses or processes that data.

6. Single Transfer Mode

Single Transfer Mode in DMA (Direct Memory Access) is a mode where the DMA controller transfers one data unit (like a byte or word) per bus cycle. After each transfer, the DMA controller releases control of the bus back to the CPU or other peripherals. This process continues until all data is transferred. Here are the Key Features:

  • One data unit per cycle: Only one unit of data is transferred at a time.
  • Low bus contention: Since only one unit is transferred, other peripherals or the CPU can access the bus between transfers.
  • Simple implementation: Suitable for small data transfers.
  • Less efficient for large transfers: Requires multiple cycles for large data, making it less efficient compared to burst or block modes.

This mode is ideal for transferring small amounts of data with minimal impact on the CPU and other peripherals.

7. Split Transfer Mode

In Split Transfer Mode, large data transfers are split into smaller parts, and the transfer happens in multiple cycles. The key features of split transfer mode include:

  • Smaller Chunks: The data is divided into smaller chunks that can be transferred in different bus cycles, suitable when large data transfers are not feasible in a single burst.
  • Handling Limited Bus Width: This mode is used when the system bus width or memory size cannot accommodate the entire block of data in a single transfer.
  • Greater Flexibility: It is more flexible than other modes in environments with hardware limitations but may introduce some additional overhead in managing the split data.

Use case example: In a system where the available bus width is narrow, the data is split into smaller segments for sequential transfer to memory.

8. Priority DMA (Cycle Stealing with Priority)

Priority DMA is a variant of cycle stealing mode, where the DMA controller is given higher priority than other devices, ensuring it can perform its transfer without significant delay from other bus requests. Key features include:

  • Higher Priority: The DMA controller is given priority access to the bus, ensuring timely data transfers.
  • Preemption: If other devices request the bus, the DMA controller can preempt them to ensure critical data is transferred in time.
  • Efficient for Time-Sensitive Applications: This mode is suitable for applications that require high-priority data transfers, such as real-time processing.

Use case example: A real-time data collection system, where sensors request DMA transfers and need to ensure timely data movement from the sensors to memory.


Discover more from PiEmbSysTech

Subscribe to get the latest posts sent to your email.

Leave a Reply

Scroll to Top

Discover more from PiEmbSysTech

Subscribe now to keep reading and get access to the full archive.

Continue reading