Example code for stm32f4 SD card read via SPI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2018-02-20 2: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-sdio- Labels:
-
DEBUG
-
IAR
-
SDIO-SDMMC
-
STM32CubeMX
-
STM32F4 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2018-02-20 2:29 AM
http://www.lmgtfy.com?q=SD+Card+SPI+STM32
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2018-02-20 3:28 AM
There should be the AdaFruit shield code under the HAL BSP directories, and some FatFs code in the Application directories.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2018-02-20 3:38 AM
http://elm-chan.org/fsw/ff/00index_e.html
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2018-02-20 7: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.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2018-02-28 7: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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2018-02-28 9: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.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2018-03-07 6: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 .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2018-04-10 6: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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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!
