I've hit a wall trying to get SDIO to work on a stm32f4 discovery board. When I run sdcConnect, the program gets to this line before failing everytime in sdc.c:
Code: Select all
/* Block length fixed at 512 bytes.*/
if (sdc_lld_send_cmd_short_crc(sdcp, MMCSD_CMD_SET_BLOCKLEN,
MMCSD_BLOCK_SIZE, resp) ||
MMCSD_R1_ERROR(resp[0])) {
goto failed;
}
My main.c looks like this:
Code: Select all
int main(void) {
halInit();
chSysInit();
uartStart(&UARTD2, &uartcfg);
palSetPadMode(GPIOA, 2, PAL_MODE_ALTERNATE(7));
palSetPadMode(GPIOA, 3, PAL_MODE_ALTERNATE(7));
sdcStart(&SDCD1, &sdccfg);
printMsg("Connecting...\n", 14);
if (sdcConnect(&SDCD1))
printMsg("Failed!!!\n", 10);
else
printMsg("Good!\n", 6);
while (true) {
chThdSleepMilliseconds(1000);
}
}
The card is a 16gb PNY sd card formatted as fat32. I'm pretty sure I have the board.h set up correctly. I'm using 10cm wires from the discovery board to the card and pull-up resistors on the 4 data lines and cmd line. Any insight to why this particular section of sdcConnect is failing? I attached the code if that helps. Thanks in advance.