Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
24652228
Commit
24652228
authored
Oct 10, 2015
by
Damien George
Browse files
drivers/sdcard: Allow up to 5 retries to initialise SD card.
Apparently some cards need more than 2 retries. See issue #1482.
parent
845b5a2a
Changes
1
Hide whitespace changes
Inline
Side-by-side
drivers/sdcard/sdcard.py
View file @
24652228
...
...
@@ -51,10 +51,12 @@ 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
:
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
else
:
raise
OSError
(
"no SD card"
)
# CMD8: determine card version
r
=
self
.
cmd
(
8
,
0x01aa
,
0x87
,
4
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment