From 62087be265b3e1f912038f40aa302acfe0071f0c Mon Sep 17 00:00:00 2001 From: Krzysztof Chruscinski Date: Thu, 14 May 2020 09:24:52 +0200 Subject: [PATCH] drivers: uart: nrf_uarte: Generate RX_RDY after rx_disable So far, when rx_disable was called then received data was discarded. This is currently not according to the API but it is needed if rx_disabled is called due to out of band information about end of packet. Signed-off-by: Krzysztof Chruscinski --- drivers/serial/uart_nrfx_uarte.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 4863b6340b1..1f439a7a9a1 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -762,8 +762,8 @@ static void endrx_isr(struct device *dev) .type = UART_RX_DISABLED, }; user_callback(dev, &evt); + return; } - return; } data->async->is_in_irq = true; @@ -813,6 +813,11 @@ static void endrx_isr(struct device *dev) user_callback(dev, &evt); } + if (!data->async->rx_enabled) { + data->async->is_in_irq = false; + return; + } + struct uart_event evt = { .type = UART_RX_BUF_RELEASED, .data.rx_buf.buf = data->async->rx_buf, @@ -1263,6 +1268,7 @@ static int uarte_instance_init(struct device *dev, NRF_UARTE_Type *uarte = get_uarte_instance(dev); struct uarte_nrfx_data *data = get_dev_data(dev); + nrf_gpio_pin_write(config->pseltxd, 1); nrf_gpio_cfg_output(config->pseltxd);