Open emard opened 3 years ago
We don't support the SD card over USB. The USB Mass Storage protocol works on the blocks below the filesystem. So, we'd need to expose the SD card as a second drive (logical unit in USB parlance). It would have the same read/write constraints as the internal flash.
OK, let SD-over-USB be a feature request, it's ok for me to appear as another drive.
Intuitively, I have expected this to "just work".
Now I need to first upload file from USB to internal flash, write my own copy.py application, upload it too, then enter python prompt and finally copy this file from flash to SD.
On 9/28/20, Scott Shawcroft notifications@github.com wrote:
We don't support the SD card over USB. The USB Mass Storage protocol works on the blocks below the filesystem. So, we'd need to expose the SD card as a second drive (logical unit in USB parlance). It would have the same read/write constraints as the internal flash.
-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/adafruit/circuitpython/issues/3477#issuecomment-699738273
Can you provide some boot or commandline option for usb-storage to be directed towards SD card instead of internal flash?
Can you provide some boot or commandline option for usb-storage to be directed towards SD card instead of internal flash?
It's not a high priority for us and it's not simple. The native sdcard support is a good start though.
@tannewt I asked about this yesterday in the deep dive chat.
From the discussion here https://github.com/adafruit/circuitpython/issues/2206 with @dhalbert I thought the new CP7 USB endpoint customisation might make this easier.
But sounds like there is another subtlety that makes it tricky. Appreciate it isn't high priority just now.
From the discussion here #2206 with @dhalbert I thought the new CP7 USB endpoint customisation might make this easier.
It doesn't really help that much, though the internal structure makes it a bit easier to add another MSC device. But there still has to be code behind that to make the SD card visible, and that's not easy.
Newbie question. Was hoping to connect this like a USB memory stick, write jpeg files from the PC and have those changes trigger the posting of file names and sizes to a remote server. Is this possible? Perhaps with some onboard program that might, for example, switch connection of the SD card back and forth between the unit and the PC so the card could take a peek at the new files? Or completely impossible given the current specs? Thanks.
See #2206 and #1764 for why this is hard.
For transferring text files to and from the SD card, you can use Thonny
(and maybe other editors, eg Mu
, but I haven't tried)
Once code.py
has run and mounted the SD card, the /sd/
directory shows up when you try to read or write a file to the CircuitPython device. I don't understand how it actually works but it does.
I don't think this can be used for transferring binary files but someone might be able to figure out something.
See #2206 and #1764 for why this is hard.
A newer comment in #2206 says:
This is not an issue with endpoint count. USB MSC can have multiple drives over the same endpoints by using a logical unit (LUN) index.
Is implementing this the hard part? If so, could you please add the option to show the SD card instead of the usual CIRCUITPY filesystem?
For example, boot.py
could mount the SD card and read some file from it that says whether the SD card should be shown to the computer instead of the usual CIRCUITPY.
Giving the computer easy access to the SD card (which is by far the largest storage of the device) seems kind of important. :) Thanks!
We are working on making multiple drives available. There are some issues about making it work properly on all operating systems, which we're working through.
That's great, thank you! Looking forward to the Windows solution :sweat_smile:
just submit an PR for this #6555
Recent ESP32-S2 release can mount SD card, after setting pinout and SPI, this works storage.mount(vfs, "/sd") os.listdir("/sd") lists files stored on the SD card. ['KERNEL.SYS', 'COMMAND.COM', 'INVADERS.COM', etc..
Now I want to copy a file from PC to the mounted SD card but linux PC usb-storage interface doesn't "see" mounted "/sd" directory
cp README.md /media/guest/CIRCUITPY/sd/ cp: cannot create regular file '/media/guest/CIRCUITPY/sd/': Not a directory