[00:06:49.411,024] <inf> i2s_nrfx: I2S MCK frequency: 256000, actual PCM rate: 8000
Hi,
Thanks for the updates. I think we may be mixing a few different topics, so just to make sure I understand you correctly and can help in the right direction, could we first align on one thing? Could you please confirm what you want the nRF54L15 to do for the I2S clocks:
These two setups are configured very differently, so confirming this first will help avoid confusion. Once this is clear, we can then look at: the I2S -11 (-EAGAIN) messages, and the I2C -5 (I/O error) issue separately if it still happens.
Thanks for confirming, and we’ll take it step by step from there. Regards,
Syed Maysum
Hi,
To solve this efficiently, we need to validate one interface at a time. I’ve reviewed your code carefully and there are concrete I2C bugs that must be fixed before we continue with I2S.
Issue 1: Incorrect I2C transfer lengths (must be fixed)
In multiple places you request 2 bytes from the I2C driver but store them in 1-byte variables, which is invalid and can corrupt memory or cause the codec to NACK. Examples from your code:
codec_probe():
uint8_t read_back = 0; i2c_write_read_dt(&dev_i2c, ®0, 2, &read_back, 2);
read_eg():
uint8_t reg = 0xD4; uint8_t val = 0; i2c_write_read_dt(&dev_i2c, ®, 2, &val, 2);
Both are invalid and must be corrected everywhere in the code.
Issue 2: Wrong API used for register writes
You are using i2c_write_read_dt() for normal register writes (write-only operations). So for normal writes please try using i2c_write_dt(). Correct patterns (assuming 8-bit register + 8-bit data):
Register write:
uint8_t buf[2] = { reg, val };
ret = i2c_write_dt(&dev_i2c, buf, 2);
Register read:
ret = i2c_write_read_dt(&dev_i2c, ®, 1, &val, 1);
So before testing I2S again please disable I2S in the overlay (&i2s20 { status = "disabled"; };) or physically disconnect all I2S lines and first fix all I2C calls so that transfer lengths exactly match buffer sizes and i2c_write_dt() is used for write-only operations. Then read the same codec register 10,000 times in a loop (this test should complete with 0 occurrences of -EIO).
Once this I2C-only test is stable, we will move on to validating I2S in isolation. Thanks
I am try to create external clock for mclk
Hi
I see you’re experimenting with generating a 4 MHz MCLK now. Just to make sure we’re aligned: I don’t yet have confirmation that the original I2C issue is resolved. Before we move further with MCLK/I2S, could you please confirm:
Once that’s confirmed, we can continue with the MCLK/I2S part. Thanks
Regards,
Syed Maysum
Not fixed yest , when i am reading i2c reguster it leads to -5 error
I2c register Read is happen only when used debugger step in to option , otherwise it leads to -5 error