-
Notifications
You must be signed in to change notification settings - Fork 35
fix(esp_tinyusb): VBUS monitoring feature on ESP32-P4, USB OTG 2.0 v4.30a #313
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
base: feature/vbus_monitor_esp32p4_part2
Are you sure you want to change the base?
fix(esp_tinyusb): VBUS monitoring feature on ESP32-P4, USB OTG 2.0 v4.30a #313
Conversation
a60a09a to
82702bb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a workaround for VBUS monitoring on ESP32-P4 ECO5 (USB OTG 2.0 v4.30a), where hardware-based BValid override is not available. The solution introduces conditional compilation to handle different chip revisions and uses direct application layer notification as a fallback mechanism.
Key Changes:
- Added conditional support for BValid override based on ESP32-P4 chip revision
- Implemented workaround using
tinyusb_device_detached()for newer revisions lacking hardware support - Refactored TinyUSB callbacks to use new attach/detach notification functions
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| device/esp_tinyusb/tinyusb_vbus_monitor.c | Added conditional compilation for BValid override support and workaround for ECO5 |
| device/esp_tinyusb/tinyusb.c | Refactored mount/unmount callbacks to use new attach/detach notification functions |
| device/esp_tinyusb/test_apps/vbus_monitor/main/test_vbus_monitor.c | Updated test to handle suspend events during attach/detach sequences |
| device/esp_tinyusb/include_private/tinyusb_vbus_monitor.h | Updated documentation for init function error codes |
| device/esp_tinyusb/include_private/tinyusb_device.h | New header declaring device detach notification function |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
device/esp_tinyusb/test_apps/vbus_monitor/main/test_vbus_monitor.c
Outdated
Show resolved
Hide resolved
82702bb to
88e2689
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
device/esp_tinyusb/test_apps/vbus_monitor/main/test_vbus_monitor.c
Outdated
Show resolved
Hide resolved
88e2689 to
f156c98
Compare
f156c98 to
15bec5d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
device/esp_tinyusb/test_apps/vbus_monitor/main/test_vbus_monitor.c
Outdated
Show resolved
Hide resolved
15bec5d to
ee8e16a
Compare
…lated verification of vbus monitor logic - Added handling for tud_suspend_cb() to verify the sequence of callbacks during attach/detach - Updated test case of emulated vbus handling for ESP32-P4 (ECO5) USB OTG 2.0, v4.30a (by adding emulated DETACH event and driving DCTL register)
8750b74 to
11d6c03
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…v4.30a - Added the callback to vbus_monitor - Applied workaround fix to replace the UNPLUG event with direct notification for USB OTG 2.0 v4.30a
11d6c03 to
4988969
Compare
|
Hi this one is ready, PTAL. |
Description
Added the vbus monitor state change callback to
vbus_monitormodule.This callback is used to workaround the absence of UNPLUG event in tinyusb, because:
VBUSVALID,SRP_BVALID,SESSEND: these signals are not availableUSB_SRP_BVALID_IN_IDXcannot be connected to GPIO via matrixThus, based on the VBUS IO state (in our case only relevant for DETACHED event), we notify the upper layer.
Limitation
Related
Testing
Verified local test
vbus_monitor(all scenarios) on:Additional testing
esp-idf/examples/peripherals/usb/device/tusb_mscwithself_poweredflag (device attached/detached by the power button on the external hub, connected to the Laptop)esp-idf/examples/peripherals/usb/device/tusb_mscwithself_poweredflag (device attached/detached by the power button on the external hub, connected to the Laptop)Checklist
Before submitting a Pull Request, please ensure the following: