What to try next in debugging bringing up an I2S audio codec?

Hello everyone! I found this post on the Wayback Machine about being unable to read NAU8810 registers: https://web.archive.org/web/20230212204134/https://www.reddit.com/r/AskElectronics/comments/110pon6/unable_to_read_registers_in_nau88c10_audio_codec/?utm_source=reddit&utm_medium=web2x&context=3

I am having the exact same issue! But it doesn’t look like anyone commented before the user deleted their post. I’m excerpting their description of the problem below, as I see the same symptoms:

The chip has a standard I2C control interface. When I run the I2C scanner sketch with it all wired up, I can see that it’s detecting an I2C device with address 0x1A, which is what I expect. But when I try to read any registers, I just get zeros back, except from 0x0C, 0x0D, 0x1C, 0x1D, 0x24, and 0x25, which read as 0x01. I have 4 other devices that I’m able to interact with on the I2C bus without a problem. Also, I am using 3.3V to power the digital logic of the NAU8810, and a 3V LDO to power the analog side of the NAU8810.

I also found this linux discussion of the regmap format of the codec, but I don’t know whether the 7x9 regmap discussion is relevant, since I am adapting this driver that seems to work with “normal” microcontroller I2C usage.

Here’s the schematic page that has the NAU8810 and supporting electronics: nau8810 schematic.pdf | DocDroid

At this point, I feel like I’ve run out of ideas for what to try next. I’d really appreciate suggestions of what else I could do. Thanks in advance for your help!

This nice redditor pointed me in the right direction. I’m copying my comment here, to aide future searchers (and also, maybe it’s interesting if you’ve never dealt with 9 bit registers over I2C like me).

In order to read a register $r, you should do a 16 bit read operation from register $r<<1, because the LSB of the register should be 0/you should treat the register as a 7 bit value.

In order to write a 9 bit value $v to a register $r, you’re supposed to do an 8 bit write operation. The register address is then ($r<<1 | ($v>>8) & 1), and the data is ($v & 0xff). This takes the MSB of the data and shoves it into the LSB of the register address.

I’ve now got control of the NAU8810 :slight_smile:

1 Like