Problems with Uart21 and Xiao nrf54L15

Hello,
I have problems in the async-mode with the UART21 output and the nRF54L15. I am using Toolchain v3.1.1 and SDK v3.1.1.

When I use the uart_tx function to print out more than 8 Bytes the output doesnt work, when I make a k_mssleep directly afterwards. I get only a crypted output.

            tx_buf_length = snprintf((char *)tx_buf, sizeof(tx_buf), "Counter: %d\r\n", counter);

            tx_busy = true;
            err = uart_tx(uart_dev, tx_buf , tx_buf_length, 100 * USEC_PER_MSEC);


It works if I place before:

        while (tx_busy) {
            k_yield();
        }

 My Sourcecode works fine with the nRF52840dk and uart1. I tried it already with semaphore too. No success. My full code is:

#include <stdio.h>
#include <zephyr/kernel.h>
#include <zephyr/drivers/uart.h>

#define SLEEP_TIME_MS   200

#define UART_NODE      DT_NODELABEL(uart21)  
//#define UART_NODE      DT_NODELABEL(uart1)  

const struct uart_config uart_cfg = {
        .baudrate = 115200,
        .parity = UART_CFG_PARITY_NONE,
        .stop_bits = UART_CFG_STOP_BITS_1,
        .data_bits = UART_CFG_DATA_BITS_8,
        .flow_ctrl = UART_CFG_FLOW_CTRL_NONE
};

static uint8_t tx_buf[25];
static int tx_buf_length;
static int counter=0;
static volatile bool tx_busy = false;
static volatile int bytes_sent = 0;

static void uart_cb(const struct device *dev, struct uart_event *evt, void *user_data)
{
    switch (evt->type) {

    case UART_TX_DONE:
        bytes_sent = evt->data.tx.len;
        tx_busy = false;
        printf("TX_DONE: %d bytes\n", evt->data.tx.len);
        break;
   
    case UART_TX_ABORTED:
        tx_busy = false;
        printf("TX_ABORTED\n");
        break;
   
    default:
        printf("UART event: %d\n", evt->type);
        break;
    }
}



int main(void)
{
    int err;
    const struct device *uart_dev = DEVICE_DT_GET(UART_NODE);
    if (!device_is_ready(uart_dev)) {
        return 0;
    }

    err = uart_configure(uart_dev, &uart_cfg);

    if (err == -ENOSYS) {
        return -ENOSYS;
    }


    printf("uart_dev  ready\n");

    err = uart_callback_set(uart_dev, uart_cb, NULL);
    if (err) {
        return err;
    }
    printf("uart_cb set\n");

    while (1)
    {
        if (!tx_busy) {
           
            counter++;
            tx_buf_length = snprintf((char *)tx_buf, sizeof(tx_buf), "Counter: %d\r\n", counter);

            tx_busy = true;
            err = uart_tx(uart_dev, tx_buf , tx_buf_length, 100 * USEC_PER_MSEC);
            if (err) {
                printf("uart_tx failed: %d\n", err);
                tx_busy = false;
            }
   

        }

        /*while (tx_busy) {
            k_yield();
        }*/
        k_msleep(SLEEP_TIME_MS);
    }
   
    return 0;
}
Related