Are ther any good tutorials on Arduino DMA?


Has anyone written any good tutorials, guides or books for DMA on any of the supported Arduino hardware platforms?

I'm aware that DMA implementation is usually processor specific, so any code or explanation is going to be tied to one platform. The Uno doesn't have a DMA controller, but the Zero and Due do.

A sample of working programs for the Zero can be found below, but there is no explanation as to how the author figured out which registers to write to, and how the values were calculated.

DMA doesn't appear to be part of the Wire language, perhaps because of hardware dependencies and as such anyone wanting to use it needs to understand what goes on 'under the covers' of the language. It's a big topic. I'm not expecting an explanation in this thread. I just wondered if someone had written a good guide (with explanation) for any of the supported Arduino platforms.


Presumably they read the chip datasheet?

Presumably they read the chip datasheet?

Some very experienced programmers can do this. If students are learning DMA implementation for the first time, some explanation of where to look and how to interpret information in the datasheet would be required. That's what I'm looking for, if it exists.

DMA usually requires special hardware (e.g. UART, DAC, ADC, SPI, …). The DMA engine is programmed to perform a transfer or has a queue of requests and notifies the process via an interrupt

Microchip has an app note.

I don’t know whether it’s useful or not. Many of the app notes rely on you using their existing ASF or “Start” frameworks :frowning:

Thanks for the app note. It's still assumes quite a bit about the knowledge of the programmer reading it, as all manufacturer documentation does. It's better than nothing.

If I find any good tutorials with explanations I'll post back.

You can find some example sketches with DMA in the DUE sub forum, either PDC DMA or AHB DMA.

Are you committed to using Microchip devices?

The classes in the Teensy Audio Library make extensive use of DMA. You can look at all the implementations. However, they are written for Freescale processors.