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.

HDC2080: Can't read Temperature/RH data from HDC2080 with CC3220MODASF

Part Number: HDC2080

Hi,

 We are using HDC2080 sensor with CC3220MODASF in our custom PCB. I can able to read/write  all the registers from HDC2080 and are write values but always getting the temperature of LSB=0 and MSB=0. Please any one help us to make it finish. See my code here

                
    uint16_t        temperature;
    uint8_t         txBuffer[1];
    uint8_t         rxBuffer[2];
    I2C_Handle      i2c;
    I2C_Params      i2cParams;
    I2C_Transaction i2cTransaction;

                txBuffer[0] = 0x00;
                i2cTransaction.slaveAddress = 0x40;
                i2cTransaction.writeBuf = txBuffer;
                i2cTransaction.writeCount = 1;
                while(!(I2C_transfer(i2c, &i2cTransaction)));


                usleep(7000);


                i2cTransaction.slaveAddress = 0x40;
                i2cTransaction.readBuf = rxBuffer;
                i2cTransaction.readCount = 2;
                while(!(I2C_transfer(i2c, &i2cTransaction)));

                UART_PRINT("L = %d \r\n", rxBuffer[0]);
                UART_PRINT("H = %d \r\n", rxBuffer[1]);



        temperature = rxBuffer[1];
        temperature = (temperature << 8)|rxBuffer[0];
        float newtemperature = (((float)temperature/65536) * 165)-40;
        UART_PRINT("Temperature = %f ('C) \r\n", newtemperature);

Before and after reading I am trying to read DRDY reg 0x04 its giving val 0x80 before read of temperature data and after read also.

I also tried by changing the config of MEASUREMENT CONFIGURATION reg 0x0F to 0x74 and did soft reset also by RESET&DRDY/INT CONF reg 0x0E by val 0x80.

my code:

        txBuffer[0] = 0x0E;
        txBuffer[1] = 0x80;
        i2cTransaction.slaveAddress = 0x40;
        i2cTransaction.writeBuf = txBuffer;
        i2cTransaction.writeCount = 2;
        while(!(I2C_transfer(i2c, &i2cTransaction)));


        txBuffer[0] = 0x0F;
        txBuffer[1] = 0x02;
        i2cTransaction.slaveAddress = 0x40;
        i2cTransaction.writeBuf = txBuffer;
        i2cTransaction.writeCount = 2;
        while(!(I2C_transfer(i2c, &i2cTransaction)));

Thank you

  • Hello Raghunath

    To trigger a conversion you would need to write 0x03 to the register address 0x0F, then wait for the conversion time for temperature and read 0x00 register. Can you try the following instead.

    txBuffer[0] = 0x00;
    txBuffer[1] = 0x03;
    i2cTransaction.slaveAddress = 0x40;
    i2cTransaction.writeBuf = txBuffer;
    i2cTransaction.writeCount = 2;
    while(!(I2C_transfer(i2c, &i2cTransaction)));

    usleep(7000);

    txBuffer[0] = 0x00;
    i2cTransaction.slaveAddress = 0x40;
    i2cTransaction.writeBuf = txBuffer;
    i2cTransaction.readBuf = rxBuffer;
    i2cTransaction.writeCount = 1;
    i2cTransaction.readCount = 2;
    while(!(I2C_transfer(i2c, &i2cTransaction)));

    Also please do log the I2C Transaction on the bus via scope of logic analyzer