diff --git a/drivers/serial/uart_nrfx_uart.c b/drivers/serial/uart_nrfx_uart.c index 172e8729976..c4b43df03f6 100644 --- a/drivers/serial/uart_nrfx_uart.c +++ b/drivers/serial/uart_nrfx_uart.c @@ -272,10 +272,14 @@ static void uart_nrfx_poll_out(const struct device *dev, unsigned char c) while (atomic_cas((atomic_t *) lock, (atomic_val_t) 0, (atomic_val_t) 1) == false) { - /* k_sleep allows other threads to execute and finish - * their transactions. - */ - k_msleep(1); + if (IS_ENABLED(CONFIG_MULTITHREADING)) { + /* k_sleep allows other threads to execute and finish + * their transactions. + */ + k_msleep(1); + } else { + k_busy_wait(1000); + } if (--safety_cnt == 0) { break; } diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 3f438e5ba3b..14ac2a75e57 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -489,7 +489,9 @@ static int wait_tx_ready(const struct device *dev) irq_unlock(key); } - k_msleep(1); + if (IS_ENABLED(CONFIG_MULTITHREADING)) { + k_msleep(1); + } } while (1); return key;