From 3eaf2f03b76ec00678e95ac35bf5c5dc29b8d839 Mon Sep 17 00:00:00 2001 From: Aidan Garske Date: Fri, 13 Nov 2026 13:06:25 -0800 Subject: [PATCH] Stop PSoC 6 UART output after the first TX timeout --- hal/psoc6.c | 2 ++ tools/unit-tests/unit-psoc6-boot.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/hal/psoc6.c b/hal/psoc6.c index e4e9116d..5c784aba 100644 --- a/hal/psoc6.c +++ b/hal/psoc6.c @@ -517,6 +517,8 @@ static void psoc6_uart_putc(char c) if (Cy_SCB_UART_Put(PSOC6_UART_SCB, (uint32_t)(uint8_t)c) != 0UL) return; } + /* A FIFO that stopped draining costs the spin bound once, not per char */ + psoc6_uart_ready = 0; } #ifdef __WOLFBOOT diff --git a/tools/unit-tests/unit-psoc6-boot.c b/tools/unit-tests/unit-psoc6-boot.c index d78defec..42b822a3 100644 --- a/tools/unit-tests/unit-psoc6-boot.c +++ b/tools/unit-tests/unit-psoc6-boot.c @@ -656,7 +656,7 @@ START_TEST(test_uart_putc_bounds_a_stuck_fifo) { uart_init(); tx_put_busy = 1; - uart_write("x", 1); + uart_write("xy\n", 3); ck_assert_int_eq(tx_put_calls, (int)PSOC6_UART_SPIN_MAX); } END_TEST