LIS2DW12 FIFO overflows upon wake-up by interrupt
Greetings
I have configured the LIS2DW12, via SPI, to sample and store samples, given the FIFO (configured in continuous mode) on a wakeup interrupt to INT1. The sensor, given its current configuration is able to wake up and sample but there is a worrying issue where, on the first wake-up (providing some movement to the sensor), the FIFO always overflows. I am seeing this when my ISR fires and the data-read-function is called, and within the read function, I am checking for the overflow and then essentially returning an error. If I try waking it up again, it samples fine without overflow occurring.
Any help would be appreciated to figure out why overflow occurs ONLY on the first wake-up.
My current configuration is:
Write(CTRL2 , 0X1E) //BDU ENABLED, I2C Disabled, IF_ADD_INC EN, Disable CS_PU
Write(CTRL6 , 0X10) //enable HPF, ODR/2, FS = 2G
Write(WAKE_UP_THS , 0X0C) //Threshold = 375mg
Write(WAKE_UP_DUR , 0X00) //No-wakeup time
Write(FIFO_CTRL , 0XC0) //continuous mode
Write(CTRL4_INT1 , 0X20) //route Wakeup event to INT1
Write(CTRL1 , 0X50) //Low-power mode 1, ODR = 100Hz
delay(20ms) //settling time
Write(CTRL7 , 0X20)
/********START ISR*****/
Read(FIFO_SAMPLES_REG) //Check overflow bit here
if(overflow bit is set in FIFO_SAMPLES_REG)
{
Write(FIFO_CTRL , 0X00) //clear fifo
Write(FIFO_CTRL , 0XC0) //set to continuous mode
}
else
{
Read(OUT_X_L, 6) //Read the 6 output registers
x = data[1], data[0]
y = data[3], data[2]
z = data[5], data[4]
}
Write(FIFO_CTRL , 0X00) //clear fifo
Write(FIFO_CTRL , 0XC0) //set to continuous mode
/**********END ISR******/
