8000 stm32f4xx: handle usart overrun error by mattmart3 · Pull Request #3844 · tock/tock · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

stm32f4xx: handle usart overrun error #3844

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
merged 1 commit into from
Feb 16, 2024

Conversation

mattmart3
Copy link
Contributor

Pull Request Overview

This pull request adds an overrun error handler to the stm32f4xx usart driver. This avoids the usart driver to hang indefinitely upon an overrun error event.

Testing Strategy

Tested with a nucelo-f439zi by using the process console with default parameters. I noticed that after pressing the DEL key, the console was not responding anymore. This was due to an overrun error occurred after sending multiple characters to the console as the DEL key is an escape sequence. I could reproduce the same behavior by pasting a multiple characters string into the console (e.g. "hello123").

I am still not sure why the overrun occurs in this scenario, it would require further investigation. However, with the addition of the error handler the corresponding ReceiveClient, the MuxUart in this case, is notified and a new read is started. The effect on the process console is that some characters get skipped during overrun error events.

I could run other tests if anyone could point them out.

TODO or Help Wanted

I think a review is necessary since I am not yet very familiar with Tock. In particular, one thing I find odd is that the error gets notified to the MuxUart which however does not propagate it to the underlying process_console. This seems to happen because the read is not yet completed, so the call to device.received_buffer() is skipped and a new read is started. Is this a wanted behavior? Are there any other implications I am not seeing?

Documentation Updated

  • No updates are required.

Formatting

  • Ran make prepush.

Similarly to the stm32f303xc usart driver, the overrun error handler
clears the error flag, sets the rx_status back to Idle and notifies the
client. In this case, the ongoing DMA transfer is also aborted.
Furthermore, the tx complete handler is now executed only if the TC flag is
actually set, to avoid running it upon an error interrupt event.

This handler avoids the usart driver to hang indefinitely after an overrun
error occurs.
@github-actions github-actions bot added the stm32 Change pertains to the stm32 family of MCUSs label Feb 10, 2024
@bradjc
Copy link
Contributor
bradjc commented Feb 16, 2024

I've been thinking about your question, and I'm not sure I have a great answer. I think in general virtualizing any resource is hard, and it is complicated to determine what to expose and what not to expose. I can't actually remember if just restarting the error on behalf of the user is intentional, or just an implementation artifact.

@bradjc bradjc added this pull request to the merge queue Feb 16, 2024
Merged via the queue into tock:master with commit d2d124f Feb 16, 2024
@mattmart3 mattmart3 deleted the stm32f4-usart-overrun branch February 19, 2024 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stm32 Change pertains to the stm32 family of MCUSs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0