Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nordic-krch
Copy link
Collaborator

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.

@zephyrbot zephyrbot added platform: nRF Nordic nRFx area: UART Universal Asynchronous Receiver-Transmitter labels Feb 7, 2025
@nordic-krch
Copy link
Collaborator Author

@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)) {
Copy link
Member

@anangl anangl Mar 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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().

Copy link
Collaborator Author

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]>
@nordic-krch
Copy link
Collaborator Author

@anangl can you take another look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: UART Universal Asynchronous Receiver-Transmitter platform: nRF Nordic nRFx
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants