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.

LAUNCHCC3235MOD: I2C issue with TLV320AIC3254 audio codec

Part Number: LAUNCHCC3235MOD
Other Parts Discussed in Thread: TLV320AIC3254, CC3235MODSF,

Hi

I am having an issue with setting the volume of a TLV320AIC3254 audio codec from a CC3235MODSF MCU, and following a question in the audio forum it was suggested I raise it here as the issue appears to be related to I2C communication

I am now testing with a LAUNCHCC3235MOD board with an AUDBOOST board fitted to it, and running the i2secho example included with the CC32XX SDK. Whilst the i2secho example appears to run correctly this I2C readback is returning an error:

static unsigned long AudioCodec_regWrite(unsigned char ulRegAddr, unsigned char ucRegValue)
{

// Ensure that the write value matches the read value
if (readDataBuf[0] != ucRegValue)
{
stat = AudioCodec_STATUS_I2C_FAIL;
}

return stat;
}

I have ordered an I2C analyzer to investigate further, but it seems odd that this error would occur with standard hardware and TI example code, and I am wondering if it is unrelated to the error I am seeing in my code?

Many Thanks

Chris

  • You'll need to provide more details on the error (like error code).

    But first verify that the syscfg settings of the i2c are correct (e.g. that i2c is configured on the right pins).

    Other than the hardware configuration i can't suspect anything else currently.

  • Hi,

    Thanks for coming back to me. I have the default syscfg from the i2secho example, which is setup with the default I2C0, SDA pin on P02 /10 and SCL pin on P01/9, which matches the booster pack interface.

    The (i2secho example) code seems to be writing to the register and reading back from the register successfully, but the read back value is not matching the write value - the read back value appears to always be 0xFF. The error is occurring in line 22 in the following code snippet:

        // Write to the register
        bool ret = I2C_transfer(i2cHandle, &i2cTransaction);
        if (true != ret)
        {
            stat =  AudioCodec_STATUS_I2C_FAIL;
        }
    
        // Setup the struct for reading back
        i2cTransaction.writeBuf = writeDataBuf;
        i2cTransaction.writeCount = 1;
        i2cTransaction.readBuf = readDataBuf;
        i2cTransaction.readCount = 1;
    
        // Read back to the register
        ret = I2C_transfer(i2cHandle, &i2cTransaction);
        if (true != ret)
        {
            stat = AudioCodec_STATUS_I2C_FAIL;
        }
    
        // Ensure that the write value matches the read value
        if(readDataBuf[0] != ucRegValue)
        {
          stat = AudioCodec_STATUS_I2C_FAIL;
         
    
        }

    Many Thanks

    Chris

  • Is this triggered by AudioCodec_reset() in AudioCodec_open? (i believe this the first time the interface is used).

    Can you sniff the I2C lines? 

  • Hi,

    Yes, it is triggered by AudioCodec_reset(), and appears to be triggered every time AudioCodec_regWrite is called.

    I haven't got an I2C analyser yet, I will sniff the I2C lines when it arrives and report back, thank you. 

  • Have you done any changes to the LP or the boosterpack?

  • No, the LP, the boosterpack and the i2secho code all completely standard. 

  • ok. I'll try this example later this week. See if i can reproduce the issue.

  • Hi,

    Running an I2C analyzer everything seems to be working correctly, so I cannot see why the code is returning AudioCodec_STATUS_I2C_FAIL in line 24 of the code snippet above.

    Attached screengrabs show the output from the analyzer when the i2secho code sets the volumes to default.

    Many Thanks

    Chris

  • Is there any reason you are checking the return code? It seems to me that the example ignores them and the there might be some issue with this i2c driver code (i was getting similar thing running the app). 

    Does it work if you ignore the return code (of AudioCodec_regWrite)?

    (Debugging the I2C driver may take more time).

  • Hi,

    It was flagged that the audio volume issue I was seeing may be down to an I2C issue, and I assumed that the unexpected return code may be a symptom.

    Based on your feedback and the fact that the I2C analyzer shows the return code correctly I think the issue lies elsewhere in my code - thank you for your help.