How to achive power optimisation in NRF5340

Hi,

We are trying to attain power optimization in our project, which uses the nRF5340 board. In our code we have implimented RTOS, BLE for data transfer and are using i2c and spi for other device communication, uart for data logging.
 We tried enabling the System and Device power management in our prj.conf file as mentioned in the post optimizing-power-on-nrf53-designs  but found no difference in the current consuption.    

  1. By testing, we have found that calling the function k_sleep() decreases the current consumption. What is the relevance of k_sleep() in power consumption?
  2. The RTOS waits for events to be set to execute the necessary process in our project. Does the device go to sleep while waiting for the event?
  3. If a pin is undefined, is there any chance it draws current via the pin? Some of the pins, we are not using in the code—do we need to undefine those pins?
  4. Does UART logging consume more power?
  5. What is the minimum power consumption we can achieve with this device configuration?
  6. How can we control power management in the device?

Parents
  • Hi Maya,

    I will try to answer them one by one.

    By testing, we have found that calling the function k_sleep() decreases the current consumption. What is the relevance of k_sleep() in power consumption?

    This function is used to put the thread which calls it, to sleep, for a specified period. When any thread calls the k_sleep(), the scheduler will put the CPU into a low power state if there are no other ready threads. Hence there is a reduction in the power consumption.

    The RTOS waits for events to be set to execute the necessary process in our project. Does the device go to sleep while waiting for the event?

    Yes of course. The device can enter a low-power state if you have enabled power management (CONFIG_PM). If so, the idle thread will put your system in the lowest possible power state thereby reducing the power consumption.

    If a pin is undefined, is there any chance it draws current via the pin? Some of the pins, we are not using in the code—do we need to undefine those pins?

    The default state of all GPIO pins in nRF5340 is as a disconnected input. Unless you've previously configured them to something else, you can leave unused pins in their default state and also physically disconnected to draw no current. That being said, it's always a good practice to not leave unused pins floating and define the state of unused pins.

    Does UART logging consume more power?

    Definitely. If you are not using UART, then it's better to disable it in order to conserve power and in case you need it, enable it only when it's needed and disable them soon after, because as long as UART is active, this prevents the MCU from entering any deeper sleep modes. You can utitilize the power management API.

    What is the minimum power consumption we can achieve with this device configuration?

    The nRF5340 can achieve very low power consumption, potentially down to microampere levels, when properly configured and in a sleep mode with all peripherals disabled. We cannot guarantee a definite number, as this depends on various factors like your device configuration, power management strategies you use, and your peripherals etc. But there have been instances where upto 8uA have been achieved.

    How can we control power management in the device?

    There are various methods like disabling unused peripherals, setting them into a particular power state, checking your hardware settings, and such. You can, as mentioned previously, take a look at the power management API which can be of help. You can also use the PPK2 or the Online power profiler to optimize your designs and consumption.

    Regards,

    Priyanka

  • Hi,

    We tried disabling every peripheral, log, and BLE on our custom board and achieved a current consumption in the 85 µA range. The code only contained a while loop with a 1-second delay. we have enabled (CONFIG_PM) in the .conf file.
    However, when we added BLE configurations and initialization to the same code, we observed the current consumption rise to around 1.6 mA.
    We are observing a current consumption of around 365 µA on the nrf5340 DK board when using the same code.

    Is there a possibility of power consumption through these disabled pins?
    Do you know what we might be doing wrong?

    Regard,
    Maya

  • Hi Maya,

    The power consumption, as mentioned earlier, can depend on your designs. So when you say that the DK current consumption is lesser than your custom boards, it would also be helpful to compare the hardware of both the boards, because this can influence the current consumption.

    -Priyanka

  • Hi,
    As mentioned before when we dissabled every peripheral we are getting base current in custom board to be 85uA  range

    And when enabling BLE the average current raises to 1.6mA range. Keeping all peripherals disabled.

    These are our .config and main files when enabling BLE
    37048.prj.conf

    /*
     * Copyright (c) 2016 Intel Corporation
     *
     * SPDX-License-Identifier: Apache-2.0
     */
    
    #include <zephyr/kernel.h>
    #include <zephyr/bluetooth/bluetooth.h>
    #include <zephyr/bluetooth/hci.h>
    #include <zephyr/bluetooth/conn.h>
    #include <zephyr/bluetooth/uuid.h>
    #include <zephyr/bluetooth/gatt.h>
    #include <zephyr/settings/settings.h>
    
    /* 1000 msec = 1 sec */
    #define SLEEP_TIME_MS   1000
    
    static const struct bt_data ad[] = {
    	BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)),
    	BT_DATA_BYTES(BT_DATA_UUID16_ALL, BT_UUID_16_ENCODE(BT_UUID_DIS_VAL)),
    };
    
    static void connected(struct bt_conn *conn, uint8_t err)
    {
    	if (err) {
    		printk("Connection failed (err 0x%02x)\n", err);
    	} else {
    		printk("Connected\n");
    	}
    }
    
    static void disconnected(struct bt_conn *conn, uint8_t reason)
    {
    	printk("Disconnected (reason 0x%02x)\n", reason);
    }
    
    BT_CONN_CB_DEFINE(conn_callbacks) = {
    	.connected = connected,
    	.disconnected = disconnected,
    };
    
    static int settings_runtime_load(void)
    {
    #if defined(CONFIG_BT_DIS_SETTINGS)
    	settings_runtime_set("bt/dis/model",
    			     "Zephyr Model",
    			     sizeof("Zephyr Model"));
    	settings_runtime_set("bt/dis/manuf",
    			     "Zephyr Manufacturer",
    			     sizeof("Zephyr Manufacturer"));
    #if defined(CONFIG_BT_DIS_SERIAL_NUMBER)
    	settings_runtime_set("bt/dis/serial",
    			     CONFIG_BT_DIS_SERIAL_NUMBER_STR,
    			     sizeof(CONFIG_BT_DIS_SERIAL_NUMBER_STR));
    #endif
    #if defined(CONFIG_BT_DIS_SW_REV)
    	settings_runtime_set("bt/dis/sw",
    			     CONFIG_BT_DIS_SW_REV_STR,
    			     sizeof(CONFIG_BT_DIS_SW_REV_STR));
    #endif
    #if defined(CONFIG_BT_DIS_FW_REV)
    	settings_runtime_set("bt/dis/fw",
    			     CONFIG_BT_DIS_FW_REV_STR,
    			     sizeof(CONFIG_BT_DIS_FW_REV_STR));
    #endif
    #if defined(CONFIG_BT_DIS_HW_REV)
    	settings_runtime_set("bt/dis/hw",
    			     CONFIG_BT_DIS_HW_REV_STR,
    			     sizeof(CONFIG_BT_DIS_HW_REV_STR));
    #endif
    #endif
    	return 0;
    }
    
    int main(void)
    {
    	bt_enable(NULL);
    
    	if (IS_ENABLED(CONFIG_BT_SETTINGS)) {
    		settings_load();
    	}
    	settings_runtime_load();
    
    	bt_le_adv_start(BT_LE_ADV_CONN_NAME, ad, ARRAY_SIZE(ad), NULL, 0);
    
    	while(1)
    	{
    		k_msleep(2000);	
    	}
    
    	return 0;
    }
    
    

    • Is there any low power ble example code we could try? 

    We tried the sample code provided by zephyr "peripheral_dis" . Still we are observing current range around 1.6mA in our board

    • Base current should be less than 100uA right?

    Since we achieved lower power in the same board we believe this current increase is due to ble enabling other than that we are not enabling anything.

    • have we done any mistake in the configuration of ble as we are getting the base current to be in 1.5mA range when enabling ble?

    Thanks,
    Maya

  • Hi,
    We were able to reduce the current range in our board when we changed our childimage with a different one
    4657.hci_rpmsg.conf

    Now the current consumption is around 245uA range with only the ble enabled.

Reply Children
No Data
Related