I am trying to create a transient event using the FXLS8417Q. I have been following the AN4461, and although it is written for a different chip, it seems to be similar.
I have this code:
AccelWriteByte(ACCEL_CTRL_REG2_REG, ACCEL_CTRL_REG2_RST_BIT); // reset chip
while(AccelReadByte(ACCEL_CTRL_REG2_REG) & ACCEL_CTRL_REG2_RST_BIT);
AccelWriteByte(ACCEL_TRANSIENT_THS_REG, 0x8f); // should trigger on >0.945g
AccelWriteByte(ACCEL_TRANSIENT_COUNT_REG, 0x1); // debounce of 1
AccelWriteByte(ACCEL_TRANSIENT_CFG_REG, (ACCEL_TRANSIENT_CFG_ELE_BIT | ACCEL_TRANSIENT_CFG_ZEFE_BIT | ACCEL_TRANSIENT_CFG_YEFE_BIT | ACCEL_TRANSIENT_CFG_XEFE_BIT | ACCEL_TRANSIENT_CFG_HPF_BYP_BIT)); // trigger on any axis, high pass bypassed
AccelWriteByte(ACCEL_CTRL_REG4_REG, ACCEL_CTRL_REG4_INT_EN_TRANS_BIT); // enable transient interrupt
AccelWriteByte(ACCEL_CTRL_REG5_REG, ACCEL_CTRL_REG5_INT_CFG_TRANS_BIT); // route transient interrupt to INT1
AccelWriteByte(ACCEL_CTRL_REG1_REG, (ACCEL_CTRL_REG1_DATA_RATE_50HZ | ACCEL_CTRL_REG1_ACTIVE_BIT)); // set for 50 Hz ODR, set to active
I can't get any event to happen, even if I enable the high pass filter. No interrupt occurs, and no event is ever reported in the TRANSIENT_SRC_REG when shaking or bumping the board. I have even tried adjusting the threshold to the minimum, but nothing ever happens.
I know the accelerometer is working because with this code:
byDummy = AccelReadByte(ACCEL_WHO_AM_I_REG);
AccelWriteByte(ACCEL_CTRL_REG1_REG, 0x0); // set to standby
AccelWriteByte(ACCEL_XYZ_DATA_CFG_REG, byFSRange); // set full scale range
AccelWriteByte(ACCEL_CTRL_REG1_REG, (ACCEL_CTRL_REG1_DR(ACCEL_CTRL_REG1_DATA_RATE_200HZ) | ACCEL_CTRL_REG1_LNOISE_BIT | ACCEL_CTRL_REG1_ACTIVE_BIT)); // set for 200Hz ODR, set active
I can read live accelrometer data from the FIFO that is reporting correctly.
What am I missing?
Solved! Go to Solution.
Thank you Tomas, I think I got it working. I don't think it liked the software reset from the app note, I think it stopped talking SPI when I did that because I couldn't even read the ID byte. I took out the software reset and I get the interrupt now. Thank you!