View contents of SD Card
-
I have a Lopy and expansion board. I'm using FileZilla to view/edit contents of the flash and want to know if I can also view/edit contents of the expansion board's SD card with FileZilla.
-
@JimT Once you have mounted the SD card from within the LoPy, you can see it's content by ftp under the name you used for mounting. You can add the statements for mounting to your boot.py script, like:
import os import machine sd = machine.SD() os.mount(sd, '/sd')In that case, the SD cards content would appear under /sd.
-
Thank you for your response. I will add these statements to the boot.py file. Where is the documentation which discusses this? I was able to write to the sd card without these statements but it will be great to see the results using fileZilla.
-
@JimT The SD card has to be mounted before you can access internally and externally. If you could write to it, that only means that somewhere in the code it was mounted. That does not have to be in boot.py. But since boot.py is always executed on boot, this is a good place to perform the mounting.
If you ask about documentation: for boot.py and main.py, look at the (very good) documentation https://docs.pycom.io/, chapter 1.5 or 2.5. The SD card set-up is documented in chapter 6.2.1.11 SD
I wonder how you managed to write to the SD card w/o mounting it? -
Hello Robert, I used the example SD code where I see it call the mount statement.
from machine import SD
import ossd = SD()
os.mount(sd, '/sd')
os.listdir('/sd')
f = open('/sd/test.txt', 'w')
f.write('Testing SD card write operations')
f.close()
f = open('/sd/test.txt', 'r')
f.readall()
f.close() -
This post is deleted!
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login