cnoviello/mastering-stm32

SD card initialization example: ACMD41 transmission bit missing

pterodragon opened this issue · 0 comments

https://github.com/cnoviello/mastering-stm32/blob/master/nucleo-f446RE/Middlewares/FatFs/src/drivers/sd_diskio_spi.c#L354
ACMD41 returns 0x05 (includes the illegal command flag) here

I think this line
https://github.com/cnoviello/mastering-stm32/blob/master/nucleo-f446RE/Middlewares/FatFs/src/drivers/sd_diskio_spi.c#L259
should have been

    cmd_message[0] = cmd | 0x40;

I'm using a SanDisk 64 GB microSDXC card, and after making the above correction, ACMD41 returns 0x00 and the SD card initialization process is successful