cancel
Showing results for 
Search instead for 
Did you mean: 

Driver to use MicroSD card with SPI

ronandouguet
Associate II
Posted on March 07, 2012 at 11:12

Hi,

I develop a project on the STM32F4 discovery board and I want use a MicroSD card. I work with Atollic TrueStudio for STM32.

So I search a driver to use my MicroSD card with SPI. I have an API to FATFs and an API to configure the SPI module but I haven't the driver to use MicroSD card.

My goal is to achieve a datalogger.

Thanks for your help.
23 REPLIES 23
danish_enchanting
Associate II
Posted on March 27, 2012 at 18:37

I want to use 32f4 discovery to make it read write from a microsd card. can you help me with code you made

ronandouguet
Associate II
Posted on March 29, 2012 at 16:09

Hi wagar,

I can you help but where is your problem ?

browar102
Associate
Posted on April 16, 2012 at 01:19

Hi ronan,

Could you send me your header's file's? I  try to connect with SD card but I still get FR_INVALID_OBJECT. My program worked excellent on STM32F103 but not on STM32F407 and I no idea what's is wrong. My email is browar102@gmail.com

Regards,

browar102
rishi
Associate II
Posted on July 18, 2012 at 08:02

brother i am trying to work on micro sd card with stmf4 discovery board...i am using keil for building code...so can u please provide me the complete code for the same...with the pin connection diagram...thanks

what are the files that u inluded...please mail me your complete project at rishi.iitk@gmail.com

Posted on July 18, 2012 at 16:45

See also

STM32F2xx_StdPeriph_Lib_V1.0.0\Utilities\STM32_EVAL\Common\stm32_eval_spi_sd.c

* @file stm32_eval_spi_sd.c
* @author MCD Application Team
* @version V4.6.1
* @date 18-April-2011
* @brief This file provides a set of functions needed to manage the SPI SD
* Card memory mounted on STM32xx-EVAL board (refer to stm32_eval.h
* to know about the boards supporting this memory).
* It implements a high level communication layer for read and write
* from/to this memory. The needed STM32 hardware resources (SPI and
* GPIO) are defined in stm32xx_eval.h file, and the initialization is
* performed in SD_LowLevel_Init() function declared in stm32xx_eval.c
* file.
* You can easily tailor this driver to any other development board,
* by just adapting the defines for hardware resources and
* SD_LowLevel_Init() function.
*
* +-------------------------------------------------------+
* | Pin assignment |
* +-------------------------+---------------+-------------+
* | STM32 SPI Pins | SD | Pin |
* +-------------------------+---------------+-------------+
* | SD_SPI_CS_PIN | ChipSelect | 1 |
* | SD_SPI_MOSI_PIN / MOSI | DataIn | 2 |
* | | GND | 3 (0 V) |
* | | VDD | 4 (3.3 V)|
* | SD_SPI_SCK_PIN / SCLK | Clock | 5 |
* | | GND | 6 (0 V) |
* | SD_SPI_MISO_PIN / MISO | DataOut | 7 |
* +-------------------------+---------------+-------------+

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
moniuse98780
Associate
Posted on July 19, 2012 at 07:31

Hi,Guys.

I found better FatFs examples for STM32F4-Discovery.

And can work fine any SDcard I have(256MB-SD,8GB-SDHC,etc...).

http://nemuisan.blog.bai.ne.jp

http://nemuisan.blog.bai.ne.jp/?eid=192848

This URL also has STM32F1,F2,VL,L and other microcontrollers examples.

rishi
Associate II
Posted on July 19, 2012 at 09:51

@clive where will i get the peripheral firmware folder which contains ''

stm32_eval_spi_sd.c''

as on site of st i didnt find any file related to this version...if you have then please post it here...

if anyone have modified the program for uSD using SPI for STM32F4 discovery,,,then please post it here...i am in urgent need...i am Using KEIL.

Posted on July 19, 2012 at 13:50

The file cited is in the STM32F2 library.

http://www.st.com/internet/com/SOFTWARE_RESOURCES/SW_COMPONENT/FIRMWARE/stm32f2xx_stdperiph_lib.zip

The first rule of ST software releases is to grab and archive them all, they often contain useful information that works across the series, can be hard to find when you're looking for them, and can disappear or be updated or replaced.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
vinothraj
Associate II
Posted on July 19, 2012 at 14:28

http://www.st.com/internet/mcu/product/252140.jsp

In that link,you click on Design Support Tab and download Stm32f407vg firmware.

In that firmware,you will find on:

stm32f4_dsp_stdperiph_lib\STM32F4xx_DSP_StdPeriph_Lib_V1.0.1\Utilities\STM32_EVAL\STM3240_41_G_EVAL.

rishi
Associate II
Posted on July 24, 2012 at 11:31

ronan or anyone else can u please post your complete program for data logging on sd card...i am getting errors in compiling the program...

i tried to compile clive version2 program...using keil