I've been trying off and on to set up an interrupt on the MMA8653FCR1 accelerometer. I has seemed to be working from time to time, but then it would just not work.
I'm coding in the Energia environment and would appreciate some guidance as to what registers need to be set, and to what values.
Here's precisely what I need:
1. I need to run in low power mode.
2. When there is an abrupt movement detected (2g) I need the sensor to come alive and set an interrupt.
3. Please let me know if the interrupt is setting my pin to high or to low.
4. Is there anything I need to do when I get an interrupt so that future interrupts will fire?
5. I would like the interrupt to fire when I gently shake the board that has the MMA8653FCR1 on it.
Thanks for your assistance,
Curtis
Hello Curtis,
1. In order to set the Low Power Mode, you may refer to the MODS bits from the CTRL_REG2 System Control 2 register.
2. I would like to recommend the following Bare Metal Example project in order to know how to deal with the interrupts:
MMA8652FC - Bare metal example project
3. The interrupt polarity is set at the IPOL bit from the CTRL_REG3 Interrupt Control register.
4. The interrupt is cleared when reading the PL_STATUS register.
5. In case you need to generate an interrupt every time the accelerometer is shaken, I recommend to enable the Freefall/Motion Interrupt at the CTRL_REG4 register.
Please be aware that the Freefall/motion interrupt is routed to the INT2 by default. In order to change it, you may refer to the CTRL_REG5 register.
In order to get more information about the Freefall/Motion configuration and status registers, you may refer to the chapter 6.7 at the MMA8653FC datasheet.
Please let me know if you need more detailed information about setting the Freefall registers.
I hope this information will be useful for you.
If I misunderstood your question, feel free to let me know. I will be glad to help.
Have a great day.
David Diaz.
I found the solution. Here: https://community.freescale.com/thread/378621#comments
For my code, I just needed to have the following methods:
When an event happens, I just call clearInterrupt() and life is groofy. Works like a charm
Thanks for all the help everybody !!!