espressif / esp-usb

Other
15 stars 9 forks source link

esp_tinyusb: Adding bvalid_signal test #10

Closed roma-jam closed 4 months ago

roma-jam commented 4 months ago

esp_tinyusb v1.4.4

NOT A RELEASE

Change description

Details

USB Device events, such as attach (plug) and detach (unplug) are detected via bvalid_signal, which can be connected to any (*mostly) external PIN. (In the most common cases, this external PIN connected to VBUS USB via resistor divider to detect the VBUS power presence. For reference, check Self-Powered Device)

When USB Device (self-powered) is attached to the USB Host, the VBUS becomes High. When USB Device (self-powered) is detached from the USB Host, the VBUS becomes Low. Both of attach and detach, trigger the dcd_dwc2 layer interrupt with DCD_EVENT_UNPLUGGED event.

Current test implement the USB Device without any interface and connect the bvalid_signal to the High or Low signal source to emulate the VBUS presence/absence. For smoke testing, 10 iterates is enough to see that logic is working. For load testing, please, change the parameter DEVICE_DETACH_TEST_ROUNDS in test_bvalid_sig.c.

Important notice

Without changes in https://github.com/espressif/tinyusb/pull/19 the test doesn't work.