Skip to main content
Visitor II
November 14, 2017
Question

LIS2DH12 accelerometer values suddenly close to zero (-4, 0, 4)

  • November 14, 2017
  • 6 replies
  • 4173 views
Posted on November 14, 2017 at 21:08

Dear all

We are using LIS2DH12 accelerometer in our product. We are juat about to launch the production and sales when we faces a weird problem.

Suddenly the accelerometer starts reporting values like 0, 4 and -4, instead of normal values somewhere around 1000 and 0 when not moving the device.

In error situation the values don't change even when rotating or shaking the device.

Register writes and reads are successful and WHO_AM_I (0x0f) register value matches to 0x33 so there's no address conflict.

I tried to fix the problem by resetting the registers to initial values. This didn't fix the problem. Also I tried to assert the BOOT bit of CTRL_REG5, which didn't help either. (I'm not quite sure what that is supposed to do)

Powering down the accelerometer is the only thing that helps. Too bad we don't have that possibility in our device. Removing the battery is the only possibility, which can be done only with opening the device using screwdriver.

The error is quite rare and we don't know the root cause.

Could anyone help? This is getting quite urgent.

My init sequence is:

// Try the BOOT bit with no help.

Write LIS2DH_CTRL_REG5, _CTRL_REG5_BOOT

delay 5 ms to wait the boot to complete.

//Restore default values:

Write LIS2DH_CTRL_REG0, 0x10

Write LIS2DH_TEMP_CFG_REG, 0x00

Write LIS2DH_CTRL_REG1, 0x07

Write LIS2DH_CTRL_REG2, 0x00

Write LIS2DH_CTRL_REG3, 0x00

Write LIS2DH_CTRL_REG4, 0x00

Write LIS2DH_CTRL_REG5, 0x00

Write LIS2DH_CTRL_REG6, 0x00

Write LIS2DH_REFERENCE, 0x00

Write LIS2DH_FIFO_CTRL_REG, 0x00

Write LIS2DH_INT1_CFG, 0x00

Write LIS2DH_INT1_THS, 0x00

Write LIS2DH_INT1_DURATION, 0x00

Write LIS2DH_INT2_CFG, 0x00

Write LIS2DH_INT2_THS, 0x00

Write LIS2DH_INT2_DURATION, 0x00

Write LIS2DH_CLICK_CFG, 0x00

Write LIS2DH_CLICK_THS, 0x00

Write LIS2DH_TIME_LIMIT, 0x00

Write LIS2DH_TIME_LATENCY, 0x00

Write LIS2DH_TIME_WINDOW, 0x00

Write LIS2DH_Act_THS, 0x00

Write LIS2DH_Act_DUR, 0x00

//Set 100Hz normal mode

Write 0x20, 0x57

Write 0x23, 0x80

//Enable FIFO (Streaming)

Write LIS2DH_CTRL_REG5, _CTRL_REG5_FIFO_EN

Write LIS2DH_FIFO_CTRL_REG, 0x80

//Init Interrupts:

Write LIS2DH_CTRL_REG3, _CTRL_REG3_I1_CLICK | _CTRL_REG3_I1_AOI1

Write LIS2DH_CTRL_REG6, _CTRL_REG6_H_LACTIVE

Write LIS2DH_INT1_CFG, _INT1_CFG_AOI | _INT1_CFG_XHIE_XUPE | _INT1_CFG_YHIE_YUPE | _INT1_CFG_ZHIE_ZUPE

Write LIS2DH_INT1_THS, 1

Write LIS2DH_INT1_DURATION, 1

Write LIS2DH_CLICK_CFG, _CLICK_CFG_ZS | _CLICK_CFG_YS | _CLICK_CFG_XS

Write LIS2DH_CLICK_SRC, _CLICK_SRC_SClick

Write LIS2DH_CLICK_THS, 3

In the following there is a sample of erroneous FIFO stream.

<xyz: 4,-4,0>

<xyz: 4,0,4>

<xyz: 0,0,0>

<xyz: 0,0,0>

<xyz: 0,0,0>

<xyz: 0,0,0>

<xyz: 0,4,4>

<xyz: 0,0,0>

<xyz: 0,0,0>

<xyz: 0,4,4>

<xyz: 4,0,0>

Reading values directly from out registers starting from 0x28 return similar values (-4, 0, 4, sometimes 8)

#lis2dh12
    This topic has been closed for replies.

    6 replies

    ST Employee
    November 15, 2017
    Posted on November 15, 2017 at 15:37

    Is the sensor connected to microcontroller by I2C or SPI bus?

    If the SPI is used, is any other device connected on the same bus?

    Visitor II
    November 15, 2017
    Posted on November 15, 2017 at 15:45

    Sensor is connected over I2C. There is a LED driver also on that bus. There's no data traffic to the LED driver after the device init procedure.

    ST Employee
    November 15, 2017
    Posted on November 15, 2017 at 16:09

    It will be tough to debug this issue remotely.

    What is the average run time after which the sensor start send weird data?

    Is is case of one sensor or do you have more prototypes with the same behavior?

    Are you checking the FIFO_SRC_REG register to get correct number of sample in FIFO?

    Here is a few ideas which you can check:

    - Do you have enough blocking capacity close to the sensor? Some short supply voltage drop can influence the sensor. 

    - Can you check the I2C signals with a scope? Some peak or disturbances could cause writing to some internal register and cause malfunction.

    - You can decrease the speed of I2C pins on your microcontroller.

    - You can also try to decrease the I2C speed.

    - I would be good to check your sensor configuration and reading procedure, but it seems it will ok if the sensor is working for some time.

    ST Employee
    November 16, 2017
    Posted on November 16, 2017 at 14:19

    I don't think using LIS2HH12 will help, the soft reset (LIS2HH12) and boot (LIS2DH12) do more or less the same.

    It is not possible to recover values of the internal registers.

    The only solution I see it to avoid voltage drop under 1.7V.

    Visitor II
    November 16, 2017
    Posted on November 16, 2017 at 16:17

    Thanks Miroslav for your answer. I'll inspect the voltage lines whether or not there are glitches, especially in case of low battery or high load. We do have 220nF capacitor in the power line next to the regulator another 0.1uF capacitor right next to accelerometer.

    Related to boot and soft reset registers. Could you elaborate the difference a bit? 

    LIS2HH12 seems to have both available.

    ST Employee
    November 17, 2017
    Posted on November 17, 2017 at 15:12

    I'm afraid that one 100nF capacitor is not enough. The 100nF + 10uF blocking capacitors are recommended in the datasheet.

    Even if you don't have dedicated place on your prototype, I would try to stack some capacitor with value several uF on top of the 100nF capacitor close to the sensor and check if the problem remains.

    I asked the sensor specialists what is the difference between BOOT and SOFT_RESET in LIS2HH12, I will let you know.

    Visitor II
    November 20, 2017
    175926CGIL2
    Visitor II
    November 24, 2017
    Posted on November 24, 2017 at 10:23

    We found a way to do a power down cycle to reboot the whole board using charger IC and do SW recovery without having major impact on the device operation.

    We didn't find the root cause of the failure, since this is so rare. Based on our measurements there are no voltage drops even close to 1.7V.

    Visitor II
    March 11, 2018
    Posted on March 11, 2018 at 17:57

    I'm currently using the LIS2DH12 and facing a similar issue.

    But instead of reading values close to 0, I'm reading fixed values that does not change when rotating or shaking the device.

    Here too, the power cycle manages to fix the issue, but the battery will be soldered on the board for my product, so I won't be able to power cycle.

    When dumping the memory of the LIS2DH12, everything seems correct.

    Does someone at ST had time to look into this and provide a fix ?

    Visitor II
    March 12, 2018
    Posted on March 12, 2018 at 09:40

    Hello. Neither root cause nor solution is found, yet. We have not confirmed any voltage drops or peaks that might cause this kind of problem. St pointed one issue in our board layout. There is a trace and a via under the accelerometer, which we are going to remove. No other solution is found. I'd suggest you to implement a way to power down the accelerometer chip itself in the HW, If possible.

    Visitor II
    July 17, 2023

    Hello, did you finally get the root cause of the issue? We are having the same problem, however we can't do a cold reset to the board (power-down and power-up).

    Thank you in advance