AnsweredAssumed Answered

MMA8452Q sensor, Interrupt can't triggled

Question asked by James Zhou on Jul 28, 2016

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

Outcomes