cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F407 SPI uSD CARD Interfacing gives FR_NOT_READY and firmware hangs

YKees.1
Associate II

Hello,

I have been trying out interfacing the STM32F407 Discovery Kit with different sensors but while trying to Interface a SPI uSD card adaptor containing a 16GB microSD card, the interfacing doesn't seem to work out at all.

I have followed all the different available tutorials like this, this (exact setup with STM32F407 kit) and this.

I have 3-4 different firmware, added the fatfs_sd lib files as well in all, and made the necessary changes as mentioned in the above tutorials.

I have also looked at the STCommunity thread, but didn't help.

But the f_mount() always fails with FR_NOT_READY when used like 'f_mount(&fs, "", 1)' or the f_open() function fails with FR_NOT_READY when the f_mount() is used like 'f_mount(&fs, "", 0)'.

I am clueless and not able to understand what is the issue after trying multiple youtube tutorials and blogs.

Please help. This is blocking some other pending tasks.

PS: Attached 47K resistors to the MISO and MOSI lines after reading at multiple posts, but that didn't help too.

ATTACHED FIRMWARE for reference.

Regards,

Yash

3 REPLIES 3
YKees.1
Associate II

Can someone please help, if they have expertise in the above-said interfacing or if they interfaced an SD card module with STM32F407 successfully?

In this code probably that the interface hasn't been initialized.

Perhaps instrument the user_diskio.c code to understand the flow.

Most use the Adafruit SPI implementation

STM32Cube_FW_F4_V1.24.0\Drivers\BSP\Adafruit_Shield\stm32_adafruit_sd.c

On the F4 one might go with SDIO as it is markedly faster and more robust.

Best to start with working examples you can port, than broken examples you must debug

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

Hello Tesla DeLorean,

Thank you for your response.

I did try with the SDIO 1-bit mode just to test it out and also because the interface of SDIO 1-bit and SPI implementation is similar (same SPI module used).

But the 1-bit SDIO mode also gave the same FR_NOT_READY error irrespective of changing the SD_Detect pin.

Will try to import the Adafruit lib and see if it helps.

Regards,

Yash