cancel
Showing results for 
Search instead for 
Did you mean: 

Issue in integrating sd card with stm32g474re nucleo board using spi interface

kaush
Associate II

HI All,

I have created a project to integrate sd card with STM32G474RE nucleo board while using SPI interface. After running the project I am able to initialize the sd card properly but while mounting the sd card, I am getting one error like: "FR_DISK_ERR".

I am usung STMCubeide to do the configuration and followed some tutorial to setup my fatfs library.

I am attatching my project here for the reference.

Please have a look on it and help me rectify the issue.

1 ACCEPTED SOLUTION

Accepted Solutions
FBL
ST Employee

Hello @kaush​ ,

First, you can increase the heap and stack minimum size in the linker settings?

Second, why using maximum sector size MAX_SS =4096 since it is recommended to use 512 for memory card.

Finally, in order to register the file system to FatFS, you may refer to the example proposed in Github. Then you can check if you can read after every write.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

5 REPLIES 5
Foued_KH
ST Employee

Hello @kaush​ ,

Have a look at the available example :

\Repository\STM32Cube_FW_G4_V1.5.1\Projects\NUCLEOG474RE\Applications\FatFs\FatFs_uSD_Standalone

Foued

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

FBL
ST Employee

Hello @kaush​ ,

First, you can increase the heap and stack minimum size in the linker settings?

Second, why using maximum sector size MAX_SS =4096 since it is recommended to use 512 for memory card.

Finally, in order to register the file system to FatFS, you may refer to the example proposed in Github. Then you can check if you can read after every write.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

I have gone through the example project. I am using SPI instead of SDIO for my project but I followed the same process:

1) MX_FATFS_Init

2) SD card initialization

3) f_mount

and I am facing issue in the last step and getting error FR_DISK_ERR

kaush
Associate II

@F.Belaid​ ,

Thanks for the suggestions. I am able to perform read and write operations properly.

To be more precise changing "MAX_SS =512" worked for me and other changes are good to have for executing application in efficient way.

Could you plz provide the final working project.

When i run your project, it give this error "...multiple definition of `hspi1'..", any suggestion? Thank you.