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/LAUNCHXL-CC1310: cc1310 collect data from temperature sensor tmp112

Part Number: LAUNCHXL-CC1310
Other Parts Discussed in Thread: TMP112

Tool/software: TI-RTOS

I want to ask a question:

I2ctmp007 example according to modify parameters, with TMP112 by I2C communication, cannot succeed

         Can you give me some advice?

  • Can you specify where you get stuck?
  • thanks for your answer,
    get it from simplelink_cc13x0_sdk_1_30_00_06
  • I mean your revise the I2C for TMP112 right? Please elaborate what problem you see.
  • /* Create I2C for usage */
    I2C_Params_init(&i2cParams);
    i2cParams.bitRate = I2C_400kHz;
    i2c = I2C_open(Board_I2C_TMP, &i2cParams);
    if (i2c == NULL) {
    while (1);
    }

    txBuffer[0] = 0x00;// modify temperature sensor value register command
    i2cTransaction.slaveAddress = 0x90; // modify slave address
    i2cTransaction.writeBuf = txBuffer;
    i2cTransaction.writeCount = 1;
    i2cTransaction.readBuf = rxBuffer;
    i2cTransaction.readCount = 2;

    if (I2C_transfer(i2c, &i2cTransaction)) {
    temperature = (rxBuffer[0] << 4) | (rxBuffer[1] >> 4);
  • Where are the following codes came from?

    txBuffer[0] = 0x00;// modify temperature sensor value register command
    i2cTransaction.slaveAddress = 0x90; // modify slave address
    i2cTransaction.writeBuf = txBuffer;
    i2cTransaction.writeCount = 1;
    i2cTransaction.readBuf = rxBuffer;
    i2cTransaction.readCount = 2;

    if (I2C_transfer(i2c, &i2cTransaction)) {
    temperature = (rxBuffer[0] << 4) | (rxBuffer[1] >> 4);
  • From i2ctmp007 example in simplelink_cc13x0_sdk_1_30_00_06
  • You should revise I2C command according to TMP112 datasheet.
  • YiKai Chen

    Thank you for your patience to answer.

    I don't understand how TI_ROTS i2c is work, Other MCU, I am such processing as follows:

    uint16 ReadTemp(void)
    {
    uint8 valh=0;
    uint8 vall=0;
    uint16 sum=0;
    //float temp;

    sum =0;
    I2C_Start(); //启动I2C总线

    if(I2C_SendByte(0x90)) ; //发送器件从地址(写)

    if(I2C_SendByte(0x00)) ; //发送器件温度寄存器子地址

    I2C_Start();
    if(I2C_SendByte(0x91)); //发送器件从地址(读)

    valh = I2C_ReadByte(); //读温度高位
    I2C_SendAck(0);

    vall = I2C_ReadByte(); //读温度低位
    I2C_SendAck(1);

    I2C_Stop();

    sum |= valh;
    sum <<=8;
    sum |= vall;
    sum >>= 4;

    return sum;
    }

    Only in TI_RTOS I2C_transfer().