AnsweredAssumed Answered

Z-axis unwanted interrupt on FXLS8471

Question asked by Reuben Noronha on Jun 9, 2015
Latest reply on Jun 11, 2015 by Reuben Noronha

Hello All,

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)

 

int dataBuff[2];

 

// Go to STANDBY just in case

Accelerometer_StandbyActivate();

 

// Reg15:0xD8: 0b1101 1000

Accelerometer_RegWrite(FXSL8471Q_FF_MT_CFG_REG, XEFE_MASK|YEFE_MASK|ELE_MASK|OAE_MASK);

 

// Reg17:0x30 = 0b0011 0000

Accelerometer_RegWrite(FXSL8471Q_FT_MT_THS_REG, 0x5);

 

// Reg18:0x0A = 0b0000 1010

Accelerometer_RegWrite(FXSL8471Q_FF_MT_COUNT_REG, 0x01);

 

// enable motion detection interrupts

Accelerometer_RegWrite(FXLS8471Q_CTRL_REG4, INT_EN_FF_MT_MASK);

 

// route FFMT interrupt to INT1

Accelerometer_RegWrite(FXLS8471Q_CTRL_REG5, INT_CFG_FF_MT_MASK);

 

// 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[0] |= (ACTIVE_MASK);

Accelerometer_RegWrite(FXLS8471Q_CTRL_REG1, dataBuff[0]);

 

 

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.

Outcomes