Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

Where do I find storage.py?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Where do I find storage.py?

by ronfischler on Thu Jul 23, 2020 3:31 pm

I had been doing development using CircuitPython on a Feather M4, and I was doing file IO to a SPI-connected Micro-SD card using the "adafruit_sdcard" and "storage modules." I have recently begun a migration to a RPi Zero W board, and although there may be other solutions, I would like this to continue working as it was. I installed Blinka and I was able to get adafruit_sdcard by installing adafruit-circuitpython-sd using pip3. I cannot create the VFS however, as the storage module does not seem to be available, or at least I have failed to find it. Example code is below:

import adafruit_sdcard
import storage

sdcard = adafruit_sdcard.SDCard(spi, cs)
vfs = storage.VfsFat(sdcard)

Can the storage module be included somehow for RPi boards, to make this work?

ronfischler
 
Posts: 4
Joined: Thu Jul 23, 2020 3:15 pm

Re: Where do I find storage.py?

by danhalbert on Thu Jul 23, 2020 4:03 pm

`storage` is a native module, implemented in C in CircuitPython, that exposes the FAT filesystem implementation inside CircuitPython.

It's possible to add a secondary SD card slots on the RPi, using hardware or software SPI, but that is a lot of trouble: I looked up how some people had done it.

A much easier thing for you to do would be to add a USB SD card reader to the USB OTG jack on the RPi Zero, and just read and write the card as a regular mounted USB FAT filesystem. Imagine, for instance, just plugging a USB stick into a regular RPI with normal USB ports, and reading and writing it. This is basically the same thing. You just need an OTG adapter.

danhalbert
 
Posts: 2073
Joined: Tue Aug 08, 2017 12:37 pm

Please be positive and constructive with your questions and comments.