I've a problem accessing a SD card using the MMC SPI driver.
I'm using a STM Nucleo board, with the STM32F030R8.
I mostly copied the code from the STM32F103-FATFS demo. The SD card is connected on the SPI2 bus.
In the mmcConnect function, the initialization part using the slow speed seems to succeed.
However, after switching to high speed, the SET_BLOCKLEN command fails.
Here's a sample of a GDB session:
Code: Select all
516 spiStart(mmcp->config->spip, mmcp->config->hscfg);
519 if (send_command_R1(mmcp, MMCSD_CMD_SET_BLOCKLEN,
send_command_R1 (mmcp=0x20000d80 <MMCD1>, cmd=16 '\020', arg=512) at ../ChibiOS_2.6.4/os/hal/src/mmc_spi.c:265
265 spiSelect(mmcp->config->spip);
266 send_hdr(mmcp, cmd, arg);
267 r1 = recvr1(mmcp);
(gdb) p r1
$5 = 32 ' '
(gdb) n
268 spiUnselect(mmcp->config->spip);
269 return r1;
(gdb) p r1
$6 = 255 '\377'
I'm not sure how to interpret these values...
Why r1 = 32 and then 255?
Any help would be greatly appreciated