2021-03-08 09:16 AM
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
Solved! Go to Solution.
2021-03-15 10:25 AM
Hi @MVerr.1,
Thanks for your feedback and sorry for my late reply.
By my previous reply, I have tried to explain briefly the steps to configure SDMMC MDMA requests through STM32CubeMX GUI. Here is Application note to get started with STM32H7 Series SDMMC host controller with much more details and explanations.
You can also find multiple examples through Example Selector in STM32CubeMX developed to be a good start point for your project:
Hope this helps you.
Khouloud.
2021-03-09 01:02 PM
Hi @MVerr.1 ,
Let me first welcome you to STM32 Community:smiling_face_with_smiling_eyes:
If I well understand your question, you're asking about the STM32CubeMX feature in order to use MDMA requests to transfer data from/to SDMMC. Please correct me if I misunderstood.
To Configure SDMMC1 MDMA requests through CubeMX, firstly enable the SDMMC1 by selecting one of the available modes. Then select MDMA and Add Channel, a transfer request will be created by default, you can select one of the available MDMA events from the drop down list. You can add later the requests you needs for your project and configure them according to your requirements.
Hereafter a screenshot to clarify more the process:
Hope this answers your question.
Khouloud.
2021-03-10 07:16 AM
Hello Khouloud,
Thank you for the reply.
I would like to be able to on the SDcard using a DMA instead of the CORE_M7.
As I understood they are two solutions. One includes configuring the MDMA as you suggest and the other one is by using the IDMA of the SDMMC. What is the difference between the two solutions ? Also, after configuring everything like you mention, how can I start transfering data using the MDMA ?
2021-03-15 10:25 AM
Hi @MVerr.1,
Thanks for your feedback and sorry for my late reply.
By my previous reply, I have tried to explain briefly the steps to configure SDMMC MDMA requests through STM32CubeMX GUI. Here is Application note to get started with STM32H7 Series SDMMC host controller with much more details and explanations.
You can also find multiple examples through Example Selector in STM32CubeMX developed to be a good start point for your project:
Hope this helps you.
Khouloud.
2024-07-04 03:33 AM
I have read the Application note to get started with STM32H7 Series SDMMC host controller
I have a 1Bit connection of a SD Card with an STM32H725
It mentions checking a specific condition in line 2973 of the file ff.c.
The code snippet checks if a certain value is loaded correctly in the variable "win" at a specific memory location. If the value is not as expected (0xAA55 in this case), it returns 3.
It seems that the issue is that the variable "win" is not being fully loaded and the offset 510 is always 0. This could indicate a problem with loading or writing data to the memory area referenced by "win."
2024-11-01 08:56 AM
Unfortunately the document you reference leaves out some very important information.
Below is page 16 from the referenced document. It leaves off explaining how to fill in the data farther down.
Page 16
Once the dialog box is open, the user clicks on the Add a channel button and selects SDMMC1 end of data. Now the user can configure the MDMA for the data transfer (buffer transfer length, data alignment, source and destination). See the figure below for an example of the dialog boxes that the user finds when doing this configuration. Figure 14. MDMA end of data configuration with STM32CubeMx
How are these items to be filled out??