cancel
Showing results for 
Search instead for 
Did you mean: 

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

veli-matti
Associate II
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
19 REPLIES 19
Posted on November 24, 2017 at 10:10

So the difference between BOOT and SOFT_RESET in LIS2HH12 is following:

BOOT ... reloads the trimming parameters, 

the content of the device control registers is not modified, so the device operating mode doesn’t change.

SOFT_RESET ... reset the control registers to the default value

R B_2
Associate II
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 ?

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.

Posted on March 15, 2018 at 16:53

What bus are you using, I2C or SPI?

Are there any other devices connected to this bus?

Can you share you schematics and layout?

Posted on March 15, 2018 at 18:20

We're using SPI (MOSI/MISO/SCK/CS).

0690X0000060A97QAE.png

VCC is 2.8V

There is another device on the bus that is driven with another CS line.

Of course, we designed the code so they never ever talk together at the same time.

Also, values close to zero were also observed during some ''weird-phase-time'' of the sensor.

Last but not least, I may have some information about the issue. I'm not sure but the issue might trigger sometimes when I re-flash my MCU.

As the whole board power stays on the whole process, maybe in certain cases when the MCU is speaking with the LIS2DH12 and get interrupted (due to reset/flash process), the LIS2DH12 enters this weird state.

Posted on March 19, 2018 at 15:02

Are you using SPI mode 3 for the communication?

Posted on March 19, 2018 at 15:10

Yes I do (Clock idles at high, MOSI shifts on high-to-low, MISO reads on low-to-high)

Posted on March 27, 2018 at 14:01

After some tests, it seems that when I stop all comunications with the other SPI device (same bus), the LIS2DH12 stops enterring this weird state.

Perhaps there is something like data transmitted to the other device interpreted as I2C frames (CS = 1: SPI idle mode / I2C communication enabled). On top of that the SPI communication speed is way faster than the I2C max speed (4MHz).

Is it possible to somehow disable the I2C interface ?

Posted on March 29, 2018 at 15:10

Please try to rise a ticket in

http://www.st.com/content/st_com/en/support/online-support.html

concerning the I2C interface disabling.
LJimé.1
Associate II

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