Showing results for 
Search instead for 
Did you mean: 

LIS2DW12 - Changing FIFO mode from bypass to cont-to-fifo

Associate III


I am running an application where I am using the LIS2DW12 accelerometer. I am using it for classical sampling of acceleration values in cont-to-fifo mode, which works fine. The FIFO is configured with the High pass filter enabled. 

I now want an additional 10 samples (preferably more than 4 samples but 10 being the max) with the high pass filter disabled. I have tried running the LIS2DW12 in single-sampling mode 10 times, with the following config:



-WriteReg(CTRL6, 2G full scale, ODR/2, LOW Noise enabled, HPF disabled)
-WriteReg(Fifo_ctrl, bypass)
-WriteReg(CTRL3, I2C_Single data conversion enabled)
-WriteReg(CTRL3, Start single data conversion)
while(DRDY bit is not set)

- Read data registers(x, y, z)

-WriteReg(CTRL6, 2G full scale, ODR/2, LOW Noise disabled, HPF enabled)
-WriteReg(Fifo_ctrl, bypass mode)
-WriteReg(Fifo_ctrl, cont-to-fifo mode)
-WriteReg(CTRL3, Latched interrupts enabled)


 Once the above code runs in the loop and I provide a disturbance to the sensor for it to wake up and sample, the application stops responding.

Is there something I am missing, to disable and re-enable the FIFO to run properly?



Federica Bossi
ST Employee

Hi @ZAIDS-S23 ,

The steps you need to follow to pass from bypass to continuous to FIFO mode are:

  • Configure the desired interrupt generator
  • Activate continuous-to-FIFO mode by setting the FMode[2:0] field to 011 in the FIFO_CTRL register (2Eh).
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hi Federica

I am familiar with placing the accelerometer in any FIFO mode of my choice and configuring it further in terms of interrupts etc.

However, what I am unsure of, is configuring it in bypass mode AFTER I've received an interrupt and read out the FIFO. After I read out the FIFO, I want to place it in single-data conversion mode and place the FIFO in bypass mode. 

From the steps I've implemented above, it doesn't seem to work consistently i.e. I can actually complete the above process uptil the point of placing it in bypass mode and then reading out 3 samples. But to do it repetitively, it cannot happen consistently. The chip stops responding to interrupts eventually.