MMA8452Q not firing interrupt on motion?

Hi

I'm trying to get MMA8452Q to trigger an interrupt when motion is detected and wonder if I'm missing something very obvious here.

So I setup CTRL_REG4 to 0x0B with

void MMA8452Q::setupISR()
{
	writeRegister(CTRL_REG4, 0x0B);
}

then I setup FF_MT with

void MMA8452Q::setupFF_MT()
{
	writeRegister(FF_MT_CFG, 0xF8);
	writeRegister(FF_MT_THS, 0x0F);
	writeRegister(FF_MT_COUNT, 0x00);
}

and I read ISR with

byte MMA8452Q::readISR()
{
	byte intStat = readRegister(INT_SOURCE);

	if (intStat & 0x0B)
	{
		Serial.println(readRegister(FF_MT_SRC));
		return intStat & 0x0B;
	}
	else
		return 0;
}

AFAIK, that should already have FF/MT interrupt enabled. Even when I'm getting readings in FF_MT_SRC, I'm not picking up an interrupt in INT_SOURCE.

Am I missing something here?

Thanks

mun35:
Hi

I'm trying to get MMA8452Q to trigger an interrupt when motion is detected and wonder if I'm missing something very obvious here.

So I setup CTRL_REG4 to 0x0B with

Is the Sensor in Standby Mode? You can only change the registers if the Device is in StandBy Mode.

Also, Have your assigned which interrupt pin to use?

you need to review register definitions.

void MMA8452Q::setupISR()
{
 writeRegister(CTRL_REG4, 0x0B);
}

this 0x0B

  • bit 0: DataReady interrupt
  • bit 1: undefined ?
  • bit 2: _____________
  • bit 3: Pulse Detection Interrupt

You explicitly disabled FreeFall/Motion interrupt.

How about CTRL_REG5?

How is your device Wired?

It is a 3.3v Device, what does your levelshifter look like?

Chuck.