2023-01-15 04:14 AM
I'm using a nucleo f401re with a lps25hb. Currently I'm getting very wrong values, this is caused by the reading of the registers.
For example when I call the registers of temperature which is composed by two bytes
HAL_I2C_Mem_Read(&hi2c1, LPS25HB_I2C_ADD_H, LPS25HB_TEMP_OUT_L,
I2C_MEMADD_SIZE_8BIT, bufp, 2, 1000);
It only reads the LPS25HB_TEMP_OUT_L to the bufp p array. If I call the two registers LPS25HB_TEMP_OUT_L and LPS25HB_TEMP_OUT_H separately, it works fine. Therefore I doubt I missed something in the auto-incremental register address setting of the sensor.
Thx in advance.
Solved! Go to Solution.
2023-01-15 06:00 AM
No I have to change the most significant bit of LPS25HB_TEMP_OUT_L hence something like this 0x80 | LPS25HB_TEMP_OUT_L
2023-01-15 04:57 AM
LPS25HB datasheet, section 6.2.1, 4th paragraph.
2023-01-15 05:43 AM
If understand correctly, I have to change the LPS25HB_I2C_ADD_H adress of the sensor?
2023-01-15 06:00 AM
No I have to change the most significant bit of LPS25HB_TEMP_OUT_L hence something like this 0x80 | LPS25HB_TEMP_OUT_L