Accessing SD cards
Re: Accessing SD cards
The sdcard driver included in MicroPython's tree now works both on PyBoard and on the ESP8266. See the example on how to use it. https://github.com/micropython/micropyt ... /sdcard.py
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Accessing SD cards
Excellent! That is seriously useful
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
-
- Posts: 81
- Joined: Fri Sep 02, 2016 9:26 am
Re: Accessing SD cards
[quote="deshipu"]So, to answer my own question, yes, it is possible. I just did it.
First, you need to comment out the mounting of the filesystem in the modules/_boot.py
Then you need to import the sdcard code (from https://bitbucket.org/thesheep/micropyt ... /sdcard.py) and run the esp8266_mount function from it.
Then you can use the sd card as your storage.[/quote]
Hi,
where is this modules/_boot.py located?
Thanks,
First, you need to comment out the mounting of the filesystem in the modules/_boot.py
Then you need to import the sdcard code (from https://bitbucket.org/thesheep/micropyt ... /sdcard.py) and run the esp8266_mount function from it.
Then you can use the sd card as your storage.[/quote]
Hi,
where is this modules/_boot.py located?
Thanks,
Re: Accessing SD cards
It's located in https://github.com/micropython/micropyt ... 66/modules.ajie_dirgantara wrote: where is this modules/_boot.py located?
Is it necessary to prevent the filesystem mount at boot with the micropython's sdcard.py driver? You should be able to just use the driver without the need to modify the _boot.py file.
Re: Accessing SD cards
Yes, it's no longer necessary to edit your _boot.py, you as you can now unmount the filesystem.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Accessing SD cards
Is it in the roadmap to support multiple mounted filesystems as per the Pyboard?
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: Accessing SD cards
As far as I know that's the plan eventually, but some considerable cleanup of the related code needs to happen first, see https://github.com/micropython/micropython/pull/2140 for some discussion.
Re: Accessing SD cards
Hi! Thanks for all the great info. I have been able to use the module to successfully read the SD card from my Wemos D1 Mini SD Card shield.
All I really had to change was to use machine.SPI(1) instead of machine.SPI(0) and then I was able to remount to the SD card.
I had a couple of questions though...
1) How do I change the mount back to the original file system (SPIFFS I guess?). and
2) To what extent does the sdcard.py support Long File Names? I see them is my directory listing, so can I open them and manipulate them as normal?
Thanks!
All I really had to change was to use machine.SPI(1) instead of machine.SPI(0) and then I was able to remount to the SD card.
I had a couple of questions though...
1) How do I change the mount back to the original file system (SPIFFS I guess?). and
2) To what extent does the sdcard.py support Long File Names? I see them is my directory listing, so can I open them and manipulate them as normal?
Thanks!
Re: Accessing SD cards
You can see how your _boot.py mounts the internal filesystem on startup: https://github.com/micropython/micropyt ... t.py#L4-L8 and do the same thing.
As for your second question, I honestly have no idea.
As for your second question, I honestly have no idea.
Re: Accessing SD cards
[quote="deshipu"]You can see how your _boot.py mounts the internal filesystem on startup.[/quote]
I'm sorry, where would I find _boot.py?
I'm new to Python as well, so it may be something basic I am missing.
I'm sorry, where would I find _boot.py?
I'm new to Python as well, so it may be something basic I am missing.