MMA8653FC read data error

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MMA8653FC read data error

Jump to solution
781 Views
roysit
Contributor I

Hi,all

     I set the ODR to 50HZ, and use INT1 ping to trigger a data read. Since my CPU can only set to use rising/falling edge interrupt. so I need to read data several time before INT1 pin go high. Everything go whell when I only read back data and return the interrupt quickly. But if I Insert a data calculate function in the interrupt service function the chip would  be  not ACK for I2C data read after server Interrupt.

    Is there something wrong?

Best Regards,

Roy

Labels (1)
0 Kudos
1 Solution
576 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Roy,

The MMA8653FC signals an interrupt by driving the INTx output either low or high depending on the setting of the IPOL bit in the CTRL_REG3 register. A selected interrupt pin on your MCU needs to be configured in accordance with this setting (falling edge or rising edge). To deassert the interrupt on the MMA8653FC, it is necessary to read the appropriate status register for the embedded functions or X, Y, Z data output registers (0x01 - 0x06) for the DRDY and FIFO. I do not recommend to perform these I2C reads and any operations with the data in ISRs, I would leave it up to non-interrupt code. It is a good practice to keep ISRs as short as possible.


I hope it helps.


Regards,

Tomas

View solution in original post

0 Kudos
2 Replies
577 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Roy,

The MMA8653FC signals an interrupt by driving the INTx output either low or high depending on the setting of the IPOL bit in the CTRL_REG3 register. A selected interrupt pin on your MCU needs to be configured in accordance with this setting (falling edge or rising edge). To deassert the interrupt on the MMA8653FC, it is necessary to read the appropriate status register for the embedded functions or X, Y, Z data output registers (0x01 - 0x06) for the DRDY and FIFO. I do not recommend to perform these I2C reads and any operations with the data in ISRs, I would leave it up to non-interrupt code. It is a good practice to keep ISRs as short as possible.


I hope it helps.


Regards,

Tomas

0 Kudos
576 Views
roysit
Contributor I

Hi Tomas,


Thanks for your advice. May be I put data operation in the ISR is the problem. I would try to take it out.

Many Thanks.

Regards,

Roy 

0 Kudos