regulator-powered sensor fails to acknowledge over i2c after replacing battery

I'm using a custom board that has nRF52810 and lis2dh12 sensor. The sensor's Vdd is powered from a GPIO (configured a regulator-fixed to supply power from the GPIO during boot time).  GPIO's for I2C communications are configured with internal pull-ups. The code is same as lis2dh sample code.

For a while, the I2C communications to the sensor was working fine (RTT logged good sensor data), until the battery level went below 1.5V.

Now, the sensor is not acknowledging during lis2dh driver initialization in kernel's init.c (as if no supply is provided to the sensor). The issue persists after replacing the battery (with another battery and external power supply.

Could this be a simple timing issue during initialization?

[00:00:03.345,031] <inf> regulator_fixed: imu-pwr-ctrl onoff: 0
[00:00:09.659,393] <err> i2c_nrfx_twim: Error on I2C line occurred for message 0
[00:00:09.659,515] <err> lis2dhx: Failed to read chip id.

BTW, I inadvertently had added DC/DC configuration enabled (although the board has no external inductor to support DC/DC).

  • Hi

    Since it fails so early in the initialization I think this could be due to the CONFIG_MAIN_STACK_SIZE being set too low. Can you try increasing it (to as much as you have room for). If it's already set to 1024 (which I believe is the default), try increasing it to 2048 for example.

    If that doesn't help, can you let me know what GPIO pins you're using for I2C in your project? 

    The Zephyr functions z_arm_usage_fault and z_arm_reset are just indicators of a usage error and a reset taking place, I think you'll get better answers on what they do in detail over at the Zephyr Discord for instance, than from me.

    Best regards,

    Simon

Related