Kindly help me to find out the example code for read/write the SD card via SPI. I am trying to write or copy the files both USB disk and/or SD card. Please advice.
stm32f4spi #stm32f4 hal driver iar embedded workbench
There should be the AdaFruit shield code under the HAL BSP directories, and some FatFs code in the Application directories.
Command level SPI SD routine
Board level SPI SD support routines
Relatively portable across a number of STM32 platforms/families.
Pretty low performance, I recommend 4-bit SDIO to deliver any sort of usable speed.
Thanks for the link. I had ported the code, but I couldn't put the SD in the idle state (SD_GoIdleState). I am using SanDisk 16 GB micro sd card. I have tested the data signals of command bytes, it is sending perfectly. The response of send SD_ANSWER_R1_EXPECTED is 224 not 0x01. Kindly help to troubleshoot this bug.
SD_IO_CSState(1) means just HIGH the CS line , Is it? Since most of the data are written to the SD while the CS line is HIGH.
#stm32 spi sd card mmc stm32cubemx sd spi sdio
I'm afraid I can't provide resources to debug this, I can however confirm that the software, other than the multi-sector issue highlighted in another thread, does work properly for SDHC/XC cards.
SD_IO_CSState(1) drives the CS line High, while SD_IO_CSState(0) drives it low. The commands and responses are sent while the pin is low. Some 0xFF sequences are sent with it high the clear the interface.
I am getting FR_NOT_READY error after disk_initialize() function. I am testing on the Sandisk uSdHC- 16 GB card .
I want to do the same thing as you! Now I also run into problems when interacting to the SD card with the FatFs.
Did you achieve to get it working? I did achieve to compile the project as described above but opening the SD card gives me an error.
FatFs - Generic FAT Filesystem Module
I wrote this program (Atollic Studio) for an STM32L4 and it worked for me (tested on 4GB and 16GB cards only).
Hope it helps!
Retrieving data ...