From ed5ce47437bb2de8814375d41b38db3a5a175379 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 6 Nov 2024 08:05:22 +0100 Subject: [PATCH] drivers: serial: nrfx_uarte: Fix RX path without low power modes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RX FIFO flushing on RXTO event should only be performed when UARTE peripheral might be disable during inactivity and that happens when low power modes is enabled or when device runtime PM is used. Flushing was incrementing flush_cnt which was not used (flushed data is not copied to the next buffer) which was causing data loss and invalid RX data length reporting. Signed-off-by: Krzysztof Chruściński --- drivers/serial/uart_nrfx_uarte.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index e1af63b7993..452307acaa8 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -1521,7 +1521,7 @@ static void rxto_isr(const struct device *dev) async_rx->total_user_byte_cnt += rx_flush(dev); } #endif - } else { + } else if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) || LOW_POWER_ENABLED(config)) { async_rx->flush_cnt = rx_flush(dev); }