cancel
Showing results for 
Search instead for 
Did you mean: 

Need the example code for SD card interface with STM32f4 discovery board via SPI protocol

parth
Associate II
Posted on January 17, 2017 at 10:20

Hello All,

I am interface a SD card with STM32f4 discovery board. i am use the SPI protocol for the same.I use the IAR IDE for the development.I need the example code for further development.

So, please share the example code for SD card interface with stm32f4 discovery using SPI protocol.

Any help would be highly appreciated in this case ?

Thanks,

Parth Modi

#fatfs #sd-card #stm32f4-discovery
4 REPLIES 4
Oliver Beirne
Senior
Posted on January 17, 2017 at 10:29

Hi

Modi.Parth

I have moved your question to the

https://community.st.com/community/stm32-community/stm32-forum?sr=search&ampsearchId=59d37e22-a9ee-483c-a026-bf041cc1e8ca&ampsearchIndex=0

where someone will be able to assist you.

Thanks

Oli

Khouloud GARSI
Lead II
Posted on January 18, 2017 at 10:57

Hi

Modi.Parth

,

You can use the SPI examples provided in

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-embedded-software/stm32cubef4.html

or

https://my.st.com/content/my_st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32-standard-peripheral-libraries/stsw-stm32html

in order to correctly configure the SPI peripheral. Those examples are found following the paths below:

  • STM32Cube_FW_F4_V1.0\Projects\STM32F4-Discovery\Examples\SPI (Cube)
  • STM32F4xx_DSP_StdPeriph_Lib_V1.8.0\Project\STM32F4xx_StdPeriph_Examples\SPI (SPL)

Also, you can refer to the 'SDIO' examples:

  • STM32Cube_FW_F4_V1.0\Projects\STM324x9I_EVAL\Examples\SDIO (cube)
  • STM32F4xx_DSP_StdPeriph_Lib_V1.8.0\Project\STM32F4xx_StdPeriph_Examples\SDIO (SPL)

Additionally, I advise you to have a look at 'stm32l152_eval_spi_sd.c' file provided for STM32L1 devices in

https://my.st.com/content/my_st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32-standard-peripheral-libraries/stsw-stm32html

V1.3.1.

May this help you.

Khouloud.

Posted on January 23, 2017 at 10:49

Hi

Khouloud,

Thanks for the support.

I tried the SDIO example code on the STM32F429 board for SD card interface, But this code is not work on STM32f429 board. So, I

made the SD card interface code for the STM32f4 discovery board from reference of the STM32f429 SDIO example code. I use the 1-bit SDIO mode for interface.I am use IAR IDE for the development.

I am get theFR_NOT_READY error on STM32f4 discovery board. I make the pin connection as the below.

stm32f4 microsd card

PD2----->command

PC12 ------------->clock

PC8-------------->data

vcc---------------->3.3

GND------------------>gnd

I have attached my code for your reference .

Please help to make this code work for me ?

Any help would be highly appreciate?

Thanks,

Parth

________________

Attachments :

SDIO_1_BIT_SD.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hyth&d=%2Fa%2F0X0000000bEp%2F5oojKvhs6upvi7kfSPriUJccy_HLDceLDh7jmofGooc&asPdf=false
Posted on January 23, 2017 at 14:39

Dear modi.parth

Pullup SDCard's DATA/CMD line by 47k~10kohm external resister.

Putting external pullup prevents bus floating.

For more detail,see Physical Layer Simplified Specification.

https://www.sdcard.org/downloads/pls/

 

Best regards,

Nemui.