Hi there,
I've been trying really hard to sort out this error with wiring and looking at other forums but just cannot work it out.
This is the error message I get when using sdcard.py:
Traceback (most recent call last):
File "<stdin>", line 19, in <module>
File "sdcard.py", line 231, in readblocks
OSError: [Errno 5] EIO
And this is the code I am calling it from:
import machine
import sdcard, uos
import time
cs = machine.Pin(13, machine.Pin.OUT)
Intialize SPI peripheral (start with 1 MHz)
spi = machine.SPI(1,
baudrate=1000000,
polarity=0,
phase=0,
bits=8,
firstbit=machine.SPI.MSB,
sck=machine.Pin(14),
mosi=machine.Pin(15),
miso=machine.Pin(12))
sd = sdcard.SDCard(spi, cs)
time.sleep_ms(500)
vfs = uos.VfsFat(sd)
uos.mount(vfs, "/sd")
#uos.mount(sd, '/sd')
time.sleep_ms(500)
print(uos.listdir('/sd'))
If anyone could help that would be appreciated!
sdcard resets the SPI baudrate to 1320000 (default) so there's no point doing it in the SPI constructor.
If you want to change it do it here:-
I have set it to 20,000,000 and can read my sandisk ultra sdcard. See my issue #990 posted today.
I never got 25,000,000 to work, but that may just be my sdcard hdw.