SD card not working in D-series

The official PYBD running MicroPython, and its accessories.
Target audience: Users with a PYBD
User avatar
Posts: 4942
Joined: Fri Jul 18, 2014 8:01 am
Location: UK

Re: SD card not working in D-series

Post by pythoncoder » Thu Nov 19, 2020 8:47 am

SD cards are something of a black box with their own microcontroller and it's possible that you're hitting some inherent limitation. A websearch on logging to SD might be informative, alternatively writing a similar test in CPython running on a PC to determine whether the Pyboard or the SD card is the culprit.

Could there be a power sequencing problem? A delay between enabling the SD card and attempting to mount it might be worth a try, but this is clutching at straws...

Aside from that, I'm out of ideas :( Perhaps someone else will chip in.

Re the RTC, if you need to store data during deepsleep this repo provides two solutions using the battery backed RAM or RTC registers.
Peter Hinch

Posts: 16
Joined: Sun May 22, 2016 1:35 am

Re: SD card not working in D-series

Post by machdisk » Fri Nov 20, 2020 1:40 am

I too am having the same issue (i.e. OSError: 16). I've tried mouting via and repl and still get the same behavior. I've tried this on 1.13 and 1.12 and a PYBD SF3W. Any ideas are welcome.

webbhm wrote:
Tue Nov 17, 2020 8:18 pm
I am having a similar issue with a PYBD-SF2W where the SD card is present but will not mount. The boot file errors out, then the /flash/ gets called.
I have tried several SD cards, did a factory reset as well as a re-flashing of the firmware - all with no change. I am concerned this might be a hardware issue (ie: failure on block read)(SD card holder?).
This is a data logger project, and the board had successfully run for several days logging over 500K records to the SD, in a standby/log cycle at 2 second intervals. For the last day I had slowed it down to 1 cycle/minute. I was changing files on the SD card when this started to occur. Is this problem expected after this much activity, or are there any suggestions?

Note: line 12 of is:

os.mount(pyb.SDCard(), '/sd')

The following is from running REPL:

Traceback (most recent call last):
File "", line 12, in <module>
OSError: 16
Connected at:
MicroPython v1.13 on 2020-09-02; PYBD-SF2W with STM32F722IEK
Type "help()" for more information.
>>> import pyb, os
>>> pyb.SDCard().present()
>>> os.mount(pyb.SDCard(), '/sd')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: 16
>>> print(pyb.SDCard().read(0))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
Exception: sdcard_read_blocks failed [1]


Post Reply