Skip to main content
Senior
Dec 3, 2024 12:43 AM UTC
Solved

SDCard FATFS f_mount always succeeds

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.
AScha.3
AScha.3Best answer
Super User
Dec 3, 2024 8:11 AM UTC

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.

If you feel a post has answered your question, please click on " Best Answer ".

2 replies

AScha.3
AScha.3Best answer
Super User
Dec 3, 2024 8:11 AM UTC

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.

If you feel a post has answered your question, please click on " Best Answer ".
Senior
Dec 3, 2024 4:42 PM UTC

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