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.

RTOS/CC2650: CC2650 I2C txbuffer Issue

Part Number: CC2650
Other Parts Discussed in Thread: HDC1080

Tool/software: TI-RTOS

Hi, 

I found an example code online, but I am not sure that I understand the following code.I would really appreciate if someone can explain what is txBuffer address should be.

//Read HDC1080 device ID

    txBuffer[0] = 0xFF;

    txBuffer[1] = 0x10;

    txBuffer[2] = 0x00;

    i2cTransaction.slaveAddress = 0x64;//HDC1080 ADDR;

    i2cTransaction.writeBuf = txBuffer;

    i2cTransaction.writeCount = 1;

    i2cTransaction.readBuf = rxBuffer;

    i2cTransaction.readCount = 2;

    if (I2C_transfer(i2c, &i2cTransaction)){

        System_printf("Device ID: %x%x\n", rxBuffer[0], rxBuffer[1]);

    } else {

        System_printf("Device ID fail!\n");

    }

    if (I2C_transfer(i2c, &i2cTransaction)){

        System_printf("Device ID: %x%x\n", rxBuffer[0], rxBuffer[1]);

    } else {

        System_printf("Device ID fail!\n");

    }

Thank you so much. 

  • Hi,

    have you checked the datasheet of the HDC1080? It explains the communication protocol. txBuffer is an array of unsigned characters which contains the register address that you want to access on the sensor followed by extra data. i2cTransaction.writeCount specifies how many bytes of txBuffer are transferred.

    If you are using the TI-RTOS 2.21 SDK, I recommend to have a look at the drivers in the folder <tirtos_cc13xx_cc26xx_2_21_00_06/products/tidrivers_cc13xx_cc26xx_2_21_00_04/packages/ti/mw/sensors>, especially the SensorHdc1000 driver.