Arduino Forum

Products => Arduino Due => Topic started by: sage123 on Sep 14, 2018, 06:23 am

Title: DUE SD card access using DMA
Post by: sage123 on Sep 14, 2018, 06:23 am
I'm looking for a way to permanently read data from an SD card while keeping the workload of the CPU as low as possible.
I imagine that I just give a pointer to a buffer to a DMA based routine which fills the buffer via DMA without loading the CPU and just issues an interrupt when the buffer is full (like the DAC of the DUE when operated via DMA)
I thought this could be done with the SdFat Library as it is apparently able to use DMA. However it seems to use it only for speeding up the read process, but not for filling a buffer in the background.

Does anyone know how to do something like this?

Thank you in advance for your help.
Title: Re: DUE SD card access using DMA
Post by: ard_newbie on Sep 14, 2018, 08:55 am
There is an AHB DMA for the SPI peripheral (Sam3x datasheet, page 339). You first need to initialize the SPI reading of the SD card with the correct pace, and then initialize a single AHB DMA transfer, or multiple AHB DMA transfers with a linked list item (LLI) from the SPI peripheral to the memory and this will be done with the correct pace. ( (