Skip to main content
Associate
Question

LIS2HH12 :Accelerometer Readings Stuck at Fixed Values on Some Devices

 

We are observing an intermittent issue on a subset of our devices where the accelerometer(LIS2HH12) outputs become stuck at approximately the following values:

  • X: around -2 g
  • Y: around +2 g
  • Z: around +2 g

When this condition occurs, the reported acceleration values remain fixed and do not respond to changes in device orientation or movement. 

6 replies

Visitor II

Hello,

If the LIS2HH12 consistently reports approximately -2 g, +2 g, +2 g regardless of movement, this could indicate a sensor initialization, communication, or data acquisition issue.

I recommend checking:

  1. Register configuration: Verify the output data rate, full-scale range, and operating mode.

  2. Raw sensor data: Read the output registers directly to determine whether the sensor itself is stuck or the problem is in the software conversion.

  3. Data Ready status: Check whether new samples are being generated.

  4. FIFO and BDU settings: Ensure stale FIFO data or incomplete register reads aren't causing repeated values.

  5. Power and communication: Compare supply voltage, I²C/SPI signals, and initialization timing between working and affected devices.

  6. Sensor reset: Test whether a software reset or complete power cycle restores normal readings.

Important: If the raw registers remain fixed after a proper reset and verified configuration, a hardware-level issue becomes more likely.

One question: Does a full power cycle restore normal readings, or do the values remain stuck permanently?

This would help distinguish a firmware initialization issue from a possible sensor fault.

rahulsAuthor
Associate

Hello,

A full power cycle does not restore normal operation. The output remains stuck at approximately -2 g, +2 g, +2 g.

Additionally, I tested the device using a standalone self-test implementation derived directly from the LIS2HH12 application note, and the self-test also fails on the affected units. The same standalone test code executes successfully on other boards using the same hardware design and firmware, which makes a software-related issue unlikely.

Since I am able to reliably communicate with the sensor over I²C and read the WHO_AM_I register correctly, the digital communication path appears to be functional. This leads me to suspect a possible issue within the sensing or analog front-end rather than a communication problem.

Has ST observed any known reliability issues or field returns where the digital interface remains operational while the accelerometer sensing path becomes non-functional or saturated? Are there any known failure modes for the LIS2HH12 that could result in fixed full-scale readings and failed self-test while I²C communication continues to work normally?

Any guidance on additional diagnostics to distinguish between an internal sensor failure and a less obvious configuration-related issue would be appreciated.

David Littell
Senior II

Possibly an out-of-spec operating environment?

Federica Bossi
ST Technical Moderator

Hi ​@rahuls 

Thank you for the additional details. Could you please clarify how many units show this issue out of the total number tested, and if all affected units fail the self-test?

Could you also share the acceleration values for each axis with self-test disabled and enabled, together with the sensor configuration used during the test?

Thanks.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.
rahulsAuthor
Associate

As of now 6 out of 56 devices have seen this issue. 

#define ACCEL_ADDR     0x1D

#define REG_WHO_AM_I   0x0F
#define REG_CTRL1      0x20
#define REG_CTRL4      0x23
#define REG_CTRL5      0x24
#define REG_STATUS     0x27
#define REG_OUT_X_L    0x28

#define WHO_AM_I_VAL   0x41
#define CTRL1_50HZ_XYZ 0x2F   /* ODR 50 Hz, BDU=1, X/Y/Z enabled */
#define CTRL4_2G_INC   0x04   /* FS +/-2 g, IF_ADD_INC=1 (6-byte burst read) */
#define CTRL5_SOFT_RST 0x40
#define CTRL5_ST_POS   0x04   /* ST2:ST1 = 01, positive-sign self-test */
#define STATUS_ZYXDA   BIT(3)

/* Self-test positive difference, datasheet Table 3: 70 .. 1500 mg */
#define ST_MIN_MG      70
#define ST_MAX_MG      1500

/* +/-2 g sensitivity: 0.061 mg/digit, 16-bit output */
#define UG_PER_LSB     61

#define N_SAMPLES      5

static int lis2hh12_self_test(void)
{
    static const char axis_name[3] = {'X', 'Y', 'Z'};
    int32_t nost[3], st[3];
    uint8_t id;
    int ret;
    int result = 0;

    /* Serial communication check */
    ret = reg_read(REG_WHO_AM_I, &id);
    if (ret < 0) {
        printf("Accel @0x%02x: I2C read failed (%d)\n", ACCEL_ADDR, ret);
        return ret;
    }
    printf("WHO_AM_I 0x%02x\n", id);
    if (id != WHO_AM_I_VAL) {
        printf("WHO_AM_I mismatch (expected 0x%02x)\n", WHO_AM_I_VAL);
        return -ENODEV;
    }
k_msleep(100);
(void)reg_write(REG_CTRL1, 0x00);
k_msleep(100);
    /* Soft reset (acts as POR, boot takes up to 20 ms), then configure */
    ret = reg_write(REG_CTRL5, CTRL5_SOFT_RST);
    if (ret < 0) {
        return ret;
    }
    k_msleep(100);

    if ((ret = reg_write(REG_CTRL4, CTRL4_2G_INC)) < 0 ||
        (ret = reg_write(REG_CTRL1, CTRL1_50HZ_XYZ)) < 0) {
        return ret;
    }
    k_msleep(100);

    /* Baseline, self-test off */
    ret = read_average(nost);
    if (ret < 0) {
        goto out;
    }

    /* Enable positive self-test */
    ret = reg_write(REG_CTRL5, CTRL5_ST_POS);
    if (ret < 0) {
        goto out;
    }
    k_msleep(100);

    ret = read_average(st);
    if (ret < 0) {
        goto out;
    }

    for (int i = 0; i < 3; i++) {
        int32_t diff_mg = (abs(st[i] - nost[i]) * UG_PER_LSB) / 1000;
        bool ok = (diff_mg >= ST_MIN_MG) && (diff_mg <= ST_MAX_MG);

        printf("ST %c %d [%s]\n", axis_name[i], (int)diff_mg, ok ? "ok" : "F");
        if (!ok) {
            result = -EIO;
        }
    }
    ret = result;

out:
    /* Disable self-test and power down sensor */
    (void)reg_write(REG_CTRL5, 0x00);
    (void)reg_write(REG_CTRL1, 0x00);
    return ret;
}

In the below results 2 bytes of Acc X axis is represented by Return Value [0], Return Value [1]

In the below results 2 bytes of Acc Y axis is represented by Return Value [2], Return Value [3]

In the below results 2 bytes of Acc Z axis is represented by Return Value [4], Return Value [5]

On a good board ==>

With NO SELF TEST

Address=40, Error Value :0

Return Value [0] 231

Return Value [1] 220

Return Value [2] 241

Return Value [3] 255

Return Value [4] 44

Return Value [5] 54  

 

WITH POSITIVE SELF TEST 

Address=40, Error Value :0

Return Value [0] 201

Return Value [1] 235

Return Value [2] 235

Return Value [3] 13

Return Value [4] 177

Return Value [5] 81

 

WITH NEGATIVE SELF TEST 

Address=40, Error Value :0

Return Value [0] 116

Return Value [1] 205

Return Value [2] 26

Return Value [3] 239

Return Value [4] 10

Return Value [5] 22  

 

On a bad board ==> 

WITH NO, POSITIVE AND NEGATIVE SELF TEST

Address=40, Error Value :0

Return Value [0] 4

Return Value [1] 128

Return Value [2] 252

Return Value [3] 127

Return Value [4] 252

Return Value [5] 127

All 3 axes show the similar value for non working board

rahulsAuthor
Associate

​@Federica Bossi do you suspect a hardware failure or issue in software configuration based on the data shared above