Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SD card instructions do not work with latest os module #3622

Closed
skorokithakis opened this issue Feb 16, 2018 · 5 comments

Comments

Projects
None yet
2 participants
@skorokithakis
Copy link

commented Feb 16, 2018

The SD card instructions in the sdcard.py file for the ESP8266 seem out of date. os.umount takes one argument and os.VfsFat takes one two, but I can't figure out which ones they are. There's nothing about either object in the docs, and I can't find the VfsFat in the source either.

@dpgeorge

This comment has been minimized.

Copy link
Member

commented Feb 16, 2018

Yes those instructions are quite dated. It should be something like:

sd = ...
os.umount('/')
os.mount(sd, '/')
os.listdir()

If that works for you then we can update the text.

@skorokithakis

This comment has been minimized.

Copy link
Author

commented Feb 16, 2018

Unfortunately it doesn't :/ I tried this:

import machine, sdcard, os
spi = machine.SPI(1)
sd = sdcard.SDCard(spi, machine.Pin(15))
os.umount("/")
vfs = os.VfsFat(sd)
os.mount(vfs, "/")
os.listdir("/")

and this:

import machine, sdcard, os
spi = machine.SPI(1)
sd = sdcard.SDCard(spi, machine.Pin(15))
os.umount("/")
os.mount(sd, "/")
os.listdir("/")

but I get an exception after each mount step:

Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
OSError: [Errno 19] ENODEV

My SD card (and SD object) works fine, I can get the sector count, read data, etc.

@skorokithakis

This comment has been minimized.

Copy link
Author

commented Feb 16, 2018

@dpgeorge Do you know if it would be easier to get this working with an ESP32, perhaps? I don't know how the SD card support is there.

@skorokithakis

This comment has been minimized.

Copy link
Author

commented Feb 16, 2018

Actually, that code worked, it was my SD card that was the problem. Thank you!

@dpgeorge

This comment has been minimized.

Copy link
Member

commented Feb 18, 2018

Ok, good that it works. I updated the driver comment in 3759aa2 (it's a bit different to what I wrote above).

Do you know if it would be easier to get this working with an ESP32, perhaps?

The same code should work on the ESP32.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.