cancel
Showing results for 
Search instead for 
Did you mean: 

Has anyone got a working example for SD card with SDIO and FreeRTOS on STM32F413 with STM32CubeIDE version 1.6.1?

DFres.1
Associate II
1 ACCEPTED SOLUTION

Accepted Solutions
DFres.1
Associate II

Here is an example for all of you that are still stuck with the same problem.

In the example, you can find the project file for STM32CubeIDE and STM32CubeMX.

I'aware of the fact that the code is clumsy but it will give you an idea on how to set some of the parameters for the MCU.

The example works with SDIO 1 bit mode.

Few things to be aware of:

  • The code runs on a custom board where pull-up resistors of 10K are placed on the SD card pins :0693W00000AOMt6QAH.png

  • The SD card installed is 32GB, I first format the card with the PC and then plug it on the board. The first time f_open() gives an error, I reset the MCU and run the code again and from then on it works well, meaning I can create the file, write some text and read it back. Perhaps the time to set up the disk it too short the first time, I still have to debug it.
  • Be aware of the SD card that you are using, I have also been using a 16GB card without success, only to later find out the card was corrupted.

Hope it helps.

Once again, thanks to everybody for the answers, they have been of great help anyway.

View solution in original post

10 REPLIES 10
Imen.D
ST Employee

Hello @DFres.1​ 

Have a look at the SDIO library code and the examples within STM32CubeF4 MCU package:

STM32Cube_FW_F4_V1.26.1\Projects\STM32F413H-Discovery\Applications\FatFs

You can follow the guide to import Cube projects from SW4STM32 to STM32CubeIDE:

  • UM2579: Migration guide from System Workbench to STM32CubeIDE

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

Hello @DFres.1​ ,

I have attached an SD card example with STM32CubeIDE.

I hope this help you.

Walid.

Cartu38 OpenDev
Lead II

Even easier ... let's rely on example browsing import and feature ...

Either from welcome page or from File > Import > General > Import STM32Cube Example

0693W00000AMYLRQA5.jpg

Thank you for your prompt reply, I should have specified better the question.

What I am interested in, is the full project files including also the .ioc extension from CubeMX.

Meaning, the example starting from CubeMX to CubeIDE.

Thank you for your prompt reply Walid,

What I am interested in, is the full project files including also the .ioc extension from CubeMX.

Meaning, the example starting from CubeMX to CubeIDE.

I have however tried your example but without any success. The board I am using is the Nucleo-F413ZH.

I would like to see all the MX configuration if possible

Thank you for your prompt reply, I should have specified better the question.

What I am interested in, is the full project files including also the .ioc extension from CubeMX.

Meaning, the example starting from CubeMX to CubeIDE.

I would like to see the MX configuration for clock settings and peripherals and then the code.

Unfortunately sounds no example supporting configuration

0693W00000AMhR9QAL.jpg

DFres.1
Associate II

Here is an example for all of you that are still stuck with the same problem.

In the example, you can find the project file for STM32CubeIDE and STM32CubeMX.

I'aware of the fact that the code is clumsy but it will give you an idea on how to set some of the parameters for the MCU.

The example works with SDIO 1 bit mode.

Few things to be aware of:

  • The code runs on a custom board where pull-up resistors of 10K are placed on the SD card pins :0693W00000AOMt6QAH.png

  • The SD card installed is 32GB, I first format the card with the PC and then plug it on the board. The first time f_open() gives an error, I reset the MCU and run the code again and from then on it works well, meaning I can create the file, write some text and read it back. Perhaps the time to set up the disk it too short the first time, I still have to debug it.
  • Be aware of the SD card that you are using, I have also been using a 16GB card without success, only to later find out the card was corrupted.

Hope it helps.

Once again, thanks to everybody for the answers, they have been of great help anyway.

When you use C (not C++), you can generate the project with CubeMX, after generation is done, press open then the project will be imported to IDE and you can continue with IDE without using MX anmore. You can also import the project in IDE.