stm32f4xx: handle usart overrun error #3844
Merged
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.
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
Formatting
make prepush
.