Skip to content

Commit c80589a

Browse files
ananglnashif
authored andcommitted
drivers: uart_nrfx_uarte: Fix RX auto disabling routine
This is a follow-up to commit 11bbdb0. When RX is automatically disabled because all provided RX buffers have been filled up, the rx_enabled flag needs to be cleared, otherwise it will be impossible to enable RX again. Signed-off-by: Andrzej Głąbek <[email protected]>
1 parent 956d49a commit c80589a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

drivers/serial/uart_nrfx_uarte.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1330,7 +1330,16 @@ static void rxto_isr(const struct device *dev)
13301330
notify_rx_buf_release(dev, &data->async->rx_buf, true);
13311331
notify_rx_buf_release(dev, &data->async->rx_next_buf, true);
13321332

1333-
if (!data->async->rx_enabled) {
1333+
/* If the rx_enabled flag is still set at this point, it means that
1334+
* RX is being disabled because all provided RX buffers have been
1335+
* filled up. Clear the flag then, so that RX can be enabled again.
1336+
*
1337+
* If the flag is already cleared, it means that RX was aborted by
1338+
* a call to uart_rx_disable() and data from FIFO should be discarded.
1339+
*/
1340+
if (data->async->rx_enabled) {
1341+
data->async->rx_enabled = false;
1342+
} else {
13341343
(void)rx_flush(dev, NULL, 0);
13351344
}
13361345

0 commit comments

Comments
 (0)