From 11bbdb030def3b4a4b97ee380b1091913e61d371 Mon Sep 17 00:00:00 2001 From: Krzysztof Chruscinski Date: Wed, 22 Dec 2021 12:11:34 +0100 Subject: [PATCH] uart: nrfx_uarte: Return error when re-enabling RX Driver was not behaving according to API description and was not returning -EBUSY when uart_rx_enable() was called on already enabled receiver. Signed-off-by: Krzysztof Chruscinski --- drivers/serial/uart_nrfx_uarte.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 6a390deaee6..c662a7984a9 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -853,6 +853,10 @@ static int uarte_nrfx_rx_enable(const struct device *dev, uint8_t *buf, return -ENOTSUP; } + if (data->async->rx_enabled) { + return -EBUSY; + } + data->async->rx_timeout = timeout; /* Set minimum interval to 3 RTC ticks. 3 is used due to RTC limitation * which cannot set timeout for next tick. Assuming delay in processing