Closed hongquan-prog closed 12 months ago
@hongquan-prog For a self-powered USB device, the VBUS monitor must be enabled. please refer the docs
@hongquan-prog For a self-powered USB device, the VBUS monitor must be enabled. please refer the docs
Thank you very much for your help, I didn't consider making a standalone powered device at first, I just added a serial port, which will still power the esp32 when the USB is unplugged!
Answers checklist.
Which component are you using? If you choose Other, provide details in More Information.
usb
ESP-IDF version.
ESP-IDF v5.1.1-233-gf0437b945f
Development Kit.
Custom
Used Component version.
espressif/esp_tinyusb: 1.4.0 espressif/tinyusb:0.14.3
More Information.
I did this by adding a print filesystem mount path to the code, and when the USB cable was removed from the computer, the mount path became a null pointer and had to be remounted manually for it to work.the serial output is as follows:
By printing I also found that tud_umount_cb is not called after I unplugged the usb, the event type triggered after unplugging the usb is DCD_EVENT_SUSPEND, not DCD_EVENT_UNPLUGGED.