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

Clear serial error flags after reading them #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

TheZoq2
Copy link

@TheZoq2 TheZoq2 commented Feb 14, 2018

The current implementaion does not clear the error bits in the ISR register when running Rx.read(). This means that after an error has occured, all future reads will return the same error. The bits can be reset by writing to the ICR register which is what this patch does.

I'm a bit sceptical of the unsafe blocks, but they seem required as the Rx struct only contains a pointer to the USARTx registers.

I can also see this being implemented as a separate clear function which resets all error flags independently of read but I believe that would require modifying the embedded-hal crate, right?

@TheZoq2
Copy link
Author

TheZoq2 commented Feb 15, 2018

I made another update to this which always reads the content of the data register, even if an error occured. Without this, the next read would return the data that was sent after the error rather than no data at all.

However, im unsure wether it is safe to read data even if there are error flags. I have only tested it with overrrun errors.

@eeeeeta
Copy link

eeeeeta commented Oct 17, 2018

I just ran into this issue today when trying to use the USART; any update on how close this PR is to getting merged?

@TheZoq2
Copy link
Author

TheZoq2 commented Oct 17, 2018

Unfortunately for us, I believe @japaric is a bit inactive in this crate since he's working on more general embedded-wg things

little-arhat added a commit to copterust/alt-stm32f30x-hal that referenced this pull request Feb 16, 2019
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