Thanks to visit codestin.com
Credit goes to github.com

Skip to content

rp2/mphalport: Run TinyUSB stack while waiting for CDC input/output. #12926

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

Conversation

dpgeorge
Copy link
Member

@dpgeorge dpgeorge commented Nov 9, 2023

The recent change in bcbdee2 meant that TinyUSB can no longer be run from within a soft (or hard) IRQ handler, ie when the scheduler is locked. That means that Python code that calls print(...) from within a scheduled function may block indefinitely if the USB CDC buffers are full.

This commit fixes that problem by explicitly running the TinyUSB stack when waiting within stdio tx/rx functions.

@projectgus
Copy link
Contributor

This LGTM, sorry I missed this situation when testing the new TinyUSB code.

(Adding a link back to #12846 for future reference.)

Copy link

codecov bot commented Nov 9, 2023

Codecov Report

Merging #12926 (ddf737c) into master (3659139) will not change coverage.
The diff coverage is n/a.

❗ Current head ddf737c differs from pull request most recent head a00c9d5. Consider uploading reports for the commit a00c9d5 to get more accurate results

@@           Coverage Diff           @@
##           master   #12926   +/-   ##
=======================================
  Coverage   98.43%   98.43%           
=======================================
  Files         158      158           
  Lines       20978    20978           
=======================================
  Hits        20649    20649           
  Misses        329      329           

@dpgeorge dpgeorge force-pushed the rp2-fix-blocking-usb-cdc-output branch from ddf737c to 8b25480 Compare November 9, 2023 06:56
The recent change in bcbdee2 means that
TinyUSB can no longer be run from within a soft (or hard) IRQ handler, ie
when the scheduler is locked.  That means that Python code that calls
`print(...)` from within a scheduled function may block indefinitely if the
USB CDC buffers are full.

This commit fixes that problem by explicitly running the TinyUSB stack when
waiting within stdio tx/rx functions.

Signed-off-by: Damien George <[email protected]>
@dpgeorge dpgeorge force-pushed the rp2-fix-blocking-usb-cdc-output branch from 8b25480 to a00c9d5 Compare November 9, 2023 06:57
@dpgeorge dpgeorge merged commit a00c9d5 into micropython:master Nov 9, 2023
@dpgeorge dpgeorge deleted the rp2-fix-blocking-usb-cdc-output branch November 9, 2023 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants