shared/tinyusb/mp_usbd_cdc: Fix short CDC TX timeouts.#15339
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #15339 +/- ##
=======================================
Coverage 98.42% 98.42%
=======================================
Files 161 161
Lines 21249 21249
=======================================
Hits 20915 20915
Misses 334 334 ☔ View full report in Codecov by Sentry. |
|
Ah that makes sense, thanks the fix looks good to me! |
|
Code size report: |
|
I do not know if that was the intention, but it does not change the odd behavior which I brought up in the discussion PR #15158 and to which @projectgus referred in issue #15298. |
No I wouldn't expect this to affect / help with that one. |
|
LGTM! |
The `mp_event_wait_ms()` function may return earlier than the requested timeout, and if that happens repeatedly (eg due to lots of USB data and IRQs) then the loop waiting for CDC TX FIFO space to become available may exit much earlier than MICROPY_HW_USB_CDC_TX_TIMEOUT, even when there is no space. Fix this by using `mp_hal_ticks_ms()` to compute a more accurate timeout. The `basics/int_big_mul.py` test fails on RPI_PICO without this fix. Signed-off-by: Damien George <[email protected]>
0129368 to
880f7bc
Compare
The
mp_event_wait_ms()function may return earlier than the requested timeout, and if that happens repeatedly (eg due to lots of USB data and IRQs) then the loop waiting for CDC TX FIFO space to become available may exit much earlier than MICROPY_HW_USB_CDC_TX_TIMEOUT, even when there is no space.Fix this by using
mp_hal_ticks_ms()to compute a more accurate timeout.The
basics/int_big_mul.pytest fails on RPI_PICO without this fix.