Comments (3)
You may just have a problem reading the file. Try reloading the .mpy files to the board and make sure the board has finished all writes to the board before attempting to run any code.
If you are on Linux - do a “sync”. For other OS, I’m not certain of the best ways, but you can eject then remount CIRCUITPY or just wait at least a minute....
from adafruit_circuitpython_bundle.
Closing was premature sorry, a second import looked ok, but it just fails to produce the error. I am copying the adafruit_sdcard.mpy module into the /lib directory on the board, then ejecting and reseting the board.
Editing on Mac OSX
Using the example:
import os
import busio
import digitalio
import board
import storage
import adafruit_sdcard
# The SD_CS pin is the chip select line.
#
# The Adalogger Featherwing with ESP8266 Feather, the SD CS pin is on board.D15
# The Adalogger Featherwing with Atmel M0 Feather, it's on board.D10
# The Adafruit Feather M0 Adalogger use board.SD_CS
# For the breakout boards use any pin that is not taken by SPI
SD_CS = board.D10 # setup for M0 Adalogger; change as needed
# Connect to the card and mount the filesystem.
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
cs = digitalio.DigitalInOut(SD_CS)
sdcard = adafruit_sdcard.SDCard(spi, cs)
vfs = storage.VfsFat(sdcard)
storage.mount(vfs, "/sd")
# Use the filesystem as normal! Our files are under /sd
# This helper function will print the contents of the SD
def print_directory(path, tabs=0):
for file in os.listdir(path):
stats = os.stat(path+"/"+file)
filesize = stats[6]
isdir = stats[0] & 0x4000
if filesize < 1000:
sizestr = str(filesize) + " bytes"
elif filesize < 1000000:
sizestr = "%0.1f KB" % (filesize/1000)
else:
sizestr = "%0.1f MB" % (filesize/1000000)
prettyprintname = ""
for _ in range(tabs):
prettyprintname += " "
prettyprintname += file
if isdir:
prettyprintname += "/"
print('{0:<40} Size: {1:>10}'.format(prettyprintname, sizestr))
# recursively print directory contents
if isdir:
print_directory(path+"/"+file, tabs+1)
print("Files on filesystem:")
print("====================")
print_directory("/sd")
The program breaks when the module is accessed:
sdcard = adafruit_sdcard.SDCard(spi, cs)
from adafruit_circuitpython_bundle.
Hello again, I found the problem - I was using the adafruit_bus_device module that came included with 4.0.2 - it seems there is an incompatibility between the 4.0.2 adafruit_bus_device module and the bundle 4x adafruit_sdcard module.
Fixed by replacing with the adafruit_bus_device module from the bundle
from adafruit_circuitpython_bundle.
Related Issues (20)
- Unable to launch browser with rpi pico usb hid application launch code HOT 1
- Build CI is failing
- Latest bundle version's mpy files aren't compiled. HOT 4
- Pico + Feather memory allocation failed
- self.ntp.datetime hangs indefinitely HOT 2
- Should we diable folder-image generation for other forks?
- Many libraries with bad circup instructions HOT 5
- FR: Add type hints to circuit python libraries HOT 1
- Include import names in the library list HOT 1
- "Drivers" vs "Helpers" is not so helpful as a top-level distinction HOT 1
- Note that adafruit_bus_device and adafruit_pixelbuf are available as native
- AttributeError: module 'pulseio' has no attribute 'PulseOut' HOT 1
- Add NAU7802
- Bundle being rebuilt with no library changes HOT 4
- LSM6DS libraries were combined drivers.rst needs updated
- key stuck with macropad HOT 4
- adafruit_neopxl8.mpy doesn't have NeoPixel attribute
- request - port TM1640 driver from micropython
- Source code release zip is mostly empty directories. HOT 6
- mcp2515 error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adafruit_circuitpython_bundle.