Skip to main content
Visitor II
January 20, 2023
Solved

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

  • January 20, 2023
  • 2 replies
  • 3018 views

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.

    This topic has been closed for replies.
    Best answer by FBL

    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.

    2 replies

    ST Employee
    January 20, 2023

    Hello @kaush​ ,

    Have a look at the available example :

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

    Foued

    kaushAuthor
    Visitor II
    January 23, 2023

    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

    FBLAnswer
    Technical Moderator
    January 20, 2023

    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.

    kaushAuthor
    Visitor II
    January 23, 2023

    @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.

    Explorer
    January 5, 2024

    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.