cancel
Showing results for 
Search instead for 
Did you mean: 

How to activate auto-increment for lps25hb?

YGail.2
Associate III

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.

1 ACCEPTED SOLUTION

Accepted Solutions
YGail.2
Associate III

No I have to change the most significant bit of ​LPS25HB_TEMP_OUT_L hence something like this 0x80 | LPS25HB_TEMP_OUT_L

View solution in original post

3 REPLIES 3
gbm
Lead III

LPS25HB datasheet, section 6.2.1, 4th paragraph.

YGail.2
Associate III

If understand correctly, I have to change the LPS25HB_I2C_ADD_H adress of the sensor?

YGail.2
Associate III

No I have to change the most significant bit of ​LPS25HB_TEMP_OUT_L hence something like this 0x80 | LPS25HB_TEMP_OUT_L