Skip to content
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

Fix STM32 UART: Add separate TX waker and only clear idle flag in RingBufferedUartRx #3930

Merged
merged 6 commits into from
Mar 6, 2025

Conversation

meowcakes
Copy link
Contributor

@meowcakes meowcakes commented Feb 28, 2025

This resolves an issue whereby one is unable to use a UartTx and a RingBufferedUartRx in parallel in separate tasks.

Firstly, it changes clear_idle_flag to ONLY clear the idle flag as the name suggests it should. Currently, it clears ALL set flags including TC which is checked by UartTx::flush. If the TX and RX are being used in parallel, it is possible for the RX to clear the TC flag before the TX can check it, which causes UartTx::flush to hang forever.

Secondly, it adds a separate tx_waker, otherwise when TX and RX are used in parallel they contend for the currently lone rx_waker and can overwrite each others wakers, causing hanging.

@meowcakes meowcakes marked this pull request as draft February 28, 2025 01:38
@meowcakes meowcakes marked this pull request as ready for review February 28, 2025 01:57
Copy link
Member

@lulf lulf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, looks good to me.

@lulf lulf added this pull request to the merge queue Mar 6, 2025
Merged via the queue into embassy-rs:main with commit d378dca Mar 6, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants