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

How can I disable a device in order to achieve lower power consumption on nrf9160?

Dear All,

I am trying to minimize the current consumption of my device. I am using several peripherals, such as UART, I2C and ADC.

When I run a very simple sample that will just configure the modem, I am reading about 6uA on the device. But when I add for example ADC on an analog pin I am reading 27uA. I do not need the  ADC or the other devices running all the time.

I see that there is a configuration option called CONFIG_DEVICE_POWER_MANAGEMENT. But Idon't know how I can use it in my project. I assume that I need to add to my prj.conf. But what other steps do I need to complete in order to be able to minimize the current consumption, when the device is sleeping?

Also, I am scheduling some tasks and there are some interrupt driven tasks that use the device mentioned above. Do I need to do anything special in my code in order to get the devices working properly?

Thank you very much!

  • Hi,

    I am using several peripherals, such as UART, I2C and ADC.

    UART and I2C should have the power managment hooks in place. See this and this link. Seems like it's not yet implemented for the ADC driver.

    When you are done using the peripheral, you could then you could call device_set_power_state(), snippet:

    struct device *peripheral_dev;
    
    static void peripheral_disable(void)
    {
    
    #ifdef CONFIG_DEVICE_POWER_MANAGEMENT
    	int err = device_set_power_state(peripheral_dev,
    					 DEVICE_PM_OFF_STATE,
    					 NULL, NULL);
    	if (err) {
    		LOG_ERR("peripheral disable failed");
    	}
    #endif
    }

     

    Alternatively, you might be able to call the nrfx uninit function for the peripheral directly.

Related