We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 845b5a2 commit 2465222Copy full SHA for 2465222
drivers/sdcard/sdcard.py
@@ -51,10 +51,12 @@ def init_card(self):
51
for i in range(16):
52
self.spi.send(0xff)
53
54
- # CMD0: init card; should return R1_IDLE_STATE (allow 2 attempts)
55
- if self.cmd(0, 0, 0x95) != R1_IDLE_STATE:
56
57
- raise OSError("no SD card")
+ # 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
58
+ else:
59
+ raise OSError("no SD card")
60
61
# CMD8: determine card version
62
r = self.cmd(8, 0x01aa, 0x87, 4)
0 commit comments