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?