MMA8451 - INT1 and INT2 on Movement

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

MMA8451 - INT1 and INT2 on Movement

1,363 Views
gianmaria_i
Contributor I

Good Morning,

actually we are using MMA8451 on a GPS device, we go to sleep after some minutes we dont have significat movement, and we are using INT1 to wake up the CPU on movement. We are tring to receive same interrupt signal also on INT2 but we cant succede.. we want same alert on both Interrupts.. is it possible? 

 

Regards,

Gianmaria

0 Kudos
8 Replies

1,354 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi Gianmaria,

 

The auto-sleep/wake interrupt can only be routed either to the INT1 (INT_CFG_ASLP = 1) or INT2 pin (INT_CFG_ASLP = 0). Is not it possible in your application to connect one of these interrupt pins to both CPU and Modem GPI?

 

Best regards,

Tomas

 

0 Kudos

1,347 Views
gianmaria_i
Contributor I

Dear tomas,

actually we are routing TAP event to INT1, not the autosleep-wake event, and it works fine. Is it possible to set another "logic" for exampple the movement event to INt 2 and have it both working on 2 different events that are similar?. Naturaling if we miss cause this is not possible we will work on hardware ti duplicate the signal. 

 

Regards,

gianmaria

 

0 Kudos

1,342 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi Gianmaria,

 

Yes, there is no problem to route the tap (pulse) interrupt to the INT1 pin (INT_CFG_PULSE = 1) and another interrupt (e.g. motion) to the INT2 pin (INT_CFG_FF_MT = 0).

On a side note, it is also possible to route multiple interrupts to the same interrupt pin and then read the INT_SOURCE register (0x0C) to know which event caused the interrupt.

 

Best regards,

Tomas

0 Kudos

1,316 Views
gianmaria_i
Contributor I

Good Morning Tomas,

i'm using the example tep by step at page 11 of annex https://www.nxp.com/docs/en/application-note/AN4070.pdf

To route motion event to INT1, but it seems not work.. here is my code.. maybe I'm going wrong with something. 

_____________________________________________________
//Put in stand-by mode
resDue= i2c_smbus_write_byte_data(client, 0x2A, 0x18);
printk(KERN_INFO"ASI - set standby mode, res=%d\n", resDue);


resDue= i2c_smbus_write_byte_data(client, 0x15, 0xD8);
resDue= i2c_smbus_write_byte_data(client, 0x17, 0x30);
resDue= i2c_smbus_write_byte_data(client, 0x18, 0x0A);
resDue= i2c_smbus_write_byte_data(client, 0x2D, 0x04);
resDue= i2c_smbus_write_byte_data(client, 0x2E, 0x04);

value = i2c_smbus_read_byte_data(client, 0x2A);
value |= 1;

resDue= i2c_smbus_write_byte_data(client, 0x2A, value);
printk(KERN_INFO"ASI - exit standby mode, res=%d\n", resDue);

return 0;

____________________________________________________________

If i use tap example of annex https://www.nxp.com/docs/en/application-note/AN4072.pdf page 15 everything works fine and i see INT1 Moving... 
My idea as expleaned is to have this TAP on INT1 and a working code for motion sensor to INT2, but it's not clear to me why the code from example doesnt work and how to put on INT2, cause example is on INT1. 

 

Regards,

gianmaria

 

0 Kudos

1,305 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi Gianmaria,

 

Your code appears to be correct. I would recommend to try decresing the threshold value from ~3g (0x30) to e.g. ~1g (0x10) and optionally also the debounce counter value.

 

In order to route the motion interrupt to the INT1 pin, make sure INT_CFG_FF_MT bit = 0.

 

Then in your ISR, clear your MCU interrupt flag and read the FF_MT_SRC (0x16) register in order to clear the SRC_FF_MT status bit and deassert the INT1 pin.  

 

Best regards,

Tomas  

0 Kudos

1,300 Views
gianmaria_i
Contributor I

Hello Tomas,

no way to work.. but it works fine with example from annex: https://www.nxp.com/docs/en/application-note/AN4072.pdf

I will use it. In this case i can also avoid read the source register cause INT goes up everytime a tap is detected. 

Another question.. can i define for how long the interrupt remain high.. actually it's very fast.. is it possible to have the INT high for about a second before it goes down again automatically?

 

Thanks for you help. I really appreciate. 

Gianmaria

0 Kudos

1,291 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi Gianmaria,

 

No, it is not possible to define for how long an interrupt pin remains active.

 

Best regards,

Tomas

0 Kudos

1,359 Views
gianmaria_i
Contributor I

Sorry i forgot to tell that we have to connect INT1 to a CPU GPIO and INT2 to Modem GPIO. 

0 Kudos