This is my first post here.
I have a system which has an FXLS8471 interfaced to a uController via SPI, and have connected INT1 to an interrupt pin of the uController.
I've successfully got FXLS8471 to initialise, respond and interrupt.
What I need specifically is motion detection.
My code is :
// FXLS8471Q internal register addresses
#define FXLS8471Q_STATUS (0x00)
#define FXLS8471Q_INT_SOURCE_REG (0x0C)
#define FXLS8471Q_WHOAMI (0x0D)
#define FXSL8471Q_FF_MT_CFG_REG (0x15)
#define FXLS8471Q_FF_MT_SRC_REG (0x16)
#define FXSL8471Q_FT_MT_THS_REG (0x17)
#define FXSL8471Q_FF_MT_COUNT_REG (0x18)
#define FXSL8471Q_ASLP_COUNT_REG (0x29)
#define FXLS8471Q_CTRL_REG1 (0x2A)
#define FXLS8471Q_CTRL_REG2 (0x2B)
#define FXLS8471Q_CTRL_REG3 (0x2C)
#define FXLS8471Q_CTRL_REG4 (0x2D)
#define FXLS8471Q_CTRL_REG5 (0x2E)
// Go to STANDBY just in case
// Reg15:0xD8: 0b1101 1000
// Reg17:0x30 = 0b0011 0000
// Reg18:0x0A = 0b0000 1010
// enable motion detection interrupts
// route FFMT interrupt to INT1
// enable ffmt as a wake-up source, make interrupt active low
Accelerometer_RegWrite(FXLS8471Q_CTRL_REG3, WAKE_FF_MT_MASK );
// set Active mode
Accelerometer_RegRead(FXLS8471Q_CTRL_REG1, dataBuff, 1);
dataBuff |= (ACTIVE_MASK);
As you can see, in Reg15, I've set interrupt only for XEFE_MASK and YEFE_MASK and enabled motion detection interrupts in CtrlReg4.
If I shake the system I get an interrupt on the uController pin.
Now my problem is this :
Everything works fine if the system makes an angle of roughly 25° with the ground, i.e. if the system is not tilted too much.
If I tilt the system beyond a certain point, I get an interrupt !!
Is my code right?
If not, what am I doing wrong ? I need motion detection, not tilt detection.
Also, there's no guarantee that my system will be installed parallel to the ground once sold to the end customer.