cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 Memory Card Interface Issue

sumit kale
Associate III
Posted on February 22, 2017 at 14:43

Hello. I am trying to integrate SD Card (Transcend 4GB) with STM32F407 Disc board. I had followed all previous discussion & made corrections yet i am getting Error. I have attached my clock configuration, Pin diagram of STM Cube MX & Detail Code. Can anybody tell me what extra changes i Need to do to get rid of error. Usually i am getting Disc error (Program is not going aheaf 'f_mount()'). When i press reset button it gives Disc Error.

I changed all GPIOs to 'Pull high'. I am not sure if 3V power is enough for the Memory Card as i am directly connecting my VDD pin (STM32F4) to Memory Card. I have connected Memory Card by following way to board:

1. Card Detect (PIN1) to PC2

 2.CMD (PIN2) to PD2

3. Clock(PIN5) to PC12

4. VDD(PIN4) to 3V

5. DAT0(PIN7) to PC8

Any comments about Code & configurations will be highly appreciated.

#fatfs #stm32f4discovery-stm32f4 #stmcubemx
3 REPLIES 3
Posted on February 22, 2017 at 22:34

Ok, so zipped project doesn't contain source code

Don't think you've quite grasped the Card Detect here. If you are running in SDIO mode, vis SPI.

The Card Detect on a socket is typically a switch to ground, not a card pin. If a card pin it is used as a Chip Select.

Is this a full sized SD Card?

Is it using a socket? Soldered directly to the card pins?

Got a data sheet or web page for the socket? Cite it.

Do you have the Ground pin (3 & 6) wired?

The STM32F4-DISCO will accommodate a full SDIO 4-bit interface, the circuit and connectivity being covered here multiple times. I'm not looking to keep debugging these things, my goals have been to provide clear info and code to get it working, not debug 1000 disfunctional designs/codes.

Remember there is no point prodding the FatFs side of the code, you need to get into the SDIO/SPI layer and make that work properly first, otherwise most salient detail and failure mechanism is lost with an arbitrary ''Doesn't Work'' kind of error telling us nothing.

An SPI type connection would look something like this

0690X00000603eIQAQ.jpg

I'd recommend a fully wired SDIO solution, look at the STM32F4DIS-BB board for a common and working interface.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on February 23, 2017 at 11:24

Hello Clive,

You are right ist already explained many times on this community about Interface. But unfortunatly i was unable to get cause of error.

About your questions:

1. Card is full sized.

2. Yes i am using socket. I have soldered Pins with socket. Please find attached Information of same. It have 9 Pins which i have connected with Discovery board via connectors.

http://www.molex.com/molex/products/datasheet.jsp?part=active/5035000991_MEMORY_CARD_SOCKET.xml

3. Yes i have wired Ground Pin 3,6 & connected it with GND terminal on the Discovery board.

0690X00000606KqQAI.png

4. Regarding Code i had attached Keil V5 source file. Also i am attaching now Src files generated from Cube MX.

I will again go through all my Connections.

Thanks for Reply.

Posted on April 03, 2017 at 11:05

Hey ,

Problem solved. I guess error was in Clock Initialisation for SDIO. I think when i generated Code from cube MX, clock initialisation was Missing. Also I have assigned seperate pin for Card detect (PE15 for STM32F205). SO now i can detect my SD Card as well as write data on it.

Thanks for Detail Information.