This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TLV320AIC24K: I2C control register values changing with every read

Part Number: TLV320AIC24K

We have this codec and are setting up the I2C port. Every time we read the control register status (using auto-increment of address), the value of register 3A toggles between our programmed value and 0x88. Also, control register 4 increments by 0x20 on every read.

This is rather surprising behavior, and does not look random. We are hoping to use the I2C for the control interface, and use the 4-wire serial port for data only. We need to be reassured that the data on I2C is what we expect it to be. I have read through the datasheet and cannot find any indication that this is expected behavior.

Could you explain if this is expected, and if the I2C bus can be used as the only control port?

  • Hi, Brian,

    This should be related with the sub-register addresses of register 3. Register 3 contains 4 sub-registers which are determined by the sub-register index. As mentioned in the datsheet:

    "...for a register with multiple sub-registers, the sub-register index automatically increments with each read/write. For example, the first read/write to register 3 read/writes to register 3A, the next to register 3B and so forth until the last sub-register is reached. At this time the sub-register index wraps back around to the first sub-register...".

    So, in order to read the register 3, I would recommend to use the auto-increment function. For the rest of registers, I recommend to read them without auto-increment function.

    Best regards,
    Luis Fernando Rodríguez S.
  • Hi Luis,

    I have performed the auto-increment on CR3, reading only 4 bytes using auto-increment, and performed single byte reads on CR4. In both cases non-reserved bits change with every read. I have verified with the oscilloscope that there is nothing happening besides the reads, and that I am reading the data correctly. We have an I2C module on the scope which shows our data, as well as start/stop bits etc. It all looks correct.
    I have tried with two different I2C controllers (one is our processor, and the other an external USB converter), both have similar results.
    I have increased the drive strength, with no change in results.

    I read four bytes from register 3 four times. Register 3C gives the following results:
    40
    BF
    C0
    00
    This seems to indicate that the device ID is changing with every read!

    Here is my overall sequence of events:
    Power up with codec held in reset & processor TDM bus tristated
    Take codec out of reset, processor TDM is still tristated
    Read codec registers via I2C, processor TDM is still tristated

    Is there some sort of initialization I must do to get stable values from the registers over I2C?

    Brian
  • OK I figured out the sub-register thing. I will attempt to document this for future reference.


    The datasheet says that "the index register address is incrimented [sic] so that the next read/write is performed on the next control register". Figure 32 shows normal I2C auto-indexing, whereby the register address increments each time an ACK is sent. 

    To be clear, the MAIN register address increments each time an ACK is sent. The SUB register address increments each time a new read command is issued to the MAIN register address.

    So reading four bytes starting at register 3 will give you the following register contents:

    3A 4 5A 6A

    Read the same thing again, and you will get:

    3B 4 5B 6B

    Keep sending the same command, and you will get:

    3C 4 5C 6A

    3D 4 5D 6B

    3A 4 5A 6A

    etc.

    Each read to a MAIN register address will increment its own sub register address, and the sub register address wraps around when the last sub-register is read.

    Brian

  • Also note that sequential reads to register 4 will give you N and P values (with FSDIV set to 0) the first time you read it, and M value (with FSDIV set to 1) the second time you read it. This is not documented in the datasheet, nor are the reset values for these divider ratios.
    On powerup reading register 4 gives the value 0x30 (i.e. FSDIV = 0, M=16). Read it again and it gives 0x90 (i.e. FSDIV=1, N=6,P=8).