Skip to content

Commit 81f37c1

Browse files
nordic-krchrlubos
authored andcommitted
drivers: serial: nrf_sw_lpuart: Fix case of flushing RX FIFO
In Bluetooth HCI there is a case where uart_fifo_read is called not from the UART interrupt context. If that happens and there is pending UART data then LPUART was not able to reset the receiver as it remained in the blocked state. Case like that happens when HCI device sends data to the host core after host core got reset but before HCI device is reset by the host. Calling uart_fifo_read not from UART interrupt handler is a violation of the API but it has been used like that to drain UART FIFO for years and it has been useful so LPUART adapts to it. Case is fixed by triggering the UART interrupt if receiver is in blocked state. Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
1 parent 8a6195e commit 81f37c1

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,8 @@ Drivers
578578

579579
This section provides detailed lists of changes by :ref:`driver <drivers>`.
580580

581+
* Fixed an issue where the low power UART may fail after a reset if the reset occurs during transmission.
582+
581583
Wi-Fi drivers
582584
-------------
583585

drivers/serial/uart_nrf_sw_lpuart.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,7 @@ static void api_irq_rx_enable(const struct device *dev)
992992
struct lpuart_data *data = get_dev_data(dev);
993993

994994
data->int_driven.rx_enabled = true;
995-
if (int_driven_rd_available(data)) {
995+
if (int_driven_rd_available(data) || data->rx_state == RX_BLOCKED) {
996996
/* We need to move to the interrupt context of the same priority as UARTE. */
997997
k_timer_start(&data->int_driven.trampoline_timer, K_NO_WAIT, K_NO_WAIT);
998998
}

0 commit comments

Comments
 (0)