SD card not working in D-series

The official PYBD running MicroPython, and its accessories.
Target audience: Users with a PYBD
Post Reply
Johnny
Posts: 3
Joined: Fri Mar 06, 2020 11:21 am

SD card not working in D-series

Post by Johnny » Fri Mar 06, 2020 11:43 am

Hey guys,

I was developing a little script on pyBoard v1.1 which reads data from a SD-card which worked properly.

Since I need to cache a lot of values I ran out of RAM and I wanted to test it on a D-series pyBoard (SF2W).

Unfortunately the SD card is not shown. Neither in windows nor with os.listdir().

boot.py contains
pyb.usb_mode('VCP+MSC')
and I tested two SD cards and two D-series boards in every combination. None worked!

Did I miss anything? Is there something like a switch/bridge on the board?

Firmware is 1.12 on all the boards.

tine3700
Posts: 14
Joined: Tue Sep 13, 2016 7:08 am

Re: SD card not working in D-series

Post by tine3700 » Fri Mar 06, 2020 3:22 pm

Hi Johnny,

if an SD card is inserted in a PYBD, it will not be automatically mount in the board’s filesystem.
Put the following code in your boot.py, to automatically mount the SD Card:

Code: Select all

import sys, os, pyb

if pyb.SDCard().present():
    os.mount(pyb.SDCard(), '/sd')
    sys.path[1:1] = ['/sd', '/sd/lib']
You can find more information here: https://pybd.io/hw/pybd_sfxw.html#sd-card

Best,
Christine

Johnny
Posts: 3
Joined: Fri Mar 06, 2020 11:21 am

Re: SD card not working in D-series

Post by Johnny » Tue Mar 10, 2020 2:55 pm

Hey Christine,

this works, thanks a lot but (how) is it possible to show the SD card as a mass storage device if present?

Johnny

Online
User avatar
pythoncoder
Posts: 4030
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: SD card not working in D-series

Post by pythoncoder » Tue Mar 10, 2020 6:12 pm

Have you got the following in boot.py after mounting the SD card?

Code: Select all

pyb.usb_mode('VCP+MSC')
See the docs.
Peter Hinch

Johnny
Posts: 3
Joined: Fri Mar 06, 2020 11:21 am

Re: SD card not working in D-series

Post by Johnny » Wed Mar 11, 2020 5:24 pm

Hey Peter,

as I said:

boot.py contains
pyb.usb_mode('VCP+MSC')
and I tested two SD cards and two D-series boards in every combination. None worked!

pagano.paganino
Posts: 77
Joined: Fri Sep 11, 2015 10:47 pm
Location: Italy

Re: SD card not working in D-series

Post by pagano.paganino » Thu Mar 12, 2020 12:05 am

try this:

Code: Select all

pyb.usb_mode('VCP+MSC', msc=(pyb.SDCard(),)) # expose SD card to the PC

Post Reply