-
Notifications
You must be signed in to change notification settings - Fork 7.3k
drivers: serial: nrfx_uarte: Add workaround for FRAMETIMEOUT corner case #85392
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
base: main
Are you sure you want to change the base?
drivers: serial: nrfx_uarte: Add workaround for FRAMETIMEOUT corner case #85392
Conversation
@anangl can you take a look? |
@@ -1611,6 +1649,12 @@ static void rxto_isr(const struct device *dev) | |||
struct uarte_nrfx_data *data = dev->data; | |||
struct uarte_async_rx *async_rx = &data->async->rx; | |||
|
|||
if (IS_ENABLED(RX_FRAMETIMEOUT_WORKAROUND)) { | |||
if (atomic_test_and_clear_bit(&data->flags, UARTE_FLAG_FTIMEOUT_WATCH)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (atomic_test_and_clear_bit(&data->flags, UARTE_FLAG_FTIMEOUT_WATCH)) { | |
if (atomic_test_and_clear_bit(&data->flags, UARTE_FLAG_FTIMEOUT_WATCH_BIT)) { |
But perhaps it would be better, for consistency with other flags, to not use UARTE_FLAG_FTIMEOUT_WATCH_BIT
at all, just UARTE_FLAG_FTIMEOUT_WATCH
and atomic_and()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
When reception is restarted (STARTRX after ENDRX but no STOPRX) it is possible that FRAMETIMEOUT countdown counter will not be started by the first received byte if byte was already being transmitted when STARTRX was called. If that is the only byte then it is expected that timeout will be triggered but since FRAMETIMEOUT counter is not started there is no FRAMETIMEOUT event which has short to STOPRX. This situation will happen in case short buffers are used (< 5 bytes) because then short ENDRX_STARTRX is not used then. Signed-off-by: Krzysztof Chruściński <[email protected]>
4caae37
to
f76b9f8
Compare
@anangl can you take another look? |
When reception is restarted (STARTRX after ENDRX but no STOPRX) it is possible that FRAMETIMEOUT countdown counter will not be started by the first received byte if byte was already being transmitted when STARTRX was called. If that is the only byte then it is expected that timeout will be triggered but since FRAMETIMEOUT counter is not started there is no FRAMETIMEOUT event which has short to STOPRX. This situation will happen in case short buffers are used (< 5 bytes) because then short ENDRX_STARTRX is not used then.