Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Bug in lps22hb driver

Hi,

In SDK 15.3 I have found a bug in internal implementation of the lps22hb external driver.

Bug description:
Unable to set properly a INT_S[2:1] bits in CTRL_REG3 register which is a INT_DRDY pin configuration.

File: lps22hb_internal.h
Source code fragment in topic:

#define LPS22HB_INTERNAL_DRDY_CFG(_s, _activ, _pp_od, _fss, _fth, _ovr, _drdy, _high, _low)        \
    NRF_TWI_SENSOR_REG_SET(_s.ctrl_reg[2], LPS22HB_INT_H_L_MASK, LPS22HB_INT_H_L_POS, _activ);     \
    NRF_TWI_SENSOR_REG_SET(_s.ctrl_reg[2], LPS22HB_PP_OD_MASK, LPS22HB_PP_OD_POS, _pp_od);         \
    NRF_TWI_SENSOR_REG_SET(_s.ctrl_reg[2], LPS22HB_F_FSS5_MASK, LPS22HB_F_FSS5_POS, _fss);         \
    NRF_TWI_SENSOR_REG_SET(_s.ctrl_reg[2], LPS22HB_F_FTH_MASK, LPS22HB_F_FTH_POS, _fth);           \
    NRF_TWI_SENSOR_REG_SET(_s.ctrl_reg[2], LPS22HB_F_OVR_MASK, LPS22HB_F_OVR_POS, _ovr);           \
    NRF_TWI_SENSOR_REG_SET(_s.ctrl_reg[2],                                                         \
                           LPS22HB_INT_S_MASK,                                                     \
                           LPS22HB_INT_S_MASK,                                                     \
                           (_low << 1) + _high);

The problem exist in the last register set:

NRF_TWI_SENSOR_REG_SET(_s.ctrl_reg[2],                                                         \
                           LPS22HB_INT_S_MASK,                                                     \
                           LPS22HB_INT_S_MASK,                                                     \
                           (_low << 1) + _high);

In use of 'NRF_TWI_SENSOR_REG_SET()' at third parameter - which should be a bit position, need to pass a 'LPS22HB_INT_S_POS' instead of 'LPS22HB_INT_S_MASK'

Related