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
2025-03-21 1:31 AM
Hi @DPatt.2 ,
"I would expect the OUT_ registers to hold the exact acceleration value that caused the interrupt.", yes it is correct.
Can you try to implement our official drivers just to read the outputs and let me know if you see the shock you are giving?
Thanks
2025-03-21 9:05 AM
Hi,
I have tested my drivers pretty well by writing values to registers and then reading the registers back and have never seen a failure. I setup an automated test and let it run for 2 hours changing the values I write each time and verifying that the values that are read back match those that I wrote. Each time I get an acceleration interrupt I am reading the OUTX_L, OUTX_H, OUTY_L, OUTY_H, OUTZ_L, OUTZ_H, individually one at a time with a 100ms delay between the reads. I am getting what seems to be the proper acceleration values a lot of the times but many times the value I am reading is 0 for the register that I would expect to see a non-zero value in. There are periods of time where it appears to work properly for a while and then just starts exhibiting this "0 in register" behavior.
I should also mention that I am using this same code base with the accelerometer configured differently for 6D detection and it works perfectly for detecting the tilt angle of the sensor, this is a product that is in the field and working very well; it is uses to detect when a roll door is opened or closed. My boss tasked me with creating a new product with the same hardware and firmware base where the new product will detect a violent shock. Just telling you all of this so you know some background for our hardware firmware base that is being used.
Many thanks for your assistance..