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 disconnection detection issue #564

Open
hathach opened this issue Nov 27, 2020 · 4 comments
Open

ESP32-S2 disconnection detection issue #564

hathach opened this issue Nov 27, 2020 · 4 comments

Comments

@hathach
Copy link
Owner

hathach commented Nov 27, 2020

Set up

  • PC OS : Ubuntu 20.04
  • Board : Saola
  • Firmware: examples/device/cdc_msc_freertos

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

  1. Run example with esp32s2 saola board with CFG_TUSB_DEBUG = 2
  2. Disconnect the usb connection while keeping the cp210x connection
  3. See error

Log
Log from idf.py monitor

USBD Xfer Complete on EP 80 with 64 bytes
  Queue EP 80 with 16 bytes
USBD Xfer Complete on EP 80 with 16 bytes
  HID control complete
  Queue EP 00 with zlp Status
USBD Xfer Complete on EP 00 with 0 bytes
USBD Suspend 
USBD Suspend 
USBD Suspend 
USBD Suspend 
USBD Suspend 
USBD Suspend 
USBD Suspend 
USBD Suspend 
USBD Suspend 
USBD Suspend 
USBD Suspend 
USBD Suspend 

@dhalbert suspended and disconnected are not fully supported on all ports, may need a bit of time for overall testing later on :)

@tore-espressif
Copy link
Contributor

@hathach
Copy link
Owner Author

hathach commented Nov 17, 2022

thank you @tore-espressif for the update, I will check this out next time I need to work on this issue.

@hathach hathach moved this to 🆕 New in TinyUSB Mar 9, 2023
@hathach hathach added this to TinyUSB Mar 9, 2023
@gecko242
Copy link

gecko242 commented Oct 3, 2023

Hey @hathach! Any news on this issue?

Thanks :)

@hathach
Copy link
Owner Author

hathach commented Oct 4, 2023

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

slaff pushed a commit to SmingHub/Sming that referenced this issue Dec 13, 2024
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🆕 New
Development

No branches or pull requests

3 participants