2017-06-09 03:56 AM
I want to read the temperature from IIS2DH over I2C
I set the ODR to 1Hz
set the BDU bit in Ctrl Reg 4
enable the Temerature sensor in TEMP_CFG_REG
after the initialization I read the STATUS_REG_AUX and the value of this register is every time 0xFF
and the OUT_TEMP_L and OUT_TEMP_H register are 0x00
2017-06-12 02:25 AM
Please be aware the temperature sensor does not return absolute temperature value. See my answer in this topic
https://community.st.com/0D50X00009XkY6DSAV
it is valid also for the IIS2DH.You configuration is correct, just to be sure, you can share with me the exact value which you write in the registers.
There is a possibility that the ambient temperature is exactly the same as the reference value so the difference is 0 so your measurement would be correct.
Did you try ho heat up or cool down the sensor?
2017-06-12 04:04 AM
we found the problem this morning. A colleg fount a note in a forum. The problem was, that I not set the MSB Bit in the register address to read multiple registers. The values only updated when the two bytes of the measurement values are readed.
2018-07-12 07:02 AM
Dear Kleemann Wolfganag, I have the same problem exactly. Firstly I am reading
OUT_TEMP_H register, then
OUT_TEMP_L register, and combining them (bellow you can see the code). but it is not working. Could you tell me what I need to do in this situation.
Thank you.
int16_t MKI168V1::read(uint8_t addressh, uint8_t addressl)
{ int data, t_data; Wire.beginTransmission(Accel_Address); Wire.write(addressh); Wire.endTransmission(); Wire.requestFrom(Accel_Address, 1); if(Wire.available() > 0) { t_data = Wire.read(); data = t_data << 8; } Wire.beginTransmission(Accel_Address); Wire.write(addressl); Wire.endTransmission(); Wire.requestFrom(Accel_Address, 1); if(Wire.available() > 0) { data |= Wire.read(); } return data;double MKI168V1::getTemperature()
{ double temp; temp = read(OUT_TEMP_H, OUT_TEMP_L); return(temp);}