This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Dynamically disable I2C

I'm using NCS V1.5.0 and an nRF52840

The current draw with I2C enabled is around 200 micro amps

If I disable I2C using an overlay and recompile the current draw is around 9 micro amps.

Unfortunately I require I2C, is there a way to disable and enable the interface at runtime under zephyr.

Help would be much appreciated.

Parents Reply
  • Thanks very much for your reply.

    I've tried that approach.

    As follows:

    I've used DEVICE_PM_FORCE_SUSPEND_STATE as well as DEVICE_PM_OFF_STATE Same result.

    void st_lis2dh_stop(void) {
    int err;
    k_sleep(K_MSEC(2));
    err = device_set_power_state(sensor_accelerometer, DEVICE_PM_FORCE_SUSPEND_STATE, NULL, NULL);
    if (err) {
              printk("Can't power off st_lis2dh %d \n", err);
         }
    }

    I get the following at run time.

    Can't power off si7055_sensor -35
    Can't power off st_lis2dh -35

Children
No Data
Related