-
-
Notifications
You must be signed in to change notification settings - Fork 345
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add USB host support for esp32s2(s3), support OTG dual-mode (#2922)
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.
- Loading branch information
Showing
4 changed files
with
11 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule USB
updated
23 files
+0 −4 | README.rst | |
+4 −2 | component.mk | |
+5 −1 | samples/Basic_Device/app/application.cpp | |
+24 −24 | samples/Basic_Device/basic_device.usbcfg | |
+3 −3 | samples/Basic_Host/app/application.cpp | |
+1 −1 | samples/Basic_Host/component.mk | |
+1 −1 | samples/CDC_MSC_HID_Host/app/application.cpp | |
+1 −1 | samples/HID_Composite_Device/app/application.cpp | |
+17 −47 | src/Arch/Esp32/init.cpp | |
+2 −1 | src/Arch/Host/init.cpp | |
+2 −1 | src/Arch/Rp2040/init.cpp | |
+68 −15 | src/USB.cpp | |
+14 −1 | src/USB.h | |
+10 −6 | src/USB/CDC/Device.cpp | |
+2 −2 | src/USB/CDC/Device.h | |
+2 −1 | src/USB/CDC/UsbSerial.cpp | |
+1 −0 | src/USB/CDC/UsbSerial.h | |
+38 −0 | src/USB/Descriptors.cpp | |
+2 −1 | src/USB/MSC/Device.cpp | |
+6 −0 | src/USB/VENDOR/xbox.cpp | |
+0 −0 | src/USB/VENDOR/xbox.h | |
+1 −1 | tinyusb | |
+198 −26 | tinyusb.patch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters