espressif / idf-extra-components

Additional components for ESP-IDF, maintained by Espressif
147 stars 89 forks source link

Add a tinyusb_driver_uninstall to tinyusb.c (IEC-41) #229

Closed johnboiles closed 1 year ago

johnboiles commented 1 year ago

This makes it possible for user code to work around the bug where the USB/JTAG interface cannot be re-initialized after calling tinyusb_driver_install even if the chip is restarted with esp_restart (https://github.com/espressif/esp-idf/issues/9826#issuecomment-1694089147).

Currently user code cannot do this without a modification to tinyusb.c since there's no way to access static usb_phy_handle_t phy_hdl; outside of that file.

With this change, user code can run the following to deactivate TinyUSB and bring back the USB/JTAG interface.

tinyusb_driver_uninstall();
usb_phy_config_t phy_conf = {
    .controller = USB_PHY_CTRL_SERIAL_JTAG,
};
usb_phy_handle_t jtag_phy;
usb_new_phy(&phy_conf, &jtag_phy);
CLAassistant commented 1 year ago

CLA assistant check
All committers have signed the CLA.

tore-espressif commented 1 year ago

@johnboiles thank you very much for the PR, we will review ASAP

johnboiles commented 1 year ago

Done!

tore-espressif commented 1 year ago

Thank you very much @johnboiles ! Merged.

We will release new version of esp_tinyusb after we implement a quick fix for this issue: https://github.com/espressif/idf-extra-components/issues/217

johnboiles commented 1 year ago

Woohoo! Thanks @tore-espressif !