AnsweredAssumed Answered

MMA8652 Interrupt Configuration

Question asked by Tuurbo 46 on Feb 29, 2016
Latest reply on Mar 7, 2016 by Tomas Vaverka

Hi Tomas,


I am still on my first attempt at getting the MMA8652 chip going.  I can talk to the chip and get Who_AM_I back, but I can get no further.


Now I am working through the example code, but when I run the below example with "Enable DRDY Interrupt = 0x01" the interrupt I/O pin is pulled constantly low, it never resets.  When I set "Enable DRDY Interrupt = 0x00" my interrupt pin stays high no matter how i move the chip.  Are any other initialisation steps required, or can you think what else I may need to test.






void MMA8652FC_Init (void)


     I2C_WriteRegister(MMA8652FC_I2C_ADDRESS, CTRL_REG2, 0x40);          // Reset all POR values


     Pause(0x631);          // ~1ms delay


     I2C_WriteRegister(MMA8652FC_I2C_ADDRESS, XYZ_DATA_CFG_REG, 0x00);   // +/-2g range with ~0.977mg/LSB

     I2C_WriteRegister(MMA8652FC_I2C_ADDRESS, CTRL_REG2, 0x02);          // High Resolution mode

     I2C_WriteRegister(MMA8652FC_I2C_ADDRESS, CTRL_REG3, 0x00);          // Push-pull, active low interrupt

    I2C_WriteRegister(MMA8652FC_I2C_ADDRESS, CTRL_REG4, 0x01);          // Enable DRDY interrupt

     I2C_WriteRegister(MMA8652FC_I2C_ADDRESS, CTRL_REG5, 0x01);          // DRDY interrupt INT1 - PTA5

     I2C_WriteRegister(MMA8652FC_I2C_ADDRESS, CTRL_REG1, 0x39);          // ODR = 1.56Hz, Active mode