cancel
Showing results for 
Search instead for 
Did you mean: 

Facing problem while fetching data from LIS2DE12 over I2C

NItin Kanani
Associate II
Posted on March 07, 2018 at 13:10

Hello People,

I am trying to get data over i2c from LIS2DE12  sensor. Here I am attaching a screenshot so you can see the way I am configuring its register to read data for x,y and z axis. I dont want to use any interrupt. Simply want to read data.

0690X00000609yxQAA.png

0690X00000609ysQAA.png 

#lis2ds12 #lis2d #mems #mems-accelerometer #lis2de12 #lis2dw12
7 REPLIES 7
Miroslav BATEK
ST Employee
Posted on March 07, 2018 at 14:45

Can you please explain exactly what is the problem?

Posted on March 08, 2018 at 05:09

I want to get data from 

LIS2DE12 sensor

continuously. I have made configuration to fetch data for x,y and z. But I am not sure wheather they are perfectly configured or not because I am getting same data every time I run the program even if I move the sensor the data remains same. Can you help me with this with proper step by step procedure.

Thanks 

Posted on March 10, 2018 at 16:17

Please share the sensor configuration in some easily readable format (register + value).

Posted on March 12, 2018 at 05:26

Hi Misroslav

Thanks for reply.

I want fetch data from LIS2DE12 sensor continuously over I2C. I have configured this sensor as given below.

  • CTRL_REG0 = 0x10  // (0: pull-up connected to SDO/SA0 pin )
  • CTRL_REG1 = 0x7F  // ODR = 200Hz, LPen = 1, All axis enabled
  • CTRL_REG4 = 0x00  // Continuously data updation, 2g, Normal mode

  • CTRL_REG5 = 0x40 // Fifo enable

  • FIFO_CTRL_REG= 0x40 // Fifo mode selection

Below is how I am trying to fetch data from LIS2DE12 sensor. But getting same data again and again even if I move sensor, data dose not get changed.

while (1)

{

HAL_I2C_Mem_Read(&hi2c3 ,ACC_ADDR | 1 , (0x80 | 0x28) , I2C_MEMADD_SIZE_8BIT , rx_buffer , 6 ,10 );

}

I am continuously monitoring rx_buffer in watch window. This is what I get in rx_buffer every time I run the program and even I move sensor. No change.

This is how I have configured and trying get data from sensor but not able to fetch properly.

NItin Kanani
Associate II
Posted on March 12, 2018 at 10:57

Hi Moroslav

Thanks for your suggestion. its work.

If i use data ready interrupt in INT1 pin. then which configuration i do?

Thanks

Nitin Kanani  

Posted on March 12, 2018 at 10:27

You enable FIFO and used mode called 'FIFO mode'.

In FIFO mode, the buffer continues filling data from the X, Y and Z accelerometer channels until it is full (a set of 32 samples stored). When the FIFO is full, it stops collecting data from the input channels and the FIFO content remains unchanged.

So I suppose the FIFO is full and stops collecting data.

Do you really need to use FIFO?

As first step I would propose do test it without FIFO CTRL_REG5 = 0x00, 

FIFO_CTRL_REG = 0x00.

Posted on March 12, 2018 at 15:14

To enable DRDY interrupt on INT1 pin set the bit I1_ZYXDA in the CTRL_REG3.

0690X00000609tkQAA.png