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

ESP32-S2 mounted SD not accessible from PC? #3477

Open
emard opened this issue Sep 26, 2020 · 13 comments
Open

ESP32-S2 mounted SD not accessible from PC? #3477

emard opened this issue Sep 26, 2020 · 13 comments

Comments

@emard
Copy link

emard commented Sep 26, 2020

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

@tannewt
Copy link
Member

tannewt commented Sep 28, 2020

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.

@emard
Copy link
Author

emard commented Sep 28, 2020 via email

@emard
Copy link
Author

emard commented Dec 23, 2020

Can you provide some boot or commandline option
for usb-storage to be directed towards SD card instead
of internal flash?

@tannewt
Copy link
Member

tannewt commented Dec 23, 2020

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.

@calcut
Copy link

calcut commented Jun 26, 2021

@tannewt I asked about this yesterday in the deep dive chat.

From the discussion here #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.

@dhalbert
Copy link
Collaborator

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.

@Paul-iKarma
Copy link

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.

@dhalbert
Copy link
Collaborator

dhalbert commented Aug 2, 2021

See #2206 and #1764 for why this is hard.

@lesamouraipourpre
Copy link

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.

@rgbpcb
Copy link

rgbpcb commented Jul 3, 2022

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!

@dhalbert
Copy link
Collaborator

dhalbert commented Jul 3, 2022

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.

@rgbpcb
Copy link

rgbpcb commented Jul 3, 2022

That's great, thank you! Looking forward to the Windows solution 😅

@hathach
Copy link
Member

hathach commented Jul 4, 2022

just submit an PR for this #6555

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants