ports/rp2/machine_uart.c: fix handling of serial break condition#12787
Merged
dpgeorge merged 1 commit intomicropython:masterfrom Nov 3, 2023
Merged
ports/rp2/machine_uart.c: fix handling of serial break condition#12787dpgeorge merged 1 commit intomicropython:masterfrom
dpgeorge merged 1 commit intomicropython:masterfrom
Conversation
154f3f2 to
20e6592
Compare
robert-hh
reviewed
Oct 24, 2023
Contributor
Author
|
@robert-hh are there issues that need to be addressed? |
Contributor
|
You have to wait, until the maintainer has time for it. That may take a while. |
The FIFO reports not only the bytes read, but also 4 error bits. These were not checked, leading to NUL value read in case of break and possible garbage bytes being written on parity/framing error. This patch addresses the issue that NUL bytes are incorrectly read on break, and at least provides the boilerplate code and comments for error handling, that may be implemented in the future. Signed-off-by: Maarten van der Schrieck <maarten@thingsconnected.nl>
Member
|
This looks good to me. A break condition on the UART line is definitely not the same as a NUL character, so the break should be handled differently. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The FIFO reports not only the bytes read, but also 4 error bits. These were not checked, leading to NUL value read in case of break and possible garbage bytes being written on parity/framing error.
This patch addresses the issue that NUL bytes are incorrectly read on break, and at least provides the boilerplate code and comments for error handling, that may be implemented in the future. This patch only addresses the rp2 port, but it is likely other ports are also affected by this bug. I am willing to look into that once this PR is accepted.
Note that there are interesting things that can be done with break conditions (e.g. automatically splitting read data on them and/or signalling break to data consuming code), but the first thing is to have at least these error flags checked.