Z-axis unwanted interrupt on FXLS8471

cancel
Showing results for 
Search instead for 
Did you mean: 

Z-axis unwanted interrupt on FXLS8471

Jump to solution
308 Views
reubenn
Contributor I

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.

0 Kudos
1 Solution
116 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi Reuben,

For your application I recommend using the transient detection embedded function with the high-pass filter enabled (TRAN_HPF_BYP bit = 0). This will allow you to eliminate the effect of gravity. For more information on how to use and configure the transient detection function please refer to our AN4071 or AN4461.

Let me know if you have any other questions.

Regards,

Tomas

PS: If my answer helps to solve your question, please mark it as "Correct". Thank you.

View solution in original post

0 Kudos
2 Replies
117 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi Reuben,

For your application I recommend using the transient detection embedded function with the high-pass filter enabled (TRAN_HPF_BYP bit = 0). This will allow you to eliminate the effect of gravity. For more information on how to use and configure the transient detection function please refer to our AN4071 or AN4461.

Let me know if you have any other questions.

Regards,

Tomas

PS: If my answer helps to solve your question, please mark it as "Correct". Thank you.

View solution in original post

0 Kudos
116 Views
reubenn
Contributor I

Tomas, thanks for pointing me in the right direction !

Got it to work with transient motion detection ! The app notes helped a lot, though I must say that the limit of 0.063 is quite less !

0 Kudos