MMA8452Q sensor, Interrupt can't triggled

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MMA8452Q sensor, Interrupt can't triggled

734 Views
jamesjzhou
Contributor I

Hi;

I am writing code to test your MMA8452Q sensor. Somehow I can't get the interrupt trigged. I wrote the code based on your sample in the document "Motion new AN4070.PDF", chapter 6.1 Example steps for configuring motion detection. But there is no interrupt trigged when I move the sensor. Here is the code:

 

if(MMA8452Q_setWakeSample_internal(MMA8452Q_WAKESAMPLE_100))

return 1;

if(MMA8452Q_setWakeOSM_internal(MMA8452Q_WAKEOVERSAMPLEMODE_NORMAL))

return 1;

if(MMA8452Q_setFFMTParameters_internal(MMA8452Q_ELE_ENABLED,MMA8452Q_FFMT_MT,MMA8452Q_FFMTAXIS_X|MMA8452Q_FFMTAXIS_Y))

return 1;

/*Motion detection of > 3g,The step count is 0.063g/ count,3g/0.063g = 47.6; //Round up to 48(0X30)*/

if(MMA8452Q_setFFMTThreshold_internal(0X30))

return 1;

/*100 Hz sample normal mode steps is 10ms,100 ms timer,100 ms/10 ms (steps) = 10(0X0A) counts*/

if(MMA8452Q_setFFMTDebounce_internal(0X0A))

return 1;

if(MMA8452Q_setInterrputIPOL(FALSE))

return 1;

if(MMA8452Q_setInterrputPPOD(TRUE))

return 1;

if(MMA8452Q_setInterrput_internal(MMA8452Q_INTERRUPT_FF_MT))

return 1;

if(MMA8452Q_setInterrputRout_internal(MMA8452Q_INTERRUPT_FF_MT))

return 1;

if(MMA8452Q_setFullSacle_internal(MMA8452Q_FULLSCALE_4G))

return 1;

if(MMA8452Q_setActive())

return 1;

I also checked the register value of 0x2A, 0x15, 0x17, 0x18, 0x2D, 0x2E. They matched with your sample steps setting.

Please advice. Thanks.

 

James

Original Attachment has been moved to: MMA8452Q.rar

0 Kudos
3 Replies

482 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi James,

A couple of suggestions that might help:

1. Since PP_OD = 1 (open drain), do not forget to use a pull-up resistor on the INT pin.

2. Since IPOL = 0 (active low), make sure that your MCU interrupt pin is configured as GPIO with an interrupt on falling edge.

3. Try to decrease the threshold value to 1.25g (0x14) for example.

4. In your ISR you need to acknowledge an IRQ and read the FF_MT_SRC register to clear the SRC_FF_MT bit in the INT_SOURCE register (0x0C) and deassert the INT pin.

Regards,

Tomas

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

0 Kudos

482 Views
jamesjzhou
Contributor I

Hi Tomas;Thank you very much for your suggestions. It is very helpful. We make the interrupt triggled after reduce the threshold to 0.5g.

However, 0.5g maybe is not useful for real situation. But I can't make it work even using 1.0g with my testing board. Do you have any guidline document about how to setup the parameters?

Thanks again.

Best Regards

James

-


On Fri, 29 Jul 2016 01:35:00 -0700 TomasVaverka <admin@community.freescale.com> wrote -


NXP Community

MMA8452Q sensor, Interrupt can't triggled

reply from Tomas Vaverka in Sensors - View the full discussion

Hi James,

A couple of suggestions that might help:

1. Since PP_OD = 1 (open drain), do not forget to use a pull-up resistor on the INT pin.

2. Since IPOL = 0 (active low), make sure that your MCU interrupt pin is configured as GPIO with an interrupt on falling edge.

3. Try to decrease the threshold value to 1.25g (0x14) for example.

4. In your ISR you need to acknowledge an IRQ and read the FF_MT_SRC register to clear the SRC_FF_MT bit in the INT_SOURCE register (0x0C) and deassert the INT pin.

Regards,

Tomas

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

Reply to this message by replying to this email, or go to the message on NXP Community

Start a new discussion in Sensors by email or at NXP Community

Following MMA8452Q sensor, Interrupt can't triggled in these streams: Inbox

This email was sent by NXP Community because you are a registered user.

You may unsubscribe instantly from NXP Community, or adjust email frequency in your email preferences

0 Kudos

482 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi James,

It is up to you to experiment with both the threshold and debounce counter settings to best fit your application. 

You might also consider using the transient detection function which analyzes high-pass filtered data, eliminating the DC tilt offset (effect of gravity). Take a look at our AN4071 for more information.

Regards,

Tomas

0 Kudos