Fix SD-Card initialization process

After command ACMD41 was being sent we were not waiting
for the error idle state bit being cleared, so we were
really never going out from the initialization phase.
This commit is contained in:
David Gálvez
2018-11-02 12:39:32 +01:00
committed by Markus
parent af9f9bca71
commit 795efccf75
2 changed files with 5 additions and 1 deletions

View File

@@ -424,7 +424,7 @@ DSTATUS disk_initialize(uint8_t drv)
while (MCF_SLT_SCNT(0) - target > 0)
{
res = send_cmd(ACMD41, 1UL << 30); /* Wait for end of initialization with ACMD41(HCS) */
if (res != 0xff)
if ((res & SD_ERR_IDLE_STATE) == 0)
break;
}
debug_printf("res = %d\r\n", res);