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.
This post is deleted!
Hello Robert, I used the example SD code where I see it call the mount statement.
from machine import SD
sd = SD()
f = open('/sd/test.txt', 'w')
f.write('Testing SD card write operations')
f = open('/sd/test.txt', 'r')
@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 126.96.36.199 SD
I wonder how you managed to write to the SD card w/o mounting it?
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 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.