cancel
Showing results for 
Search instead for 
Did you mean: 

f_mount is returning FR_NOT_READY when I am trying to write some data on to an SD card. It is neither working for 8 GB SD card, nor for 32 GB SD card.

SSoni
Associate III

This is the snippet of the code that is showing me the error. It has been written just above the while(1) function.

Also, I have attached the whole code in the attachments.

 FATFS myFATFS;

 FIL myFILE;

 UINT testByte;

 if (f_mount(&myFATFS, SDPath, 1) == FR_OK)

 {

 HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5);

 char myPath[] = "WRITE1.TXT\0";

 f_open(&myFILE, myPath, FA_WRITE | FA_CREATE_ALWAYS);

 char myData[] = "HELLO WORLD\0";

 f_write(&myFILE, myData, sizeof(myData), &testByte);

 f_close(&myFILE);

 HAL_Delay(1000);

 f_mount(0, SDPath, 1);

 }

Kindly help

With regards

Siddharth Soni

2 REPLIES 2

Perhaps then it is not related to the card, but perhaps the card detect pin on the socket or that the SDIO/SDMMC layer hasn't been properly initialized.

Focus on the lower level code, not the high level stuff.​

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
SSoni
Associate III

No SD card is not getting mounted. I just have these two so I mentioned that.

I have attached the code too. Can you please go through it and let me know where the fault is and why am I not able to mount the card? According to me, this code has no fault as I myself have used it from a youtube tutorial and it worked well in the tutorial. I am pretty new to STM32 so might not be able to figure out if there's something wrong in the code or not.

P.S. - I am using STM32F446RE Nucleo board and this is the link to the tutorial video just for your reference: https://www.youtube.com/watch?v=Y5UMTGQDmog&t=49s

Kindly help.

Thanks

Siddharth Soni