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.

AWR1642: How to use I2C driver to program PMIC LP87702-Q1 ?

Part Number: AWR1642
Other Parts Discussed in Thread: LP87702-Q1

Hi,

There is a question about i2c controlling.

I found the post that the question is the same, but does not have answer.

( https://e2e.ti.com/support/sensors/f/1023/t/635864?tisearch=e2e-sitesearch&keymatch=awr1642%20i2c )

How to read/write the data of the specific register address ?

Thanks.

I use mmwave sdk 1.2.0.5 version.

  • Hello Kris,

    Did you try to look at the I2C example code provided in the SDK drivers folder?

    C:\ti\mmwave_sdk_02_01_00_00\packages\ti\drivers\i2c

    Regards,

    Adrian
  • Hi Adrian

    Yes,

    I tried to the I2C example code, and implement the related function to mmw sdk.

    When I tried to read the LP87702-Q1 OTP_CODE, it received the wrong data.

    Is there any missing steps?

    Thanks.

    The initial code is as follows:

    =============================================================

    The read data code is as follows:

    =============================================================

    =============================================================

  • Hi Kris,

    Please refer the code below:

    To read the PMIC version register. And the steps I have done are listed below:

    1. Pinmux initial

    2. i2cParams.transferMode = I2C_MODE_BLOCKING;

    3. arg = 0; errCode = I2C_control (i2cHandle, I2C_CMD_ADDR_MODE, (void* )&arg); //arg set to 0, and the I2C addr mode is 7-bit.

    4. To read the PMIC version register

    txData[0] = 0x01;// version register’s address in PMIC’s datasheet

    i2cTransaction.slaveAddress = 0x60;//PMIC’s address

    i2cTransaction.writeBuf = txData;

    i2cTransaction.writeCount = 1;//need to write the version register’s address to PMIC first

    i2cTransaction.readBuf = rxData;

    i2cTransaction.readCount = 1;//read the version register’s value(8bit)

     

    retVal = I2C_transfer(i2cHandle, &i2cTransaction); // read the register

    printf("version =0x%x\r\n", rxData[0]);//printf the result.

    5. To Write the PMIC register and set the buck3 output voltage to 2.0V

    txData[0] = 0x10; // buck3 output voltage register’s address in PMIC’s datasheet

    txData[1] = 0XC0; //default=0xca,2.3V. 0XC0=2.0V, buck3 output voltage register’s value

     

    i2cTransaction.slaveAddress = 0x60;//PMIC’s address

    i2cTransaction.writeBuf = txData;

    i2cTransaction.writeCount = 2;//need to write the voltage register’s address first, then write the value

    i2cTransaction.readBuf = rxData;

    i2cTransaction.readCount = 0;//it’s no need to read

     

    retVal = I2C_transfer(i2cHandle, &i2cTransaction); // write the register

    You can find more PMIC’s register details in PMIC’s datasheet.

    Regards,

    Wesley

  • Hi Wesley,

    It's very clear for me.
    Thank you.