Skip to main content
YGail.2
Associate III
January 15, 2023
Solved

How to activate auto-increment for lps25hb?

  • January 15, 2023
  • 1 reply
  • 1129 views

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.

This topic has been closed for replies.
Best answer by YGail.2

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

1 reply

gbm
Principal
January 15, 2023

LPS25HB datasheet, section 6.2.1, 4th paragraph.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
YGail.2
YGail.2Author
Associate III
January 15, 2023

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