-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 disconnection detection issue #564
Comments
Hi @hathach we updated our documentation about disconnection events, PTAL: https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-reference/peripherals/usb_device.html#self-powered-device |
thank you @tore-espressif for the update, I will check this out next time I need to work on this issue. |
Hey @hathach! Any news on this issue? Thanks :) |
no, I still haven't got time for this yet. Though It is on my TODO list when I get back to work on dwc2 driver |
This PR updates the USB library to enable Host support for esp32s2 and s3 (untested). This is by switching ot the synopsis DWC2 driver. The basic CDC, HID and MSC interfaces work OK but isochronous are transfers not yet supported. (I'd like this for attaching a USB DAC.) In addition, the OTG hardware (for rp2040 and esp32s2) supports dual-mode operation and this PR allows the operation mode to be selected at run time. The application still needs to decide which mode is required: this can be as simple as connecting a GPIO input to the ID pin. Mode switching between two OTG hosts is more complex and involves session negotiation support which hasn't been investigated yet. **Disconnection events** The esp32s2 doesn't report when devices are disconnected in host mode. There's an open issue for this in tinyusb hathach/tinyusb#564. There's a reference to the IDF regarding [self-powered devices](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-reference/peripherals/usb_device.html#self-powered-device) which states that a separate GPIO is required to sense VBUS for disconnect events. A quick look at the IDF usb code suggests that it handles this using polling and a debounce timer. However, there is a separate disconnect interrupt which requires only a few lines of code to enable and seems to work reliably. Doubtless there will be further host improvements in the future but this is pretty functional as-is.
Set up
Describe the bug
ESP32-S2 currently doesn't detect disconnection event. Instead
Suspend
is detected as the side effect (since bus is idel > 3 ms). Worse, it detect suspend infinitely !!To reproduce
CFG_TUSB_DEBUG = 2
Log
Log from
idf.py monitor
@dhalbert suspended and disconnected are not fully supported on all ports, may need a bit of time for overall testing later on :)
The text was updated successfully, but these errors were encountered: