Read number of unread samples in FIFO - LIS2DW12
Greetings
I am working with the LIS2DW12 accelerometer and I am struggling to read from, and use the FIFO in single-conversion mode, using i2c. The chip is on a dev board which can only be used with i2c, and the INT1 or INT2 pins are not available for use.
I am configuring the chip in low-power 12-bit mode, with an ODR of 50Hz.
My configuration function:
write(CTRL2_REG, 0x0C) //block data update = 1, device-addr increment = 1
write(CTRL6_REG, 0x00) // filter = ODR/2
write(FIFO_CTRL_REG, 0x20) //fifo mode
write(CTRL1_REG, 0x48) // low-power 12-bit mode, with an ODR of 50Hz, single-conversion mode
write(CTRL7_REG, 0x20) //enable interrupts
To run the chip in single-conversion mode and read from the fifo, the function I have written is as follows:
write(CTRL3_REG, 0x02) //enable start-of-single-conversion by I2C
write(CTRL3_REG, 0x03) // start measurement
After this. I am confused, as I have posted previously
When I try to read the number of unread samples in the FIFO_Samples register, I continuously get zero. Thus, I do not have a clear indicator of when I need to read from the output registers. I can verify the read functionality as well, as I check the WhoAMI everytime the chip boots up and that checks out. I have also added a delay after the last write command to CTRL3, to ensure the FIFO can fill up according to the clock cycles required (32 cycles * 1/50 = 640ms delay).
My attempt to read from the FIFO_Samples register, where ui8Data is zero:
read(FIFO_Samples_reg, ui8Data);
ui8Data &= 0x3F;Please can I have some help on this.
Regards
