Hi,
I did MMA8652FC accelerometer configuration to detect motion. However, the interrupt pin does not work, and the recorder is in EA bit FF_MT_SRC 1 and SRC_FF_MT bit is also in 1.
I configured so that the interruption is active in the INT1 pin.
Follows the configuration
Registrador | Valor |
---|---|
XYZ_DATA_CFG | 0x00 |
CTRL_REG1 | (DR=101) |
FF_MT_CFG | 0xF8 |
FF_MT_THS | 0x20 |
FF_MT_COUNT | 0x02 |
CTRL_REG3 | 0xF9 |
CTRL_REG4 | 0xFF |
CTRL_REG5 | 0xFF |
Solved! Go to Solution.
Hi Hugo,
Attached you can find a simple code example for motion detection based on the AN4070.
I hope it helps.
Regards,
Tomas
Hi Hugo,
To clear the SRC_FF_MT interrupt status bit in the INT_SOURCE register (0x0C) and consequently deassert the Freefall/Motion interrupt, it is necessary to read the FF_MT_SRC register. Are you using something like this?
void PORTA_IRQHandler()
{
PORTA_PCR5 |= PORT_PCR_ISF_MASK; // Clear the interrupt flag
Temp = I2C_ReadRegister(MMA8652FC_I2C_ADDRESS, FF_MT_SRC_REG); // Read the FF_MT_SRC register to clear the SRC_FF_MT flag in the INT_SOURCE register and deassert the interrupt
MotionEventCounter++;
}
Also make sure that your GPIO pin connected to the INT1 pin of the MMA8652FC is configured for falling edge interrupts.
I would also recommend to start your experimenting without using the Auto Wake/Sleep function (CTRL_REG3 = 0x00), with only the Motion/Freefall interrupt enabled (CTRL_REG4 = 0x04) and routed to the INT1 pin (CTRL_REG5 = 0x04).
I hope it helps.
Regards,
Tomas
PS: If my answer helps to solve your question, please mark it as "Correct". Thank you.
Hi Tomas,
I made all of these settings, but unfortunately the interruption does not work ... you would have a complete sample configuration that was already made and it worked?
Thank you.
Hi Hugo,
Attached you can find a simple code example for motion detection based on the AN4070.
I hope it helps.
Regards,
Tomas
Hi Tomas,
Thanks for your help. The problem was being in uC interrupt setting. The interruption did not work when placed in open drain and not in pushpull only worked when the pin configured as pullup. The uC that use is PROC of Cypress.