2018-02-07 05:53 AM
Hi,
I am working on some motion detection product.
LIS2HH12 is chosen as the motion detector. We want to use it in interrupt mode.
Unfortunately, we failed to get any signal on INT1 pin, observing by an o
scilloscope
. What a shame T_T.My configuration sequence is as follow, could you please help to give some advice?
// startup checking SPI bus
GSENSOR::LIS2HH_set_mode: WHO_AM_I = 41 [spi] // reset the chip GSENSOR::LIS2HH_set_mode: RESET // read regs to check reset status GSENSOR::LIS2HH_set_mode: STATUS = FF [spi] GSENSOR::LIS2HH_set_mode: CTRL5 = 00 [spi]// setup
GSENSOR::LIS2HH_set_mode: CTRL1 = 3F [spi] GSENSOR::LIS2HH_set_mode: CTRL2 = 00 [spi] GSENSOR::LIS2HH_set_mode: CTRL3 = 09 [spi] GSENSOR::LIS2HH_set_mode: CTRL4 = 04 [spi] GSENSOR::LIS2HH_set_mode: CTRL5 = 00 [spi] GSENSOR::LIS2HH_set_mode: CTRL7 = 0C [spi] // check GSENSOR::LIS2HH_set_mode: STATUS = FF [spi] GSENSOR::LIS2HH_set_mode: INT_SRC1 = 25 [spi] GSENSOR::LIS2HH_set_mode: INT_SRC2 = 00 [spi] GSENSOR::LIS2HH_set_mode: STATUS = FF GSENSOR::LIS2HH_set_mode: val[0] = -437, x = -26.657000 mg GSENSOR::LIS2HH_set_mode: val[1] = -169, y = -10.309000 mg GSENSOR::LIS2HH_set_mode: val[2] = -16427, z = -1002.047000 mg♯♯#interrupt-driven #lis2hh122018-02-16 02:32 AM
Comments to you configuration:
- GSENSOR::LIS2HH_set_mode: CTRL3 = 09 [spi] ... enables Interrupt generator 1 and DRDY on pin INT1 (not good to mix the two signals)
- GSENSOR::LIS2HH_set_mode: CTRL7 = 0C [spi] ... enables Interrupt generator 1 and FIFO empty in INT2 (why ???)
- Missing interrupt generator configuration IG_CFG1, IG_THS_X1, IG_THS_Y1, IG_THS_Z1, IG_DUR1
So I recommend to start with following configuration:
CTRL1 = 0x3F // 100Hz, X,Y,Z enable, BDU enable
CTRL2 = 0x02 // High pass filter enabled for Interrupt generator 1. To detect a motion only change in acceleration is needed.
CTRL3 = 0x08 // Enable interrupt generator in INT1
CTRL4 = 0x04
CTRL5 = 0x00
CTRL7 = 0x00
IG_CFG1 = 0x2A // Interrupt condition X or Y or Z is above threshold
IG_THS_X1 = IG_THS_Y1 = IG_THS_Z1 = 0x0D // Set the threshold to 100mg (adjust according to you needs)
IG_DUR1 = 0x0A // Set duration to 100ms (adjust according to you needs)