2017-02-08 05:08 PM
I've got a custom board with a STM32F103 that connects to a micro SD card using 1 bit SDIO. I've generated some basic test code using STM32CubeMx Rev 4.19.0 and STM32CubeF1 release 1.4.0 (both the latest according to the software & ST website). All it does it try to write a test file to the SD card.
I've got a scope on the SDIO_CMD, SDIO_CK and SDIO_D0 lines to see what is happening - and the answer is 'not enough'!
I can see the CMD0 command being clocked out - checksum matches the SDIO specs - at 162kHz. But the card doesn't respond. I then see the CMD8 command clocked out, again no response. And then I see CMD55 clocked out with no response. At this point stm32f1xx_hal_sd.c gives up in the SD_PowerON() function because it needed a response to that one (it doesn't seem to care too much about the rest).
I have no idea why the card doesn't respond. I've double/triple checked the pinout on the socket is correct and the card pins are connected to the correct micro pins. I've checked the card has 3V3 on it (same as micro). I've tried adding a pull-up to SDIO_D0 (suggested elsewhere to stop it going into SPI mode) but that doesn't help.
I've tried 3 cards - two are 1GB and one is 8GB. All of them work ok when I put them in a SD card reader attached to my PC.
I tried playing with the micro clock settings - I can change the clock frequency for the initialisation routine from 40kHz (out of spec) to 320kHz (in spec) and it makes no difference.
Help! What next?
#stm32f103 #stm32cubemx #sdioSolved! Go to Solution.
2017-02-08 09:00 PM
Dear mcconaghy.peter,
Add external pullup on CMD and other floating DATA bus Line too.
SD/MMC specification doesn't allow bus floating.
As I said in other thread, don't trust internal pullup.
https://community.st.com/0D50X00009Xke3lSAB
Best Regards,
Nemui.2017-02-08 05:14 PM
Card is hooked up with:
Pin 1 - DAT2 - floating
Pin 2 - DAT3 - floating
Pin 3 - CMD - SDIO_CMD to micro
Pin 4 - VDD - 3V3
Pin 5 - CLK - SDIO_CLK to micro
Pin 6 - VSS - GND
Pin 7 - DAT0 - SDIO_D0 to micro, (tried 10k pullup to 3V3 but didn't make any difference)
Pin 8 - DAT1/nIRQ - floating
2017-02-08 09:00 PM
Dear mcconaghy.peter,
Add external pullup on CMD and other floating DATA bus Line too.
SD/MMC specification doesn't allow bus floating.
As I said in other thread, don't trust internal pullup.
https://community.st.com/0D50X00009Xke3lSAB
Best Regards,
Nemui.2017-02-08 11:40 PM
aaaaagggggghhhhhhhhhhh!! I'd tried pullups on some of the lines but not all and had read on many sites that they weren't needed. Looks like they are... I've just written my first file on this board!! Shame about the wasted 3 days... grrrr
thanks for you help.
2017-02-09 03:59 PM
I think the F1 is more problematic with internal pull ups than the F4. My own boards have pull ups externally close to the card socket, but have used other where the internals were sufficient but the traces were very short.
2024-04-30 08:52 PM
i also have the same problem
thanks for your help.