Skip to content

Commit 3ec2e36

Browse files
projectgusdpgeorge
authored andcommitted
shared/tinyusb: Fix hang from new tx_overwritabe_if_not_connected flag.
This flag is in the main branch of TinyUSB, included in Espressif since their v0.18.0~3 component release (but it's not actually in TinyUSB v0.18.0 release). Setting the flag is needed for the USB device not to block waiting for space in the FIFO if the host is disconnected. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
1 parent 8d5a889 commit 3ec2e36

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

shared/tinyusb/mp_usbd.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,18 @@
4545
static inline void mp_usbd_init_tud(void) {
4646
tusb_init();
4747
#if MICROPY_HW_USB_CDC
48-
tud_cdc_configure_fifo_t cfg = { .rx_persistent = 0, .tx_persistent = 1 };
48+
tud_cdc_configure_fifo_t cfg = { .rx_persistent = 0,
49+
.tx_persistent = 1,
50+
51+
// This config flag is unreleased in TinyUSB >v0.18.0
52+
// but included in Espressif's TinyUSB component since v0.18.0~3
53+
//
54+
// Versioning issue reported as
55+
// https://github.com/espressif/esp-usb/issues/236
56+
#if TUSB_VERSION_NUMBER > 1800 || defined(ESP_PLATFORM)
57+
.tx_overwritabe_if_not_connected = 1,
58+
#endif
59+
};
4960
tud_cdc_configure_fifo(&cfg);
5061
#endif
5162
}

0 commit comments

Comments
 (0)