2025-03-20 8:24 AM
I am using the HP filter and have the device configured for inertial detection using the HP filter. I have the INT1_CFG register set to 0x2A so the device will interrupt when a HIGH event is detected on the X, Y, or Z axis. The device does reliably interrupt me when I bang my board on my desk. When the interrupt happens I read the INT1_SRC register to see what axis's the inertia was detected on that caused the interrupt. I then wait a complete second before proceeding so I am sure the acceleration data has made it's way to the proper registers. I then look at the XH, YH, and ZH bits to see which axis's caused the interrupt. If the XH bit is set I read the OUT_XL and OUT_XH registers to get the acceleration value; I do the same for the YH and ZH bits reading the corresponding OUT_ registers. The issue is that more often than not the OUT_X, OUT_Y, and OUT_Z registers are set to 0 when I read them. I would expect the OUT_ registers to hold the exact acceleration value that caused the interrupt. After each interrupt I completely re-configure the accelerometer. My accelerometer setup is as follows:
Write 0x90 to CTRL_REG0
Write 0x3F to CTRL_REG1
Write 0xC9 to CTRL_REG2
Write 0x40 to CTRL_REG3
Write 0x90 to CTRL_REG4
Write 0x08 to CTRL_REG5
Write 0x00 to CTRL_REG6
Write 0x14 to INT1_THS
Write 0x00 to INT1_DURATION
Read the REFERENCE register
Write 0x2A to INT1_CFG
Write 0x00 to INT2_THS
Write 0x00 to INT2_DURATION
Write 0x00 to INT2_CFG