Hi Nick,
The A_FFMT_THS_X/Y/Z MSB and LSB registers (0x73 – 0x78) are used by both the freefall/motion detection and the transient detection functional blocks to set independent threshold values for each axis with the same resolution as the accelerometer output data determined by fs[1:0] bits of the XYZ_DATA_CFG register. For example, if fs[1:0] = 0b00 (±2g), the resolution of the A_FFMT_THS_X/Y/Z registers is 0.244 mg/LSB, if fs[1:0] = 0b10 (±8g), the resolution is 0.976 mg/LSB. As you correctly noted, the threshold values stored in the A_FFMT_THS_X/Y/Z registers are used by the transient detection functional block if the a_ffmt_trans_ths_en bit of the A_FFMT_THS_Y_MSB register is set high.
Example setting for Z > 31.25mg, 2g mode, 800Hz ODR, High resolution and Low noise:
I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, CTRL_REG2, 0x40); // Reset all registers to POR values
Pause(0x631); // ~1ms delay
I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, XYZ_DATA_CFG_REG, 0x00); // ±2g range with 0.244mg/LSB
I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, M_CTRL_REG1, 0x00); // Accelerometer only mode
I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, TRANSIENT_CFG_REG, 0x18); // Enable transient detection for Z axis, latch enabled
I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, A_FFMT_THSY_MSB_REG, 0x80); // Use threshold values from A_FFMT_THS_Z registers
I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, A_FFMT_THSZ_MSB_REG, 0x02); // Set threshold to about 31.25mg (31.25mg / 0.244mg = 128 = 0b10000000)
I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, A_FFMT_THSZ_LSB_REG, 0x00);
I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, TRANSIENT_COUNT_REG , 0x00); // Set debounce to zero
I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, CTRL_REG2, 0x02); // High Resolution mode
I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, CTRL_REG3, 0x00); // Push-pull, active low interrupt
I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, CTRL_REG4, 0x20); // Transient interrupt enabled
I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, CTRL_REG5, 0x20); // Transient interrupt routed to INT1 - PTD4
I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, CTRL_REG1, 0x05); // ODR = 800Hz, Reduced noise, Active mode
I will send you the complete example project on Monday as soon as I double check it in the lab.
Regards,
Tomas