2018-02-20 02:27 AM
Hi,
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.
https://community.st.com/tags♯/?tags=stm32f4%20debug%20systemworkbench
4spi &sharpstm32f4 hal driverhttps://community.st.com/tags♯/?tags=iar%20embedded%20workbench
‌#stm32f4-debug-systemworkbench #sd-card-mmc-stm32cubemx #iar-embedded-workbench #sd-spi-sdio2018-02-20 02:29 AM
2018-02-20 03:28 AM
There should be the AdaFruit shield code under the HAL BSP directories, and some FatFs code in the Application directories.
2018-02-20 03:38 AM
2018-02-20 07:38 AM
Command level SPI SD routine
STM32Cube_FW_F4_V1.16.0\Drivers\BSP\Adafruit_Shield\stm32_adafruit_sd.c
Board level SPI SD support routines
STM32Cube_FW_F4_V1.16.0\Drivers\BSP\STM32F4xx-Nucleo\stm32f4xx_nucleo.c
Relatively portable across a number of STM32 platforms/families.
Pretty low performance, I recommend 4-bit SDIO to deliver any sort of usable speed.
2018-02-28 07:58 AM
Thanks for the link. I had ported the code, but Icouldn't put the SD in the idle state (SD_GoIdleState). I am using SanDisk16 GBmicro sd card. I have tested the data signals of command bytes, it is sending perfectly. The response of sendSD_ANSWER_R1_EXPECTED is 224 not 0x Kindly help to troubleshoot this bug.
Please confirm,
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.
Thanks.
#stm32 spi
#sd%20card%20mmc%20stm32cubemx
#sd%20spi%20sdio
2018-02-28 09:15 AM
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.
2018-03-07 06:57 AM
Hi Clive,
I am getting FR_NOT_READY error after disk_initialize() function. I am testing on the Sandisk uSdHC- 16 GB card .
2018-04-10 06:28 AM
Hey Param,
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.
Kind regards
Nico
2018-05-09 10:07 AM
I wrote this program (Atollic Studio) for an STM32L4 and it worked for me (tested on 4GB and 16GB cards only).
Hope it helps!