Decrease Power Consumption on nRF5340 during distance measurement (dm) sample

Hello,

I am trying to reduce the current on the nRF5340 during the distance measurement (dm) sample for BLE ranging.

For current measurement I am using the Power Profiler Kit II. I am measuring via Vout of PPK to "+" from external supply of the nRF5340 and GND to GND. I didn't cut the solder bridge on the current consumption pins.

During ranging, I can clrearly see the peaks and intervals from scanning and advertising, which perfectly match what I have set in the gap.h

Between those ranging intervals, my IDLE current is around 0.7 mA, and I think I can get that way lower, but am unsure how to do so.

I already switched off uart0 in the device tree and configured several power management CONFIGs like CONFIG_PM_DEVICE=y or CONFIG_SERIAL=n. But besides the uart, none of them helped me further reducing the idle current. I also tried to copy as much CONFIGs from the peripheral_lbs example, but that also dind't help. I also disabled other peripherals in the device tree, like leds, buttons, pwm, uarts, i2c or nfc ... but none of them helped. When I'm setting the DK to sys_poweroff(), I am getting approx. 450-500 µA. I also tried to flash the sys_poweroff sample but that gave me the same idle current. Then in the   The current is about 500uA when nrf52840 in idle mode thread, it said that you need to turn off CONFIG_SERIAL which I also did, but didn*t help.

So now I am wondering how I can get this current lower, or am I at the minimum possible idle current for this dm example ? Of course I could also reduce the measurement rate or tx power but I first want to try to reduce the idle current as much as I can.

Thank you very much in advance for your help!
 

Parents
  • Hi,

    You can get significantly lower idle current consumption, down to a few micro amps in system on sleep mode. Could it be that you have only disabled UART in the application core, but not in the network core? If UART logging is enabled in the network core image, you need to disable it for the ipc_radio application that runs on the network core as well as for on your application.

  • Thank you for your answer.
    I already did that and still get the high current consumption mentioned above.

    I am sure there is something running in the background but not what. I also flashed a proramm wihtout any Bluetooth Configs at all, just a main with sys_poweroff() but I just can't get it below 450-500 µA.

    is there a possibility to provide a fully working low power example with buiild configuration, device tress and .conf files so that I can be sure I am having the right settings and measuring the right currents ? As the BLE advetising and scanning intervals / windows are clearly visible I think I am measuring the right way.

    It would be very helpful for me if you could provide a low power example like that to make sure the flashed firmware isn't the problem.

    I can also provide my configs so that you can see what i flashed:

    prj.conf:

    CONFIG_PM_DEVICE=y
    
    CONFIG_UART_CONSOLE=n
    CONFIG_SERIAL=n
    CONFIG_LOG=n
    CONFIG_PRINTK=n
    
    CONFIG_TICKLESS_KERNEL=y
    
    CONFIG_BOARD_ENABLE_DCDC_APP=y
    CONFIG_DEBUG=n
    CONFIG_RAM_POWER_DOWN_LIBRARY=y
    CONFIG_NORDIC_QSPI_NOR=y
    CONFIG_POWEROFF=y
    
    
    CONFIG_I2C=n
    CONFIG_WATCHDOG=n
    CONFIG_GPIO=n
    CONFIG_SPI=n
    CONFIG_SERIAL=n
    # Interrupts
    CONFIG_DYNAMIC_INTERRUPTS=n
    CONFIG_IRQ_OFFLOAD=n
    
    # Console
    CONFIG_CONSOLE=n
    CONFIG_UART_CONSOLE=n
    CONFIG_STDOUT_CONSOLE=n
    CONFIG_PRINTK=n
    CONFIG_EARLY_CONSOLE=n
    
    # Build
    CONFIG_SIZE_OPTIMIZATIONS=y
    
    # ARM
    # CONFIG_ARM_MPU=n
    # CONFIG_TIMESLICING=n
    # CONFIG_COMMON_LIBC_MALLOC=n
    CONFIG_LOG=n
    CONFIG_ASSERT=n


    app.overlay:
    /*
     * Copyright (c) 2023 Nordic Semiconductor ASA
     *
     * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
     */
    
    / {
    	/* The timer instance to use. */
    	chosen {
    		ncs,dm-timer = &timer2;
    	};
    
    	/* The selected pins will be used by Distance Measurement module for debug purposes. */
    	dm_gpio {
    		compatible = "gpio-leds";
    		dm_ranging: dm-ranging {
    			gpios = <&gpio0 27 GPIO_ACTIVE_LOW>;
    			label = "DM Ranging Pin";
    		};
    		dm_add_request: dm-add-request {
    			gpios = <&gpio0 26 GPIO_ACTIVE_LOW>;
    			label = "DM Add request Pin";
    		};
    
    	};
    
    };
    
    
    
    &adc {
        status = "disabled";
    };
    
    &pwm0 {
        status = "disabled";
    };
    
    &uart0 {
        status = "disabled";
    };
    
    &uart1 {
        status = "disabled";
    };
    
    &uart2 {
        status = "disabled";
    };
    
    &i2c0 {
        status = "disabled";
    };
    
    &i2c1 {
        status = "disabled";
    };
    
    &spi0 {
        status = "disabled";
    };
    
    &spi1 {
        status = "disabled";
    };
    
    &spi2 {
        status = "disabled";
    };
    
    &spi4 { status = "disabled"; };
    
    
    &nfct {
        status = "disabled";
    };
    
    &gpiote {
        status = "disabled";
    };


    boards/nrf5340dk_nrf5340_cpuapp.conf
    CONFIG_PM_DEVICE=y
    CONFIG_POWEROFF=y
    
    CONFIG_UART_CONSOLE=n
    CONFIG_SERIAL=n
    CONFIG_LOG=n
    CONFIG_PRINTK=n
    
    CONFIG_BOARD_ENABLE_DCDC_NET=y
    



    boards/nrf5340dk_nrf5340_cpuapp.overlay
    /*
     * Copyright (c) 2022 Nordic Semiconductor ASA
     *
     * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
     */
    
    #include <zephyr/dt-bindings/ipc_service/static_vrings.h>
    
    / {
    	chosen {
    		/delete-property/ zephyr,ipc_shm;
    	};
    
    	reserved-memory {
    		/delete-node/ memory@20070000;
    
    		sram_ipc0: memory@20070000 {
    			reg = <0x20070000 0x8000>;
    		};
    
    		sram_ipc1: memory@20078000 {
    			reg = <0x20078000 0x8000>;
    		};
    	};
    
    	ipc {
    		/delete-node/ ipc0;
    
    		ipc0: ipc0 {
    			compatible = "zephyr,ipc-openamp-static-vrings";
    			memory-region = <&sram_ipc0>;
    			mboxes = <&mbox 0>, <&mbox 1>;
    			mbox-names = "tx", "rx";
    			role = "host";
    			status = "okay";
    		};
    
    		ipc1: ipc1 {
    			compatible = "zephyr,ipc-openamp-static-vrings";
    			memory-region = <&sram_ipc1>;
    			mboxes = <&mbox 2>, <&mbox 3>;
    			mbox-names = "tx", "rx";
    			role = "host";
    			zephyr,buffer-size = <2048>;
    			status = "okay";
    		};
    	};
    };
    
     /* Enable pin forwarding to network core. The selected pins will be used by
      * Distance Measurement module for debug purposes.
      *
      * Note: Pay attention to assign the same GPIO pins as those provide in network core DTS overlay.
      */
    &gpio_fwd {
    	compatible = "nordic,nrf-gpio-forwarder";
    	dm-gpio-if {
    		gpios = <&gpio0 26 0>,
    			<&gpio0 27 0>;
    		};
    };
    
    &uart0 {
        current-speed = <230400>;
        status = "disabled";
    };
    
    
    &usbd {
        status = "disabled";
    };
    
    &usbreg {
        status = "disabled";
    };
    
    &adc {
        status = "disabled";
    };
    
    &pwm0 {
        status = "disabled";
    };
    
    &uart0 {
        status = "disabled";
    };
    
    &uart1 {
        status = "disabled";
    };
    
    &uart2 {
        status = "disabled";
    };
    
    &i2c0 {
        status = "disabled";
    };
    
    &i2c1 {
        status = "disabled";
    };
    
    &spi0 {
        status = "disabled";
    };
    
    &spi1 {
        status = "disabled";
    };
    
    &spi2 {
        status = "disabled";
    };
    
    &qspi {
        status = "disabled";
    };
    
    &nfct {
        status = "disabled";
    };
    
    


    child_image/hci_ipc/boards/nrf5340dk_nrf5340_cpunet.overlay
    /*
     * Copyright (c) 2022 Nordic Semiconductor ASA
     *
     * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
     */
    
    #include <zephyr/dt-bindings/ipc_service/static_vrings.h>
    
    / {
    	/* The timer instance to use. */
    	chosen {
    		ncs,dm-timer = &timer2;
    	};
    
    	chosen {
    		/delete-property/ zephyr,ipc_shm;
    	};
    
    	reserved-memory {
    		/delete-node/ memory@20070000;
    
    		sram_ipc0: memory@20070000 {
    			reg = <0x20070000 0x8000>;
    		};
    
    		sram_ipc1: memory@20078000 {
    			reg = <0x20078000 0x8000>;
    		};
    	};
    
    	ipc {
    		/delete-node/ ipc0;
    
    		ipc0: ipc0 {
    			compatible = "zephyr,ipc-openamp-static-vrings";
    			memory-region = <&sram_ipc0>;
    			mboxes = <&mbox 0>, <&mbox 1>;
    			mbox-names = "rx", "tx";
    			role = "remote";
    			status = "okay";
    		};
    
    		ipc1: ipc1 {
    			compatible = "zephyr,ipc-openamp-static-vrings";
    			memory-region = <&sram_ipc1>;
    			mboxes = <&mbox 2>, <&mbox 3>;
    			mbox-names = "rx", "tx";
    			role = "remote";
    			zephyr,buffer-size = <2048>;
    			status = "okay";
    		};
    	};
    
    
    	/* The selected pins will be used by Distance Measurement module for debug purposes.
    	 *
    	 * Note: Pay attention to select the same GPIO pins
    	 * in the application core DTS overlay's gpio_fwd node.
    	 */
    	dm_gpio {
    		compatible = "gpio-leds";
    		dm_ranging: dm-ranging {
    			gpios = <&gpio0 27 GPIO_ACTIVE_LOW>;
    			label = "DM Ranging Pin";
    		};
    		dm_add_request: dm-add-request {
    			gpios = <&gpio0 26 GPIO_ACTIVE_LOW>;
    			label = "DM Add request Pin";
    		};
    	};
    };
    
    &uart0 {
        status = "disabled";
    };


    child_image/hci_ipc.conf:
    CONFIG_PM_DEVICE=y
    
    CONFIG_UART_CONSOLE=n
    CONFIG_CONSOLE=n
    CONFIG_SERIAL=n
    CONFIG_LOG=n
    CONFIG_PRINTK=n
    CONFIG_ASSERT=n
    
    
    CONFIG_TICKLESS_KERNEL=y



    sysbuild/hci_ipc/boards/nrf5340dk_nrf5340_cpunet.overlay:
    /*
     * Copyright (c) 2022 Nordic Semiconductor ASA
     *
     * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
     */
    
    #include <zephyr/dt-bindings/ipc_service/static_vrings.h>
    
    / {
    	/* The timer instance to use. */
    	chosen {
    		ncs,dm-timer = &timer2;
    	};
    
    	chosen {
    		/delete-property/ zephyr,ipc_shm;
    	};
    
    	reserved-memory {
    		/delete-node/ memory@20070000;
    
    		sram_ipc0: memory@20070000 {
    			reg = <0x20070000 0x8000>;
    		};
    
    		sram_ipc1: memory@20078000 {
    			reg = <0x20078000 0x8000>;
    		};
    	};
    
    	ipc {
    		/delete-node/ ipc0;
    
    		ipc0: ipc0 {
    			compatible = "zephyr,ipc-openamp-static-vrings";
    			memory-region = <&sram_ipc0>;
    			mboxes = <&mbox 0>, <&mbox 1>;
    			mbox-names = "rx", "tx";
    			role = "remote";
    			status = "okay";
    		};
    
    		ipc1: ipc1 {
    			compatible = "zephyr,ipc-openamp-static-vrings";
    			memory-region = <&sram_ipc1>;
    			mboxes = <&mbox 2>, <&mbox 3>;
    			mbox-names = "rx", "tx";
    			role = "remote";
    			zephyr,buffer-size = <2048>;
    			status = "okay";
    		};
    	};
    
    
    	/* The selected pins will be used by Distance Measurement module for debug purposes.
    	 *
    	 * Note: Pay attention to select the same GPIO pins
    	 * in the application core DTS overlay's gpio_fwd node.
    	 */
    	dm_gpio {
    		compatible = "gpio-leds";
    		dm_ranging: dm-ranging {
    			gpios = <&gpio0 27 GPIO_ACTIVE_LOW>;
    			label = "DM Ranging Pin";
    		};
    		dm_add_request: dm-add-request {
    			gpios = <&gpio0 26 GPIO_ACTIVE_LOW>;
    			label = "DM Add request Pin";
    		};
    	};
    };
    
    &adc {
        status = "disabled";
    };
    
    &pwm0 {
        status = "disabled";
    };
    
    &uart0 {
        status = "disabled";
    };
    
    &uart1 {
        status = "disabled";
    };
    
    &uart2 {
        status = "disabled";
    };
    
    &i2c0 {
        status = "disabled";
    };
    
    &i2c1 {
        status = "disabled";
    };
    
    &spi0 {
        status = "disabled";
    };
    
    &spi1 {
        status = "disabled";
    };
    
    &spi2 {
        status = "disabled";
    };
    
    
    &nfct {
        status = "disabled";
    };
    
    


    sysbuild/hci_ipc/prj.conf:
    CONFIG_IPC_SERVICE=y
    CONFIG_MBOX=y
    
    
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512
    
    
    # Workaround: Unable to allocate command buffer when using K_NO_WAIT since
    # Host number of completed commands does not follow normal flow control.
    CONFIG_BT_BUF_CMD_TX_COUNT=10
    
    
    # NRF RPC
    CONFIG_NRF_RPC_THREAD_POOL_SIZE=2
    CONFIG_HEAP_MEM_POOL_SIZE=4096
    CONFIG_CMSIS_THREAD_MAX_STACK_SIZE=8192
    CONFIG_GPIO=y
    CONFIG_SPI=y
    
    CONFIG_PM_DEVICE=y
    
    
    CONFIG_UART_CONSOLE=n
    CONFIG_SERIAL=n
    CONFIG_LOG=n
    CONFIG_PRINTK=n
    


    main.c:
    /*
     * Copyright (c) 2021 Nordic Semiconductor ASA
     *
     * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
     */
    
    /** @file
     * @brief Nordic Distance Measurement sample
     */
    
    #include <stdint.h>
    #include <zephyr/kernel.h>
    #include <zephyr/sys/printk.h>
    #include <zephyr/sys/byteorder.h>
    
    int main(void)
    {
    
        sys_poweroff();
        while(1)
        {
            k_sleep(K_FOREVER);
        }
    }



    in the build config I am using as Base configuration: prj.conf and boards/nrf5340dk_nrf5340_cpuapp.conf
    as Extra Kconfig fragments: child_image/hci_ipc.conf
    as Base Devicetree overlay: app.overlay
    as Extra Devicetree overlays: boards/nrf5340dk_nrf5340_cpuapp.overlay and child_image/hci_ipc/boards/nrf5340dk_nrf5340_cpunet.overlay


    I hope you can help me with this problem or provide a tested sample so that I can find out what my problem is.

    Thank you very much in advance!

  • Hi,

    I see you describe a mix of sysbuild and child_image files (which are not used together). Which SDK version are you using, and can you upload your entire project as a zip file that I can build on my end? (That will be after Christmas, though). 

    In the mean time, I would advice that you look at the generated .config for both the app and net core image, and verify there that UART/serial/logging features are all disabled for both cores.

    Also, I see you write that when When I'm setting the DK to sys_poweroff(), I am getting approx. 450-500 µA. This leads me to wonder if you have any thing connected to the DK, and that is what is contributing to the current consumption? Which idle current consumption do you get if you take just the BLE beacon sample and disable logging? Do you see a high current consumption then as well?

Reply
  • Hi,

    I see you describe a mix of sysbuild and child_image files (which are not used together). Which SDK version are you using, and can you upload your entire project as a zip file that I can build on my end? (That will be after Christmas, though). 

    In the mean time, I would advice that you look at the generated .config for both the app and net core image, and verify there that UART/serial/logging features are all disabled for both cores.

    Also, I see you write that when When I'm setting the DK to sys_poweroff(), I am getting approx. 450-500 µA. This leads me to wonder if you have any thing connected to the DK, and that is what is contributing to the current consumption? Which idle current consumption do you get if you take just the BLE beacon sample and disable logging? Do you see a high current consumption then as well?

Children
No Data
Related