circuitpython: [pygamer] IOError when reading files from SD card
Hi, I just figure out that there is a ‘slight’ difference when reading files from the flash or from the SD card.
Version: master (6/16/2019)
File generation (copied to the flash and to the SD card
time dd if=/dev/urandom of=test.dat bs=1 count=1M
Code:
import sys
import os
import adafruit_sdcard
import board
import busio
import digitalio
import storage
# Connect to the card and mount the filesystem.
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
cs = digitalio.DigitalInOut(board.SD_CS)
sdcard = adafruit_sdcard.SDCard(spi, cs)
vfs = storage.VfsFat(sdcard)
storage.mount(vfs, "/sd")
sys.path.append("/sd")
os.chdir("/sd")
buf = bytearray(160*128)
f = open('test.dat', 'rb')
f.readinto(buf)
f.close()
Results on the SD card:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 5] Input/output error
works well from the flash.
os.listdir()
works, files located on the SD card are shown
Any idea when I can check ? Libraries ?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (1 by maintainers)
So I tested on 3 more micro SD cards:
Read speed and Access time are measured with gnome-disk Benchmark tool
I did not expect the cheap slow card to be the only one working 😄