espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.38k stars 7.22k forks source link

USB MSC Device Example (IDFGH-10935) #12129

Closed Sotung96 closed 1 year ago

Sotung96 commented 1 year ago

Answers checklist.

General issue report

Hi all,

I have a project that I need to check the msc eject action. I'm trying to test the msc device example. I uesd the default code to test it but when I eject the msc in PC. There are nothing change. I still can't accesses the ESP MSC by application example. The states is "Storage exposed over USB". Do anyone know how to fix it? Thanks.

tore-espressif commented 1 year ago

Hello @Sotung96 , I assume that by 'eject' you mean 'disconnect'.

If you want to catch 'usb disconnect' events in your self-powered device, you must implement VBUS monitoring in your hardware. Please refer to this section of our docs : https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-reference/peripherals/usb_device.html#self-powered-device

You can also experiment with software 'eject' in windows: image

Clicking on 'Eject' in Windows should trigger the disconnect action in you application