Hi,
I am using the MMA8451Q for a project, and I am using just one interrupt pins (INT1). Using CTRL_REG4 and CTRL_REG5, I configured the interrupts from both orientation detection and double pulse events to the same interrupt pin. But for some reason, the accelerometer stops responding after reading a few double tap interrupts.
Is this because, the accelerometer detects a change in orientation at the same time a double pulse event occurs and they both give interrupt events at the same time? If so, how do I fix this? Can I set priority interrupts?
Right now, I am having this issue only when I assign:
CTRL_REG4 = $18
CTRL_REG5 = $18
If I change them both to either $10 or $08, they work fine with no issues. But when both orientation detection and double pulse detection are turned ON, the accelerometer stops responding suddenly.
Can anyone help me out with this issue?
Thank you.
Hi Ramesh,
Could you please post here or send me your source so that I can review it?
Are you using something like this in order to know what event has generated the interrupt and then to deassert it?
IntSource = I2C_ReadRegister(MMA845x_I2C_ADDRESS, INT_SOURCE_REG);
if (IntSource & 0x10) // P/L orientation interrupt?
{
Temp = I2C_ReadRegister(MMA845x_I2C_ADDRESS, PL_STATUS_REG); // Service and clear the P/L orientation interrupt
}
if (IntSource & 0x08) // Pulse interrupt?
{
Temp = I2C_ReadRegister(MMA845x_I2C_ADDRESS, PULSE_SRC_REG); // Service and clear the pulse interrupt
}
Regards,
Tomas
PS: If my answer helps to solve your question, please mark it as "Correct". Thank you.
Hi,
I am actually using the exact same method that you posted. But when there is an interference between pulse and orientation detection, the device hangs. i.e. If I double tap when the accelerometer is in a tilted position, the accelerometer stops working.
How do I prevent this? Is there any way where I can give the pulse event a priority over orientation detection?
Thank you.
Best Regards,
Ramesh
EDIT: I guess I had this problem because I had different ODR frequencies for double tap and orientation detection. I matched the frequency of both and now the accelerometer is working fine.