AnsweredAssumed Answered

MMA8452Q Accelerometer Motion Detection Issue

Question asked by Pallavi Ingole on Apr 27, 2018
Latest reply on May 3, 2018 by Tomas Vaverka

Hi,

 

 

I am using MMA8452Q Accelerometer with imx6ULL for my project and programming it using linux platform.

I am trying to get the motion detection of accelerometer, for achieving this I have done below register settings in user space:

 

Step 1: Put the device into Standby Mode: Register 0x2A CTRL_REG1
IIC_RegWrite(0x2A, 0x18); //Set the device in 100 Hz ODR, Standby
Step 2: Set Configuration Register for Motion Detection by setting the “OR” condition OAE = 1, enabling
X, Y, and the latch
IIC_RegWrite(0x15, 0xD8)
Step 3: Threshold Setting Value for the Motion detection of > 3g
Note: The step count is 0.063g/ count
• 3g/0.063g = 47.6; //Round up to 48
IIC_RegWrite(0x17, 0x30)
Step 4: Set the debounce counter to eliminate false readings for 100 Hz sample rate with a requirement
of 100 ms timer.
Note: 100 ms/10 ms (steps) = 10 counts
IIC_RegWrite(0x18, 0x0A);
Step 7: Put the device in Active Mode

IIC_RegWrite(0x2A, 0x19);

and then I am continuously reading the Register 0x16 (FF_MT_SRC) and ( INT_SOURCE) for detecting the motion. I am trying to check 7th bit of this register which is EA bit. This bit should set when there is motion event occurs.

 

But my test results are as below:

 

Getting Read value from register as 0x1 - when the accelerometer is stable and not moving.

and Read value from register as 0x0 - when any little movement in accelerometer is there.

 

 

But this is not the expected output as my EA bit is never getting set and the value I am reading from FF_MT_SRC register is 0x1 or 0x0, no value change except these two.

 And read value of  INT_SOURCE register is 0x0 always.

 

Please let me know, what changes needs to be done to get correct value

 

 

Thanks in advance.

 

 

 

Regards,

Pallavi

Outcomes