LIS3LV02DQ data rdy

Hi,

Currently I’m trying to program the LIS3LV02DQ to generate an interrupt whenever new data is available, but its constantly interrupting.

My mission basically is to know when the device is moved. If I set it on the desk, I want it to interrupt if someone moves it, picks it up, etc.

Any help will be greatly appreciated.

Thank You

Have you written suitable values into the threshhold registers? They default to 0, so the slightest bit of noise in the readings will trigger the motion interrupt.

Jason, ty for reply.

I tried changing the values in the free fall / wake up threshold registers. And I didn’t see a difference.

I posted my code below:

printf("\n\r setup accel");
incoming_byte = read_register(WHO_AM_I);
if(incoming_byte != 0x3A) {  } //do something

write_register(CtrlReg1, 0xC7);
write_register(CtrlReg2, 0x0C);
write_register(CtrlReg3, 0x4B);
write_register(FF_WU_THS_L, 0x60); 
write_register(FF_WU_THS_H, 0x16);
write_register(FF_WU_DURATION, 0x00); 
write_register(FF_WU_CFG, 0x4A);
newDataRdy = 0;
while(1)
{
      while(newDataRdy == 0);
      newDataRdy = 0;
      xL = read_register(xL);
      xH = read_register(xH);
      yH = read_register(YH);
      yL = read_register(YL);
      zH = read_register(ZH);
      zL = read_register(ZL);
      x_whole = calHighLow(xH, xL);
      y_whole = calHighLow(yH, yL);
      z_whole = calHighLow(zH, zL);
      printf("\n\rx_whole = %d", x_whole);
      printf("\n\ry_whole = %d", y_whole);
      printf("\n\rz_whole = %d", z_whole);
}

} //end of main


////////////////////////////////////////////////////////////////////
//    Function:    SIGNAL(SIG_INTERRUPT4)
//    Input:        An interrupt signal generated from accelerometer
//    Output:      None
//    Purpose:    Checks for movement moves
////////////////////////////////////////////////////////////////////
SIGNAL(SIG_INTERRUPT4) {
	_delay_ms(2000);
	CLEARBIT(EIFR, INTF4);

	printf("\n\rNEW DATA\n\r");
	newDataRdy  = 1;
}

I don’t think you want to have the DRDY bit set in CtrlReg2.

I’m not sure that 0 is a valid value for FF_WU_DURATION.

I changed it to write_register(CtrlReg2, 0x08); and still no luck.

What values do u set ur regs to?