Expected current consumption in the nRF52832 when using Zephyr RTOS.

Hi,

I am using nRF52832 board and I want to understand the current consumption in the board will differs while running the code in zephyr RTOS platform and without zephyr RTOS platform. I want to know analysis behind the current consumption evaluation if we are using the Zephyr RTOS platform will increase compared to the without using Zephyr RTOS.

Can please guide me through this. Will the expected current consumption increase in Zephyr RTOS vs without Zephyr RTOS?

Details:

Hardware: nRF52832 board. 

Software: visual studio. version (1.87.2)

SDK: nrFConnect for Visual Studio. Version (v2.5.2)

Thanks in advance,

Naveed

Parents
  • Hi Naveed,

    You could use the PPK2 to do this. We already have a blogpost on comparison on power consumption on nRF Connect SDK (based on Zephyr) and nRF 5 SDK (older SDK that dose not support Zephyr) that you can see here: https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/debunking-misconceptions-a-technical-analysis-of-nrf5-sdk-and-nrf-connect-sdk#:~:text=various%20firmware%20metrics.-,Power%20consumption,-Reducing%20power%20consumption 

    Best Regards,

    Swathy

  • Hi,

    Thank you for your response. Sorry for the delayed response, I was occupied for other tasks.

    I am trying to create a new project in VS Code in zephyr RTOS platform and I want to measure the current consumption of the device.

    I am using the nRF52832 board, Created a project in VS code with main function and one idle thread(while loop with no functions). In the main function I have disconnected all the GPIO's in the board which may drive some current.

    I am following the below API's to disable the GPIO's in the main. 

            nrf_gpio_cfg_input(2,NRF_GPIO_PIN_NOPULL);
            nrf_gpio_input_disconnect(2);
            nrf_gpio_cfg_input(3,NRF_GPIO_PIN_NOPULL);
            nrf_gpio_input_disconnect(3);
            nrf_gpio_cfg_input(30,NRF_GPIO_PIN_NOPULL);
            nrf_gpio_input_disconnect(30);
    Same steps followed to disable all the other GPIOs. Is this correct, what is the correct way to disable the GPIO?
    I am using joule scope to measure the current readings. Below are the current consumption readings observed in the joule scope.
    1. For an idle thread with no other GPIOs configured, current consumption is around 4mA.
    2. For an idle thread with all the GPIOs configured to disconnect state, current consumption is around  5.4mA.
    3. For single thread with one led blinking continuously, current consumption is around 3.4mA,
    4. When two led is continuously on-state the current consumption is around 13mA.
    Also tried adding the below configuration as well. there is no change in the current readings.   
    • Adding CONFIG_SERIAL=n in project config file.
    • Adding CONFIG_PM_DEVICE=y in project config file. 
    Please help me to understand what is happening here?
    1. Why the current is increased from 4mA to 5.4mA when all the GPIOs are disconnected and not when led is blinking(it shows 3.4mA)?
    2. What is the current reading should be expected for an idle thread? (It should be in micro amps?).
    3. What are the things to be taken care while creating a new project in the visual studio?
    4. What are the basic configuration setting to be taken in the main function before adding the application code?
    5. What are the CONFIG macros to be enable or disable in the project config file to minimize the power consumption?

    Regards,

    Naveed

Reply
  • Hi,

    Thank you for your response. Sorry for the delayed response, I was occupied for other tasks.

    I am trying to create a new project in VS Code in zephyr RTOS platform and I want to measure the current consumption of the device.

    I am using the nRF52832 board, Created a project in VS code with main function and one idle thread(while loop with no functions). In the main function I have disconnected all the GPIO's in the board which may drive some current.

    I am following the below API's to disable the GPIO's in the main. 

            nrf_gpio_cfg_input(2,NRF_GPIO_PIN_NOPULL);
            nrf_gpio_input_disconnect(2);
            nrf_gpio_cfg_input(3,NRF_GPIO_PIN_NOPULL);
            nrf_gpio_input_disconnect(3);
            nrf_gpio_cfg_input(30,NRF_GPIO_PIN_NOPULL);
            nrf_gpio_input_disconnect(30);
    Same steps followed to disable all the other GPIOs. Is this correct, what is the correct way to disable the GPIO?
    I am using joule scope to measure the current readings. Below are the current consumption readings observed in the joule scope.
    1. For an idle thread with no other GPIOs configured, current consumption is around 4mA.
    2. For an idle thread with all the GPIOs configured to disconnect state, current consumption is around  5.4mA.
    3. For single thread with one led blinking continuously, current consumption is around 3.4mA,
    4. When two led is continuously on-state the current consumption is around 13mA.
    Also tried adding the below configuration as well. there is no change in the current readings.   
    • Adding CONFIG_SERIAL=n in project config file.
    • Adding CONFIG_PM_DEVICE=y in project config file. 
    Please help me to understand what is happening here?
    1. Why the current is increased from 4mA to 5.4mA when all the GPIOs are disconnected and not when led is blinking(it shows 3.4mA)?
    2. What is the current reading should be expected for an idle thread? (It should be in micro amps?).
    3. What are the things to be taken care while creating a new project in the visual studio?
    4. What are the basic configuration setting to be taken in the main function before adding the application code?
    5. What are the CONFIG macros to be enable or disable in the project config file to minimize the power consumption?

    Regards,

    Naveed

Children
  • Hi!

    Swathy is out of office, so I'm replying instead.

    Based on your measurement, it seems like the CPU is not in idle. I don't know how your code looks like, but here is a sample you can use for power profiling: https://github.com/nrfconnect/sdk-zephyr/tree/v3.5.99-ncs1/samples/boards/nrf/system_off

  • Hi,

    Thankyou for sharing the example code. I have run the system_off code on my customized nrf52832 board. I am measuring the current consumption using the joules scope(I am not using PPK2 setup). My device consuming around 1mA of current but it should consume 0.3µA of current in system off mode.
    In the data sheet it is given as attached below, 

    Let me know what might be the reason for the current consumption here.

    I am using the following setup.
    Hardware: nRF52832 board. 
    Software: visual studio. version (1.87.2)
    SDK: nRF Connect for Visual Studio. Version (v2.5.2)

    From the ticket I came to know that there is no separate soft device for nRF Connect. As nRF connect is based on the Zephyr RTOS. ticket: https://devzone.nordicsemi.com/f/nordic-q-a/83481/nrf-connect-for-vs-code-and-softdevice

    In my previous code of nRF5 SDK 15.3 I am using the soft device S132. As I am porting into the Zephyr RTOS platform what would be the equivalent changes in the configuration I need to do in the nRF Connect SDK project.

    Can you please let me know what will be the equivalent configuration/API libraries we can use for the following functions in nRF 5 SDK to port the same into the nRF connect SDK Zephyr RTOS platform.

    1.  
      static void idle_state_handle(void)
      {
          if (NRF_LOG_PROCESS() == false)
          {
              nrf_pwr_mgmt_run();
          }
      }
       
    2. void powerManagementInit(void)
      {
          uint32_t err_code = nrf_pwr_mgmt_init();
          APP_ERROR_CHECK(err_code);
      }
    3. sd_power_dcdc_mode_set(NRF_POWER_DCDC_ENABLE);
    4.  // Initialize the async SVCI interface to bootloader before any interrupts are enabled.
          err_code = bleDfuButtonlessAsyncSvciInit();
          APP_ERROR_CHECK(err_code);

    Please let me know how to proceed in the nRF Connect SDK Zephyr RTOS in VS code. 

    I have testing the following function in the nRF connect SDK, but still the current consumption is around 1mA only.

    Functions tried are,

    1. k_cpu_idle();
    2. k_sleep(K_FOREVER);

    Your input will be appreciated.

    Regards,

    Naveed

Related