How to clean the interruption?

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

How to clean the interruption?

981 Views
lucasmilitao
Contributor I

Good night! Please, i'm trying to use Transient Function from MMA8451q, and i want to work with interruption to detect quick movements. But, when i start the program, the interruption is already set... and i dont know how to clean.

MMA1_WriteReg8(0x2A, 0x08); //Standby mode and 400Hz
MMA1_WriteReg8(0x1D, 0x17); //Enables Z-axis, Latch (ELE = 1) and enables Motion Function setting HPF_BYP
MMA1_WriteReg8(0x1F, 0x08); //Threshold set to 0.5G
MMA1_WriteReg8(0x20, 0x01); //Count one event
MMA1_WriteReg8(0x2D, 0x20); //Enable Transient function enabling interruption pin

MMA1_ReadReg8(0x0C, &state); //Reading INT_SOURCE to CLEAN INT1  - I already tried to read this register to clean the interruption... but it's not working.

Labels (1)
3 Replies

797 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Lucas,

It seems you also need read the register of   0x1E: TRANSIENT_SRC

pastedImage_1.png

In the register of   0x0C: INT_SOURCE shows :

pastedImage_4.png

Hope it helps


Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

797 Views
lucasmilitao
Contributor I

Hello Alice, 

Thanks, but I already tried this before, but nothing change. Is there something wrong with this part? I tried to modify the priority from the I2C and ExtInt too, but the result is allways the same.

MMA1_WriteReg8(0x2A, 0x08); //Standby mode and 400Hz
vTaskDelay(1);
MMA1_WriteReg8(0x1D, 0x17); //Enables Z-axis, Latch (ELE = 1) and enables Motion Function setting HPF_BYP
vTaskDelay(1);
MMA1_WriteReg8(0x1F, 0x08); //Threshold set to 0.5G
vTaskDelay(1);
MMA1_WriteReg8(0x20, 0x01); //Count one event
vTaskDelay(1);
MMA1_WriteReg8(0x2D, 0x20); //Enable Transient function enabling interruption pin
vTaskDelay(1);
MMA1_WriteReg8(0x2E, 0x20); //Enable Interruption INT 1
vTaskDelay(1);
MMA1_ReadReg8(0x0C, &state); //Reading INT_SOURCE to CLEAN INT1
vTaskDelay(1);
MMA1_ReadReg8(0x1E, &state); //Reading TRANSIENT_SRC to CLEAN INT1
vTaskDelay(1);

MMA1_Enable();

0 Kudos
Reply

797 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Lucas,

 Sorry I haven't used this chip, there is a example about it , maybe you can refer to it ,

please have a look to check this code how to configure the interrupt :

https://community.nxp.com/docs/DOC-98836 

Hope it helps

Alice