SD Card over USB MCS

The official PYBD running MicroPython, and its accessories.
Target audience: Users with a PYBD
Post Reply
jamonda
Posts: 36
Joined: Thu May 21, 2020 3:48 pm

SD Card over USB MCS

Post by jamonda » Thu Aug 13, 2020 12:04 am

Hi everybody.
According to the Pyboard D reference, the if an SD card is inserted, by default it will not be automatically mounted in the board’s filesystem but it will be exposed as a mass storage device if USB is used.
My SD Card doesn't show as a mass storage device, no matter it's mounted or not.
Why?

Stevo52
Posts: 38
Joined: Sun Feb 03, 2019 10:28 pm

Re: SD Card over USB MCS

Post by Stevo52 » Fri Aug 14, 2020 5:40 am

It might help if you post the code you are using? Do you get any error messages?

I have this in boot.py (probably in common use)...

import sys, uos, pyb

# If an SD is detected, mount it

Code: Select all

if pyb.SDCard().present():
   uos.mount(pyb.SDCard(), '/sd')
   sys.path[1:1] = ['/sd', 'sd/lib']
It works as expected when there is a card inserted.. however you may not see the sdcard appear on the device connected by USB, without using (and doing so might stop you seeing the pyboard D storage as /flash) :
pyb.usb_mode('VCP+MSC', msc=(pyb.SDCard(),))

There are combinations of of pyb.usb_mode command which could let you see multiple msc devices.

Post Reply