This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 42ddba0491d64a46ec5f6ec8529b35ccc83b2a61
Author: raiden00pl <[email protected]>
AuthorDate: Tue Oct 20 14:51:05 2026 +0200

    arch/arm/nrf54l: read TXSTOPPED in the UART txready
    
    The serial upper half polls txready with the interrupts disabled when
    writing from an interrupt or the idle task, so the busy flag cleared by
    the interrupt handler hung that write after the first byte.
    
    Assisted-by: Claude Code
    Signed-off-by: raiden00pl <[email protected]>
---
 arch/arm/src/nrf54l/nrf54l_serial.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/arch/arm/src/nrf54l/nrf54l_serial.c 
b/arch/arm/src/nrf54l/nrf54l_serial.c
index 4dae865e936..03296fd26bc 100644
--- a/arch/arm/src/nrf54l/nrf54l_serial.c
+++ b/arch/arm/src/nrf54l/nrf54l_serial.c
@@ -1085,7 +1085,8 @@ static void nrf54l_txint(struct uart_dev_s *dev, bool 
enable)
  * Name: nrf54l_txready
  *
  * Description:
- *   Report whether the transmitter can accept another character.
+ *   Report whether the transmitter can accept another character. The
+ *   event is read, the upper half also polls with interrupts disabled.
  *
  ****************************************************************************/
 
@@ -1093,7 +1094,13 @@ static bool nrf54l_txready(struct uart_dev_s *dev)
 {
   struct nrf54l_dev_s *priv = dev->priv;
 
-  return !priv->txbusy;
+  if (priv->txbusy)
+    {
+      return nrf54l_uart_getreg(priv,
+                                NRF54L_UARTE_EVENTS_TXSTOPPED_OFFSET) != 0;
+    }
+
+  return true;
 }
 
 /****************************************************************************
@@ -1106,9 +1113,7 @@ static bool nrf54l_txready(struct uart_dev_s *dev)
 
 static bool nrf54l_txempty(struct uart_dev_s *dev)
 {
-  struct nrf54l_dev_s *priv = dev->priv;
-
-  return !priv->txbusy;
+  return nrf54l_txready(dev);
 }
 
 /****************************************************************************

Reply via email to