drivers/sdcard: Allow up to 5 retries to initialise SD card.
Apparently some cards need more than 2 retries. See issue #1482.
This commit is contained in:
parent
845b5a2a58
commit
24652228af
|
@ -51,9 +51,11 @@ class SDCard:
|
|||
for i in range(16):
|
||||
self.spi.send(0xff)
|
||||
|
||||
# CMD0: init card; should return R1_IDLE_STATE (allow 2 attempts)
|
||||
if self.cmd(0, 0, 0x95) != R1_IDLE_STATE:
|
||||
if self.cmd(0, 0, 0x95) != R1_IDLE_STATE:
|
||||
# CMD0: init card; should return R1_IDLE_STATE (allow 5 attempts)
|
||||
for _ in range(5):
|
||||
if self.cmd(0, 0, 0x95) == R1_IDLE_STATE:
|
||||
break
|
||||
else:
|
||||
raise OSError("no SD card")
|
||||
|
||||
# CMD8: determine card version
|
||||
|
|
Loading…
Reference in New Issue