Skip to main content
Graduate II
December 3, 2024
Solved

SDCard FATFS f_mount always succeeds

  • December 3, 2024
  • 1 reply
  • 785 views

I am using the STM32H7B3I-DK and followed How to create a file system on a SD card using STM32CubeIDE. I noticed that DMA options are not available on the SDMMC1 configuration tab, so I just skipped that step. The rest of the steps I followed. In FATFS Platform settings I set Detect_SDIO  GPIO:Input PI8.

I do not have a microSD card inserted but the f_mount() is still successful:

 

void SDInit(void)
{
 // Mount the file system on the SD card (assumes SDPath is defined)
 if (f_mount(&SDFatFS, (TCHAR const*)SDPath, 0) != FR_OK)
 {
 printf("Failed to mount\r\n");
 }
 else{
 printf("Mount Good\r\n");
 }
}

 

I have checked PI8 state and it is set which is correct for no device inserted, so I am unsure why f_mount() passes

    This topic has been closed for replies.
    Best answer by AScha.3

    It just seems successful, because you are using parameter 0, for delayed mount.

    Try with parameter 1, for " mount now" and you will see, whether it can mount now - or not.

     

    Btw,

    I always use mount with "1" , because it's my first check for SD card okay : card is here, not defective, access seems good.

    1 reply

    AScha.3Answer
    Super User
    December 3, 2024

    It just seems successful, because you are using parameter 0, for delayed mount.

    Try with parameter 1, for " mount now" and you will see, whether it can mount now - or not.

     

    Btw,

    I always use mount with "1" , because it's my first check for SD card okay : card is here, not defective, access seems good.

    Graduate II
    December 3, 2024

    Thanks for the heads up, that makes sense. Solved my issue