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: BufferedUartRx embedded_hal_nb::serial::Read impl #3915

Merged
merged 3 commits into from
Feb 24, 2025

Conversation

CL137
Copy link

@CL137 CL137 commented Feb 24, 2025

This fixes the following issue: #3883

The function was tested and works as expected (in our case at least)

Ok(data)
} else {
if state.rx_buf.is_full() {
self.info.interrupt.pend();
Copy link
Member

Choose a reason for hiding this comment

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

why pend if full? this would create an interrupt storm.

it should be the other way: in the Ok branch, if the ringbuffer was full and thanks to this read it stops being full we have to pend the irq to kickstart reading bytes again.

let full = state.rx_buf.is_full();
rx_reader.pop_done(amt);
if full {
self.info.interrupt.pend();
}

Copy link
Author

Choose a reason for hiding this comment

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

Yes you are right, I fixed it. The rx_buf full check is done before marking the byte as read.

Copy link
Member

@Dirbaio Dirbaio left a comment

Choose a reason for hiding this comment

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

thanks!

@Dirbaio Dirbaio added this pull request to the merge queue Feb 24, 2025
Merged via the queue into embassy-rs:main with commit 00ef474 Feb 24, 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