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