cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f446re microSD SDIO

giolenas
Associate II

Posted on October 05, 2017 at 08:56

Hi all,

I am using the latest stm32cubemx with a stm32f446re Nucleo board and I am trying to access a microSD card. I have soldered headers to a microSD to SD adaptor and connect all the pins to the corresponding pin on Nucleo. I made my project through stm32cubemx and I am using SD 4 bits wide bus as mode and enabled the FATFS Middleware. My problem seems to be in the lower level because I can�t even initialize the card.

9 REPLIES 9
Posted on October 05, 2017 at 17:25

The screenshots are super interesting, but what's going to determine if this works or not is the code generated, and pins configured/wired up suitably.

Provide a clear and accurate diagram of the microSD card socket, link to parts used.

Make sure no pins conflict or require solder bridges.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
John Craven
Senior
Posted on October 05, 2017 at 17:27

I tried doing your same sd card adapter mod too. Works fine with SPI  (like arduino uses). But after 3-4 different adapters, i couldnt get any reliable SDIO going. I gave up and bought a couple different breakouts.

I tried this one,

https://www.waveshare.com/micro-sd-storage-board.htm

. Worked ok, and got me going with 4bit SDIO, but i still had issues and it wasnt bulletproof.

I ended up, removing all the 10k pullups. I added a 47k resistor network on the backside at the pins, and only pulled up D0-D3 and CMD to 3.3V, and did not pullup the CLK. It works fine now.

Neudy Vielma
Associate
Posted on October 05, 2017 at 21:45

Have you already configured the SDIO_CardDetect pin?

giolenas
Associate II
Posted on October 06, 2017 at 01:41

I have made a new project using the SDIO without DMA as I showed on my original post just to keep everything simple. I have connected all the SD signals to a breadboard with jumper wires, on the breadboard I have place six 47k pull-up resistors on each signal and from there with jumper wires I am connecting all the signals on the corresponding pins of the Nucleo. The think is that I changed the breadboard with a newer one and the SD card now works (so the problem must been a dodgy connection). I also tried the SDIO interface on 48 MHz and it works. I made an simple program for writing 10 MB of data on the SD card.

for(uint32_t i=0; i<10485760; i++)

{

      f_printf(&fil, 'A');

}

The problem here was that some  times I got an error on closing and the other times not all the data was written on the SD card. So I thought maybe I need to occasionally save the data before closing so I did with that code.

for(uint32_t i=0; i<10485760; i++)

{

      f_printf(&fil, 'A');

      if(!(i%4096))

      {

            f_sync(&fil);

      }

}

Now I have achieved to write all the 10 MB most of the time but not always. Is there something else that it maybe wrong or is just the jumper wires acting as an antenna and interfering the the signals causing errors?

Posted on October 06, 2017 at 01:44

I am using a microSD to SD card adapter this solders female headers on it so I don’t have an

SDIO_CardDetect pin

. Also, if I had that pin available, is that possible to configured from cube? If you mean the DAT3/CD then how is possible to configure it from the cube? 
Posted on October 06, 2017 at 01:46

So was the pull up on the CLK causing you the problems?

Posted on October 06, 2017 at 01:51

My connections were connected right and after some ours found that the problem was caused from my breadboard which wasn’t very grippy from use.

Zt Liu
Senior III
Posted on October 11, 2017 at 03:49

hi,

G..Mario

‌.

I am not sure what's the adapter you are using, I just happened to have similar problem recently.

Here is an extension board for F446 Nucleo I made recently.

(Guess it's not well routed....:P)

0690X000006048SQAQ.jpg

I use F446 EVAL board schematic as referencefor those pull-up resistors values.

In the end, I found that my tracks are not well routed, and huge power noise is generated.

(Currently working on how to improve it)

Once I lower done the CLK to few MHz ( CLK = SDIO clk/(divide factor + 2) ), then everything works just fine.

Here are some of my experience, hope it helps:

1.Firstly disable file system so that Ican focus on low level driver parts.

2. Disable DMA for the momentand make sure polling mode can work.

3. Lower the clock speed, down to 1MHz or even few hundred kHz.

4. Make sureMX_SDIO_SD_Init() really initialize the sd card from 1 bit mode to 4 bit mode.

5. If initialized ok, try to callGetCardInfo orGetCardStatus.

Good luck!

Posted on October 11, 2017 at 07:01

I cannot help you with your problem, but i hope soon to make the leap from bread boards to I doing what you are doing regarding prototyping. so much better than the birds nest of jumper wires i work with now!