• TI Thinks Resolved

HDC2080: Not getting correct temperature values when connected to cc2538

Part Number: HDC2080


My HDC2080 sensor is not giving correct temperature values when connected to cc2538 with Z-Stack environment.
The temperature values are fluctuating and not correct either.

Below is my initialization, i have referred the HDC2082 application note snaa312.pdf.

My i2c bus is communicating properly with other sensors. HDC2080 Configured for single Acquisition configuration

#define HDC2080_ADDRESS                     0x82  //As my address pin is connected to VDD.

uint8 opt_buf_start[2]={0x0E,0x00}; uint8 opt_buf1_start[2]={0x0F,0x00};

void HDC_Init(void){

  HalI2CSendMultiple(HDC2080_ADDRESS, opt_buf_start, 2);
  HalI2CSendMultiple(HDC2080_ADDRESS, opt_buf1_start, 2);

uint8 addr1 = 0x00; uint16 total,degree;
uint8 opt_buf[2]={0x0F, 0x01}; uint8 temp_hu[4];

void HDC2080_Testing(void)
/*********    HDC SENSOR TESTING    ****************/
  HalI2CSendMultiple(HDC2080_ADDRESS, opt_buf, 2);

HDC_WaitUs(2000); //2 msec delay as per application sheet HalI2CSend(HDC2080_ADDRESS, &addr1, 1); HalI2CReceiveMultiple(HDC2080_ADDRESS, temp_hu, 4); total =(temp_hu[1] <<8) + temp_hu[0]; degree = ((total)/pow(2,16))*165-40; }

Please correct if my initialization process is wrong or something missing.

Thank you

  • Hello Akshay,

    When configuring the HDC2080 for beginning measurement the configuration register must be set as 0x01 to start the measurement and then after 2 ms the data should be read back.

    Also when reading the data back can you check the raw value of the temp_hu variable?

    Lastly by what value is the temp fluctuating?


    Amit Ashara

  • In reply to Amit Ashara:

    Hello Amit,

    I was following the same procedure as you mentioned but didn't got correct values and the values are fluctuating drastically.

    Yes i am reading the raw values for temp_hu , where temp_hu [0] is Low value and temp_hu [1] is high value for temperature. I can observe that the high value is changing for every reading and the Low value remains stable.

    As per application manual for HDC2080 total =(temp_hu[1] <<8) + temp_hu[0]; this line is correct to convert temp raw value to 16 bit.

    So what can be the reason i am not able to get correct output ?

    I guess that it might be caused due to high value for temperature is changing & Low value is stable, though it should be vice versa.
  • In reply to akshay b:

    Hello Akshay,

    When reading the data, the values are read out LSB first. Hence the temp_hu[0] should be the lower byte and temp_hu[1] should be the higher byte. However there could be something being done in the SW layer that my be swapping the values. To double check that, I would suggest hooking up a Scope or LA to the I2C bus and putting a break point on the read function. Then step over the function and capture the data on scope/LA and read the variables to compare the value that you see on the scope v/s the variable to see how SW manipulates the data (if any). Do please put the scope snapshot as well in your response.


    Amit Ashara