2021-10-28 02:35 AM
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
2021-11-02 05:37 AM
Can someone please help, if they have expertise in the above-said interfacing or if they interfaced an SD card module with STM32F407 successfully?
2021-11-02 07:26 AM
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
2021-11-04 11:45 PM
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