Sensor outputs zeros after powering off and on – how to reconfigure at runtime?

I’m working on reducing power consumption in my application using the LIS2DW12 sensor. I am currently turning off its LDO to cut power during low-power periods.

The problem is that when I power the sensor back on, it outputs only zeros. I understand this happens because the sensor loses its configuration when power is removed.

My question is:

  • What is the recommended way to reconfigure the LIS2DW12 at runtime after powering it back on?

  • Is there a best practice for retaining settings or initializing it dynamically in a Zephyr-based application?

I’m using the Zephyr sensor API for the LIS2DW12. Any guidance on runtime configuration after power cycling would be appreciated.

  • Hi Priyesh,

    That’s expected behavior — once power to the LIS2DW12 is fully cut, all internal registers reset to default, so you’ll need to reinitialize it every time the device powers back up. The usual approach is to re-run your sensor configuration sequence during startup.

    If you’re using the Zephyr sensor API, you can call sensor_sample_fetch() only after re-initialization, or re-trigger the sensor_init() routine when the LDO is restored. Some developers also store the config parameters in RAM or flash and apply them immediately after power-up for faster recovery.

    The sensor just needs to go through its setup steps again—ODR, range, and power mode—before it’ll return valid data.

Related