8000 shared/tinyusb/mp_usbd_cdc: Fix short CDC TX timeouts. by dpgeorge · Pull Request #15339 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content

shared/tinyusb/mp_usbd_cdc: Fix short CDC TX timeouts. #15339

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
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
4 changes: 2 additions & 2 deletions shared/tinyusb/mp_usbd_cdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ mp_uint_t mp_usbd_cdc_tx_strn(const char *str, mp_uint_t len) {
n = CFG_TUD_CDC_EP_BUFSIZE;
}
if (tud_cdc_connected()) {
int timeout = 0;
// If CDC port is connected but the buffer is full, wait for up to USC_CDC_TIMEOUT ms.
while (n > tud_cdc_write_available() && timeout++ < MICROPY_HW_USB_CDC_TX_TIMEOUT) {
mp_uint_t t0 = mp_hal_ticks_ms();
while (n > tud_cdc_write_available() && (mp_uint_t)(mp_hal_ticks_ms() - t0) < MICROPY_HW_USB_CDC_TX_TIMEOUT) {
mp_event_wait_ms(1);

// Explicitly run the USB stack as the scheduler may be locked (eg we
Expand Down
Loading
0