cancel
Showing results for 
Search instead for 
Did you mean: 

[STM32H7] How to use SDMMC with MDMA

MVerr.1
Associate

Hello Community,

I'm working on a storage module using SDcard for my project. In my application I would like to read and write to the SDcard using the MDMA as indicated in the reference manual of my micro-controller. For now I have the SDcard working in 4-bit mode but using the CPU.

I use the STM32H757II on a PCB connected to a SDcard reader on the same PCB.

With CubeMX I generated the code that allow me to mount a FATFS on my microcontroller and I can create/open/write/read on file with no problem.

But my application needs to log a lot of data to the sdcard periodically, to free-up the CPU I would like to do the transfer using a DMA.

In the reference manual 58.5.7 MDMA request generation it is explained that the MDMA can control the SDMMC peripheral to start new transfer

"The internal trigger lines from the SDMMC allow passing direct request to MDMA controller

to enable successive transfers from/to different internal RAM addresses without CPU use. [...]

The event can trigger the clearance of the DATAEND and CMDREND

flags and, eventually, a new transfer start, through MDMA direct access to the SDMMC

control and configuration registers, thus without CPU intervention."

However in CubeMX I don't seem to be able to link the SDMMC to the MDMA. I don't know either how to link an event of the SDMMC to trigger a change in configuration of those register with the MDMA.

How can I adapt what I have to use DMA instead of CPU.

How do you start a MDMA transfer to write on SDcard ?

Cheers,

Maurin

PS:

STM32CubeIDE Version: 1.3.0

STM32CubeMX Version: 5.6.0-RC6

10 REPLIES 10
Zed
Associate III

First of all, thank you very much to all of you, who clarifies these questions.

Personally, I stuck at the point of implementing MDMA transfer from AXI_RAM to DTCM_RAM.

How should I modify standard ST's µSD_DMA_FreeRTOS template to be able to use MDMA?

Again, DMA is working perfectly in my Project, but I want to send data that was read with IDMA and stored in AXI_RAM to DTCM_RAM. Manuals say that it is possible. All settings in CubeMX were made. But what next?

Any help would be appritiated!

THX!