[00:06:49.411,024] <inf> i2s_nrfx: I2S MCK frequency: 256000, actual PCM rate: 8000
I don't see the required k_mem_slab stuff mentioned anywhere in your posted code. Please look at existing I²S sample code in the NCS SDK.
I’ve updated the I²S TX implementation to follow the NCS I²S sample pattern, including a k_mem_slab for DMA buffers and allocating TX blocks from it
Hi,
Error code 11 is -EAGAIN, which simply means the I2S TX queue was full and i2s_write() timed out waiting for a free slot. This is expected if audio buffers are queued faster than the I2S hardware can transmit them. When this happens, one of the way could be to wait for some micro seconds and retry i2s_write().
Also note that as previously recommended increasing NUM_BLOCKS only adds more application buffers; it doesn’t change the driver’s internal TX queue size. To check that part, could you please share the relevant section of your prj.conf, especially any I2S or nrfx-related options?
Regarding MCK, you don’t need to generate it separately in code when I2S is set up as master.
Best Regards,
Syed Maysum
Hi Syed,
Thank you for the explanation.
Understood regarding error code 11 (-EAGAIN). I agree that this indicates the I2S TX queue is full and that the correct handling is to wait briefly and retry i2s_write() once the hardware has transmitted a buffer. I will add retry pacing on the application side and share the relevant I2S / nrfx-related options from prj.conf as requested.
Regarding MCK, I understand that when I2S is configured as master, the peripheral automatically generates and outputs MCK, so no separate software generation is required. My concern is mainly about the resulting MCK frequency and accuracy. From the I2S log, the internally generated MCK appears to be 256 kHz for an 8 kHz PCM rate (32× LRCK), whereas the codec datasheet recommends an MCK ratio of 256× LRCK (≈4 MHz for 16 kHz audio). I am currently verifying whether the internally generated MCK meets the codec’s clocking requirements when I2S is enabled.
I will follow up shortly with the prj.conf details and any additional observations.
Best regards,
Sharo