Skip to content

temporarily walkaround for tinyusb init for v4.2 #7

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

Merged
merged 1 commit into from
Mar 31, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions cores/esp32/esp32-hal-tinyusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,11 +536,22 @@ esp_err_t tinyusb_init(tinyusb_device_config_t *config) {
tinyusb_config_t tusb_cfg = {
.external_phy = false // In the most cases you need to use a `false` value
};

esp_err_t err = tinyusb_driver_install(&tusb_cfg);

#if 1 // walkaround for v4.2 tinyusb init bug
// Note: IDF v4.2 has a bug that incorrectly check the tusb_init() returned value (bool instead of error code)
// https://github.com/espressif/esp-idf/blob/release/v4.2/components/tinyusb/port/esp32s2/src/tinyusb.c#L89
// This is due to a internal bug of tinyusb stack which is fixed recently.
// This is fixed in IDF v4.3 and should be reverted when 4.3 is released
err = ESP_OK;
#endif

if (err != ESP_OK) {
initialized = false;
return err;
}

xTaskCreate(usb_device_task, "usbd", 4096, NULL, configMAX_PRIORITIES - 1, NULL);
return err;
}
Expand Down