Some microSD card need mount twice to work

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
shaoziyang
Posts: 363
Joined: Sun Apr 17, 2016 1:55 pm

Some microSD card need mount twice to work

Post by shaoziyang » Wed Apr 28, 2021 3:31 am

I have try to mount microSD card via SPI in pyboard. Some microSD card works, but some microSD card will cause timeout error.

Code: Select all

>>> sd=sdcard.SDCard(SPI, PIN_CS)
>>> os.mount(sd, '/SD')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "sdcard.py", line 239, in readblocks
  File "sdcard.py", line 181, in readinto
OSError: timeout waiting for response
But if try to mount it again, it will works. Just increase _CMD_TIMEOUT value does not solve the problem.

Code: Select all

>>> sd=sdcard.SDCard(SPI, PIN_CS)
>>> os.mount(sd, '/SD')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "sdcard.py", line 239, in readblocks
  File "sdcard.py", line 181, in readinto
OSError: timeout waiting for response
>>> os.mount(sd, '/SD')
>>> os.listdir('/SD')
['demo.py']
>>> os.statvfs('/SD')
(32768, 32768, 491264, 491262, 491262, 0, 0, 0, 0, 255)

lolsch
Posts: 1
Joined: Sun Apr 24, 2022 5:53 pm

Re: Some microSD card need mount twice to work

Post by lolsch » Sun Apr 24, 2022 5:57 pm

I just made this account to thank you. Have been struggling with different sd cards and modules for a while now and just calling it twice fixed it very reliable.
Thank you so much!

Post Reply