Next buffers not supplied on time

Mian code -

/*
 * Codec-style I2S SLAVE playback using k_mem_slab
 * nRF54Lx DK
 */

#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
#include <zephyr/drivers/i2s.h>
#include <zephyr/sys/printk.h>
#include "codec/codec.h"

#define I2S_NODE DT_NODELABEL(i2s20)

//audio
#define SAMPLE_RATE_HZ     8000
#define SAMPLE_BIT_WIDTH   32
#define CHANNELS           2
#define SAMPLES_PER_BLOCK  160
//#define SAMPLES_PER_BLOCK  (SAMPLE_RATE_HZ / 10)    // 33ms blocks
#define BLOCK_SIZE         (SAMPLES_PER_BLOCK * CHANNELS * sizeof(int16_t))
#define NUM_BLOCKS         80
#define TIMEOUT_MS         2000


static const struct device *i2s_dev = DEVICE_DT_GET(I2S_NODE);

//  memory slab for I2S TX buffers
K_MEM_SLAB_DEFINE(i2s_tx_slab, BLOCK_SIZE, NUM_BLOCKS, 4);

//sine
// static int16_t sine_lut[] = {
//     3211, 6392, 9511, 12539, 15446, 18204, 20787, 23169,
//     25329, 27244, 28897, 30272, 31356, 32137, 32609, 32767,
//     -3212, -6393, -9512, -12540, -15447, -18205, -20788, -23170,
//     -25330, -27245, -28898, -30273, -31357, -32138, -32610, -32767};


static int16_t sine_lut[] = {
    6392,  12539,  18204,  23169,  27244,  30272,  32137,  32767,  32137,
    30272, 27244, 23169, 18204, 12539, 6392, 0, -6393, -12540,
    -18205, -23170, -27245, -30273, -32138, -32767, -32138, -30273, -27245,
    -23170, -18205, -12540, -6393, -1};

// static int16_t sine_lut[8] = {
//      0,
//  23170,
//  32767,
//  23170,
//      0,
// -23170,
// -32768,
// -23170
// };



// Fill block
static void fill_block(int16_t *buf)
{
    int lut_len = ARRAY_SIZE(sine_lut);

    for (int i = 0; i < SAMPLES_PER_BLOCK; i++)
    {
        int16_t s = sine_lut[i % lut_len];
        buf[2 * i] = 25000;
        buf[2 * i + 1] = 25000;
    }
}

int main(void)
{
    struct i2s_config cfg;
    int ret;

    printk("I2S playback (mem_slab)\n");

    // clocking and codec init
    ret = pwm_4mhz();
    if (ret < 0)
    {
        printk("PWM init failed\n");
        return ret;
    }

    for (int i = 0; i < 20; i++)
    {
        ret = i2c_init_codec();
        if (ret == 0)
        {
            break;
        }
        k_msleep(5);
    }
    if (ret < 0)
    {
        printk("Codec init failed\n");
        return ret;
    }

    k_msleep(10);
    // printk("BLOCK=%d  SAMPLES=%d\n", BLOCK_SIZE, SAMPLES_PER_BLOCK);

    if (!device_is_ready(i2s_dev))
    {
        printk("I2S not ready\n");
        return -ENODEV;
    }

    // I2S CONFIG
    cfg.word_size      = SAMPLE_BIT_WIDTH;
    cfg.channels       = CHANNELS;
    cfg.format         =I2S_FMT_DATA_FORMAT_I2S;;   //cfg.format = I2S_FMT_DATA_FORMAT_LEFT_JUSTIFIED;

    cfg.options        = I2S_OPT_FRAME_CLK_SLAVE |
                         I2S_OPT_BIT_CLK_SLAVE;
    cfg.frame_clk_freq = SAMPLE_RATE_HZ;
    cfg.block_size     = BLOCK_SIZE;
    cfg.timeout        = TIMEOUT_MS;
    cfg.mem_slab       = &i2s_tx_slab;

    ret = i2s_configure(i2s_dev, I2S_DIR_TX, &cfg);
    if (ret < 0)
    {
        printk("I2S config failed\n");
        return ret;
    }

    printk("Start streaming\n");
    //prefill
    for (int i = 0; i < 30; i++)
    {
        void *block;
        k_mem_slab_alloc(&i2s_tx_slab, &block, K_FOREVER);
        fill_block((int16_t *)block);
        i2s_buf_write(i2s_dev, block, BLOCK_SIZE);
    }

    ret = i2s_trigger(i2s_dev, I2S_DIR_TX, I2S_TRIGGER_START);
    if (ret < 0)
    {
        printk("I2S trigger failed\n");
        return ret;
    }

    while (1)
    {
        void *block;

        ret = k_mem_slab_alloc(&i2s_tx_slab, &block, K_FOREVER);
        if (ret < 0)
        {
           printk("Slab alloc failed\n");
           k_sleep(K_USEC(30));
           continue;
        }

        fill_block((int16_t *)block);

        ret = i2s_buf_write(i2s_dev, block, BLOCK_SIZE);
       // k_sleep(K_USEC(100));
        if (ret == -ENOMEM)
        {
            /* Queue full — try again */
            k_mem_slab_free(&i2s_tx_slab, block);
            printk("free=%d\n", k_mem_slab_num_free_get(&i2s_tx_slab));
            continue;
        }
        else if (ret < 0)
        {
            printk("I2S error %d\n", ret);
            i2s_trigger(i2s_dev, I2S_DIR_TX, I2S_TRIGGER_DROP);
            k_sleep(K_MSEC(5));
            // i2s_trigger(i2s_dev, I2S_DIR_TX, I2S_TRIGGER_PREPARE);
            // k_sleep(K_MSEC(2));
            i2s_trigger(i2s_dev, I2S_DIR_TX, I2S_TRIGGER_START);
            k_mem_slab_free(&i2s_tx_slab, block);
            printk("free=%d\n", k_mem_slab_num_free_get(&i2s_tx_slab));
            continue;
        }
    }

    i2s_trigger(i2s_dev, I2S_DIR_TX, I2S_TRIGGER_DROP);
    printk("Exit\n");
    return 0;
}
Log:
SEGGER J-Link V9.10 - Real time terminal output
SEGGER J-Link EDU V11.0, SN=261002460
Process: JLink.exe
*** Booting nRF Connect SDK v3.2.1-d8887f6f32df ***
*** Using Zephyr OS v4.2.99-ec78104f1569 ***
I2S playback (mem_slab)
PWM configured: period=250ns pulse=125ns
I2C bus ready, addr=0x18
Codec responded: reg0 = 0x01
Writing codec register table...
reg=0x01 val=0x01 err=0
reg=0x04 val=0x03 err=0
reg=0x05 val=0xD4 err=0
reg=0x06 val=0x20 err=0
reg=0x07 val=0x00 err=0
reg=0x08 val=0x00 err=0
reg=0x1B val=0x0C err=0
reg=0x0B val=0x84 err=0
reg=0x0C val=0x99 err=0
reg=0x0E val=0x80 err=0
reg=0x1D val=0x01 err=0
reg=0x1E val=0x84 err=0
reg=0x3F val=0xD4 err=0
reg=0x40 val=0x00 err=0
reg=0x41 val=0x00 err=0
reg=0x42 val=0xD0 err=0
reg=0x47 val=0x82 err=0
reg=0x48 val=0x82 err=0
reg=0x51 val=0x80 err=0
reg=0x52 val=0x00 err=0
reg=0x53 val=0x00 err=0
reg=0x1E val=0x00 err=0
reg=0x1F val=0xC0 err=0
reg=0x20 val=0xC6 err=0
reg=0x23 val=0xA8 err=0
reg=0x24 val=0x80 err=0
reg=0x25 val=0x80 err=0
reg=0x22 val=0x30 err=0
reg=0x2A val=0x3D err=0
reg=0x2B val=0x3D err=0
reg=0x2C val=0xC0 err=0
reg=0x26 val=0x80 err=0
reg=0x27 val=0x80 err=0
reg=0x2E val=0x00 err=0
reg=0x2F val=0x00 err=0
reg=0x30 val=0x00 err=0
reg=0x31 val=0x00 err=0
Codec init DONE.
I2C ready
Start streaming
[00:26:31.169,121] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x200070d8
[00:26:31.169,370] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x200075d8
[00:26:31.169,611] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x20007ad8
[00:26:31.169,852] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x20007fd8
[00:26:31.170,093] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x200084d8
[00:26:31.170,332] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x200089d8
[00:26:31.170,573] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x20008ed8
[00:26:31.170,815] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x200093d8
[00:26:31.171,052] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x200098d8
[00:26:31.171,288] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x20009dd8
[00:26:31.171,525] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000a2d8
[00:26:31.171,762] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000a7d8
[00:26:31.172,000] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000acd8
[00:26:31.172,234] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000b1d8
[00:26:31.172,471] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000b6d8
[00:26:31.172,708] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000bbd8
[00:26:31.172,946] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000c0d8
[00:26:31.173,183] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000c5d8
[00:26:31.178,428] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000cad8
[00:26:31.178,670] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000cfd8
[00:26:31.178,910] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000d4d8
[00:26:31.179,147] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000d9d8
[00:26:31.179,384] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000ded8
[00:26:31.179,621] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000e3d8
[00:26:31.179,859] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000e8d8
[00:26:31.180,096] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000edd8
[00:26:31.180,332] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000f2d8
[00:26:31.180,569] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000f7d8
[00:26:31.180,807] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000fcd8
[00:26:31.181,044] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x200101d8
[00:26:31.181,313] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x200106d8
[00:26:31.181,565] <dbg> i2s_nrf[00:26:31.181,719] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x200075d8/(nil)
x: i2s_nrfx_write: Queued TX 0x20010bd8
[00:26:31.182,083] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x200110d8
[00:26:31.182,318] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x200115d8
[00:26:31.191,702] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x200070d8
[00:26:31.191,944] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x20007ad8/(nil)
[00:26:31.192,189] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x20011ad8
[00:26:31.201,702] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x200075d8
[00:26:31.201,943] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x20007fd8/(nil)
[00:26:31.202,189] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x20011d58
[00:26:31.211,702] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x20007ad8
[00:26:31.211,944] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x200084d8/(nil)
[00:26:31.212,189] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x20011fd8
[00:26:31.221,702] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x20007fd8
[00:26:31.221,944] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x200089d8/(nil)
[00:26:31.222,190] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x20012258
[00:26:31.231,702] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x200084d8
[00:26:31.231,944] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x20008ed8/(nil)
[00:26:31.232,190] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x200124d8
[00:26:31.241,702] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x200089d8
[00:26:31.241,944] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x200093d8/(nil)
[00:26:31.242,189] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x20012758
[00:26:31.251,702] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x20008ed8
[00:26:31.251,944] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x200098d8/(nil)
[00:26:31.252,190] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x200129d8
[00:26:31.261,703] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x200093d8
[00:26:31.261,944] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x20009dd8/(nil)
[00:26:31.262,190] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x20012c58
[00:26:31.271,703] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x200098d8
[00:26:31.271,944] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000a2d8/(nil)
[00:26:31.272,190] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x20012ed8
[00:26:31.281,703] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x20009dd8
[00:26:31.281,944] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000a7d8/(nil)
[00:26:31.282,190] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x20013158
[00:26:31.291,704] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000a2d8
[00:26:31.291,945] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000acd8/(nil)
[00:26:31.292,191] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x200133d8
[00:26:31.301,715] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000a7d8
[00:26:31.301,939] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000b1d8/(nil)
[00:26:31.302,195] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000a7d8
[00:26:31.311,715] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000acd8
[00:26:31.311,939] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000b6d8/(nil)
[00:26:31.321,715] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000b1d8
[00:26:31.321,939] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000bbd8/(nil)
[00:26:31.322,195] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000b1d8
[00:26:31.331,715] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000b6d8
[00:26:31.331,939] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000c0d8/(nil)
[00:26:31.341,715] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000bbd8
[00:26:31.341,940] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000c5d8/(nil)
[00:26:31.342,194] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000bbd8
[00:26:31.351,715] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000c0d8
[00:26:31.351,939] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000cad8/(nil)
[00:26:31.361,715] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000c5d8
[00:26:31.361,940] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000cfd8/(nil)
[00:26:31.362,196] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000c5d8
[00:26:31.371,715] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000cad8
[00:26:31.371,939] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000d4d8/(nil)
[00:26:31.381,715] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000cfd8
[00:26:31.381,940] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000d9d8/(nil)
[00:26:31.382,196] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000cfd8
[00:26:31.391,715] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000d4d8
[00:26:31.391,938] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000ded8/(nil)
[00:26:31.401,719] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000d9d8
[00:26:31.401,944] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000e3d8/(nil)
[00:26:31.402,200] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000d9d8
[00:26:31.411,716] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000ded8
[00:26:31.411,939] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000e8d8/(nil)
[00:26:31.421,715] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000e3d8
[00:26:31.421,940] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000edd8/(nil)
[00:26:31.422,196] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000e3d8
[00:26:31.431,718] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000e8d8
[00:26:31.431,942] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000f2d8/(nil)
[00:26:31.441,715] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000edd8
[00:26:31.441,938] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000f7d8/(nil)
[00:26:31.442,191] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000edd8
[00:26:31.451,716] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000f2d8
[00:26:31.451,939] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000fcd8/(nil)
[00:26:31.461,717] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000f7d8
[00:26:31.461,941] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x200101d8/(nil)
[00:26:31.462,197] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000f7d8
[00:26:31.471,716] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000fcd8
[00:26:31.471,939] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x200106d8/(nil)
[00:26:31.481,716] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x200101d8
[00:26:31.481,940] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x20010bd8/(nil)
[00:26:31.482,196] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x200101d8
[00:26:31.491,716] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x200106d8
[00:26:31.491,940] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x200110d8/(nil)
[00:26:31.501,716] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x20010bd8
[00:26:31.501,941] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x200115d8/(nil)
[00:26:31.502,197] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x20010bd8
[00:26:31.511,716] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x200110d8
[00:26:31.511,940] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x20011ad8/(nil)
[00:26:31.521,716] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x200115d8
[00:26:31.521,940] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x20011d58/(nil)
[00:26:31.522,197] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x200115d8
[00:26:31.531,716] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x20011ad8
[00:26:31.531,940] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x20011fd8/(nil)
[00:26:31.541,716] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x20011d58
[00:26:31.541,940] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x20012258/(nil)
[00:26:31.542,197] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x20011d58
[00:26:31.551,716] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x20011fd8
[00:26:31.551,940] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x200124d8/(nil)
[00:26:31.561,716] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x20012258
[00:26:31.561,940] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x20012758/(nil)
[00:26:31.562,196] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x20012258
[00:26:31.571,716] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x200124d8
[00:26:31.571,940] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x200129d8/(nil)
[00:26:31.581,716] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x20012758
[00:26:31.581,941] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x20012c58/(nil)
[00:26:31.582,193] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x20012758
[00:26:31.591,716] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x200129d8
[00:26:31.591,940] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x20012ed8/(nil)
[00:26:31.601,716] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x20012c58
[00:26:31.601,941] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x20013158/(nil)
[00:26:31.602,197] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x20012c58
[00:26:31.611,717] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x20012ed8
[00:26:31.611,940] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x200133d8/(nil)
[00:26:31.621,721] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x20013158
[00:26:31.621,945] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000a7d8/(nil)
[00:26:31.622,201] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x20013158
[00:26:31.631,717] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x200133d8
[00:26:31.631,940] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000b1d8/(nil)
[00:26:31.641,716] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000a7d8
[00:26:31.641,941] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000bbd8/(nil)
[00:26:31.642,197] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000a7d8
[00:26:31.651,719] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000b1d8
[00:26:31.651,943] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000c5d8/(nil)
[00:26:31.661,717] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000bbd8
[00:26:31.661,941] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000cfd8/(nil)
[00:26:31.662,197] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000bbd8
[00:26:31.671,717] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000c5d8
[00:26:31.671,941] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000d9d8/(nil)
[00:26:31.681,718] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000cfd8
[00:26:31.681,943] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000e3d8/(nil)
[00:26:31.682,199] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000cfd8
[00:26:31.691,717] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000d9d8
[00:26:31.691,940] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000edd8/(nil)
[00:26:31.701,717] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000e3d8
[00:26:31.701,941] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000f7d8/(nil)
[00:26:31.702,197] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000e3d8
[00:26:31.711,717] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000edd8
[00:26:31.711,941] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x200101d8/(nil)
[00:26:31.721,717] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000f7d8
[00:26:31.721,941] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x20010bd8/(nil)
[00:26:31.722,196] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000f7d8
[00:26:31.731,717] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x200101d8
[00:26:31.731,941] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x200115d8/(nil)
[00:26:31.741,717] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x20010bd8
[00:26:31.741,942] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x20011d58/(nil)
[00:26:31.742,198] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x20010bd8
[00:26:31.751,717] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x200115d8
[00:26:31.751,941] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x20012258/(nil)
[00:26:31.761,717] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x20011d58
[00:26:31.761,942] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x20012758/(nil)
[00:26:31.762,198] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x20011d58
[00:26:31.771,717] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x20012258
[00:26:31.771,938] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x20012c58/(nil)
[00:26:31.781,717] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x20012758
[00:26:31.781,942] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x20013158/(nil)
[00:26:31.782,198] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x20012758
[00:26:31.791,717] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x20012c58
[00:26:31.791,941] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000a7d8/(nil)
[00:26:31.801,717] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x20013158
[00:26:31.801,942] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000bbd8/(nil)
[00:26:31.802,198] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x20013158
[00:26:31.811,718] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000a7d8
[00:26:31.811,941] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000cfd8/(nil)
[00:26:31.821,717] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000bbd8
[00:26:31.821,942] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000e3d8/(nil)
[00:26:31.822,198] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000bbd8
[00:26:31.831,718] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000cfd8
[00:26:31.831,942] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000f7d8/(nil)
[00:26:31.841,722] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000e3d8
[00:26:31.841,946] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x20010bd8/(nil)
[00:26:31.842,203] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000e3d8
[00:26:31.851,718] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000f7d8
[00:26:31.851,941] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x20011d58/(nil)
[00:26:31.861,718] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x20010bd8
[00:26:31.861,942] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x20012758/(nil)
[00:26:31.862,198] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x20010bd8
[00:26:31.871,720] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x20011d58
[00:26:31.871,944] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x20013158/(nil)
[00:26:31.881,718] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x20012758
[00:26:31.881,942] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000bbd8/(nil)
[00:26:31.882,198] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x20012758
[00:26:31.891,718] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x20013158
[00:26:31.891,942] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000e3d8/(nil)
[00:26:31.901,720] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000bbd8
[00:26:31.901,944] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x20010bd8/(nil)
[00:26:31.902,200] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000bbd8
[00:26:31.911,718] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000e3d8
[00:26:31.911,941] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x20012758/(nil)
[00:26:31.921,718] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x20010bd8
[00:26:31.921,943] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000bbd8/(nil)
[00:26:31.922,199] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x20010bd8
[00:26:31.931,718] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x20012758
[00:26:31.931,942] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x20010bd8/(nil)
[00:26:31.941,718] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000bbd8
[00:26:31.941,958] <dbg> i2s_nrfx: i2s_nrfx_write: Queued TX 0x2000bbd8
[00:26:31.942,173] <dbg> i2s_nrfx: i2s_nrfx_write: Next TX 0x2000bbd8
[00:26:31.942,382] <dbg> i2s_nrfx: supply_next_buffers: Next buffers: 0x2000bbd8/(nil)
[00:26:31.951,718] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x20010bd8
[00:26:31.961,705] <err> i2s_nrfx: Next buffers not supplied on time
[00:26:31.961,931] <dbg> i2s_nrfx: free_tx_buffer: Freed TX 0x2000bbd8
[00:26:31.962,177] <err> i2s_nrfx: Cannot write in state: 4
I2S error -5
ASSERTION FAIL [p_cb->state != NRFX_DRV_STATE_UNINITIALIZED] @ WEST_TOPDIR/modules/hal/nordic/nrfx/drivers/src/nrfx_i2s.c:439
[00:26:31.962,647] <err> os: r0/a1: 0x00000004 r1/a2: 0x000001b7 r2/a3: 0x00000000
[00:26:31.962,889] <err> os: r3/a4: 0x00000004 r12/ip: 0x0000000a r14/lr: 0x00007f01
[00:26:31.963,123] <err> os: xpsr: 0x09000000
[00:26:31.963,303] <err> os: Faulting instruction address (r15/pc): 0x0000e364
[00:26:31.963,524] <err> os: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0
[00:26:31.963,743] <err> os: Current thread: 0x20000a28 (main)
[00:26:31.963,947] <err> os: Halting system
no sine wave sound during this trasmission time ?..  
I attached here reguster i Enabaled 
/**
 * Register declaration
 */

const register_value REGISTER_DATA[] = {
//          # reg[0][0]   = 0x00   ; Select Page 0
{0,0x00},          // Select Page 0

/* Software reset */
{1,0x01},

/* ---------- PLL CONFIG (MCLK = 4 MHz → 8 kHz Fs) ---------- */
{4,0x03},          // PLL input = MCLK, CODEC_CLK = PLL
{5,0xD4},          // PLL power up, P=5, R=4   D4
{6,0x20},          // J=32
{7,0x00},          // D MSB
{8,0x00},          // D LSB

      // *** PLL LOCK WAIT (VERY IMPORTANT) ***

/* ---------- I2S DIGITAL ---------- */
{27,0x0C},         // I2S, 16bit, slave 0C

/* ---------- DAC CLOCK TREE ---------- */
{11,0x84},         // NDAC=4, power up
{12,0x99},         // MDAC=25, power up
{14,0x80},         // DOSR=128 → Fs = 8kHz
{29,0x01},         // DAC clock source  0x01
{30,0x84},         // BCLK divider  84

/* ---------- DAC POWER / UNMUTE ---------- */
{63,0xD4},         // Soft stepping  D4
{64,0x00},         // Left DAC unmute
{65,0x00},         // Right DAC unmute
{66,0xD0},         // DAC volume 00 dB


{71,0x82},    // beep
{72,0x82},
{81,0x80},
{82,0x00},
{83,0x00},

/* ===================================================== */
/* ===================== PAGE 1 ========================= */
/* ===================================================== */

{0,0x01},          // Select Page 1

/* ---------- Analog Power ---------- */
{30,0x00},         // Analog blocks power control
{31,0xC0},         // HPL + HPR unmute
{32,0xC6},         // Speaker drivers power up

/* ---------- DAC → Headphone ---------- */
{35,0xA8},         // Route DAC L/R → HP
{36,0x80},         // HP volume 0 dB
{37,0x80},         // HP volume 0 dB

/* ---------- Speaker ---------- */
{34,0x30},         // Speaker path enable
{42,0x3D},         // Speaker gain 1D
{43,0x3D},         // Speaker gain 1D
{44,0xC0},         // Speaker unmute

/* ---------- Route DAC → Speaker ---------- */
{38,0x80},
{39,0x80},

/* ---------- MIC (optional) ---------- */
{46,0x00},         // MICBIAS 2.5V 0x0A
{47,0x00},         // MIC gain
{48,0x00},        //0x40
{49,0x00},        //0x40
 
};
i m usinf nrf54l15  and codec is TLV320AIC3111
Parents
  • Hello,

    I see that you already have another ticket open for the same issue, and my colleague is currently working on it. Please close this ticket and continue the discussion in the original one.

    Please close this ticket as it is a duplicate of: 357350

    Also, when posting, please describe the issue and provide some context instead of pasting the entire logs and code directly into the text. You can use the insert option to attach logs and code separately, which makes it much easier for us to review.

    Kind Regards,

    Abhijith

Reply
  • Hello,

    I see that you already have another ticket open for the same issue, and my colleague is currently working on it. Please close this ticket and continue the discussion in the original one.

    Please close this ticket as it is a duplicate of: 357350

    Also, when posting, please describe the issue and provide some context instead of pasting the entire logs and code directly into the text. You can use the insert option to attach logs and code separately, which makes it much easier for us to review.

    Kind Regards,

    Abhijith

Children
Related