nRF Connect SDK v1.8.0 + nrf_pwr_mgmt_run

Hi Team,

We are working with nRF52832 and nRF Connect SDK v1.8.0. Our application needs to sleep (power save mode) for 5 minutes and every 5 minutes it should wake-up and perform some task (including BLE Advertisement).

We believe this can be achieved using "nrf_pwr_mgmt_run", however, it seems document around this is very slick, specially for nRF Connect SDK v1.8.0. There is no example of how to use it in NRF Connect SDK with Zephyr.

So, our questions are:

1. How to put system to sleep using nRF connect SDK?

2. Is there any example that can be referred to implement BLE Sleep Mode with wake-up using timer in NRF Connect SDK?

Thanks!

Parents
  • Hi,

    The nrf_pwr_mgmt_run() function is from the nRF5 SDK, and is broadly speaking just a wrapper for putting the CPU in idle mode (in the end by calling __WFE(), potentially via sd_app_evt_wait() if using the SoftDevice). This is a nRF5 SDK specific library that has no use in the nRF Connect SDK.

    1. How to put system to sleep using nRF connect SDK?

    With the nRF Connect SDK and Zephyr there is a idle thread, and this idle thread will automatically enter system ON sleep mode (WFE). There is no need to do anything specifically for this to happen. As long as you don't have any other threads using the CPU, the CPU will be idle. Note that regardless of this you also need to ensure you don't use other resources on the chip or your board that consume power, like for instance UART logging, in order to achieve low power. I suggest you refer to the Power optimization chapter in the SDK documentation for an overview.

    2. Is there any example that can be referred to implement BLE Sleep Mode with wake-up using timer in NRF Connect SDK?

    All nRF Connect SDK Bluetooth example behave like this out of the box. They may not be low-power even if this is done though, as logging is enabled by default.

  • Hi Einar,

    Thanks for the response. I've few following questions, could you please help me pointing to the right direction?

    1. How do I ensure that nRF52832 is going tin to sleep mode?
    2. We need to use BLE, I2C, PWM, UART in wake state, so, what's the best way to disable all these while going into the sleep mode?
    3. Is there a way to put chip to system OFF state using nRF Connect SDK? If we put system to OFF state, will it shut down all peripherals? What's the power consumption for system OFF state to running state?

    Thanks.

  • Hi,

    embeddedER said:
    1. How do I ensure that nRF52832 is going tin to sleep mode?

    If by sleep you. mean system ON mode, then just don't do anything else. The idle thread will always enter system ON sleep mode, and the IC will wake up on the next interrupt/event, which may be from something external or from the a RTC timer.

    embeddedER said:
    2. We need to use BLE, I2C, PWM, UART in wake state, so, what's the best way to disable all these while going into the sleep mode?

    For instance for BLE, this si handled by the stack. So the CPU will sleep between advertising events, connection events etc and you don't need to think about that specifically. Also, if you want to disable advertising or other things, disable that. As mentioned, the default state is to go to sleep, so nothing specific is needed. Simply stop doing what you no longer want to do. For using other peripherals the same applies there most of the times, but some peripherals will cause the high frequency clock and other resources to be active, depending on how they are used. Make sure to complete any transactions. As this is use case dependent I suggest you test your code, commenting out parts of it so that you isolate your use of specific peripherals and measure the current consumption to see if you need to do something with each specific case.

    embeddedER said:
    3. Is there a way to put chip to system OFF state using nRF Connect SDK? If we put system to OFF state, will it shut down all peripherals? What's the power consumption for system OFF state to running state?

    Yes, you can use system OFF with the nRF Connect SDK. Note that a wakeup from system OFF is always in form of a reset, so everything needs to be configured again. There is also a limited set of wakeup sources. For those reasons, system OFF is only useful in some specific use cases.  You can refer to the nRF5x System Off demo.  The current consumption for the nRF52832 in system OFF mode is about 0.7 uA. In system ON mode (which is normally what is used), the current consumption is about 2 uA.

    You may also find Optimizing Power on nRF5340 SoC Designs interesting. While this blog post targets the nRF5340, most of what is covered is equally valid for nRF52 series devices.

Reply
  • Hi,

    embeddedER said:
    1. How do I ensure that nRF52832 is going tin to sleep mode?

    If by sleep you. mean system ON mode, then just don't do anything else. The idle thread will always enter system ON sleep mode, and the IC will wake up on the next interrupt/event, which may be from something external or from the a RTC timer.

    embeddedER said:
    2. We need to use BLE, I2C, PWM, UART in wake state, so, what's the best way to disable all these while going into the sleep mode?

    For instance for BLE, this si handled by the stack. So the CPU will sleep between advertising events, connection events etc and you don't need to think about that specifically. Also, if you want to disable advertising or other things, disable that. As mentioned, the default state is to go to sleep, so nothing specific is needed. Simply stop doing what you no longer want to do. For using other peripherals the same applies there most of the times, but some peripherals will cause the high frequency clock and other resources to be active, depending on how they are used. Make sure to complete any transactions. As this is use case dependent I suggest you test your code, commenting out parts of it so that you isolate your use of specific peripherals and measure the current consumption to see if you need to do something with each specific case.

    embeddedER said:
    3. Is there a way to put chip to system OFF state using nRF Connect SDK? If we put system to OFF state, will it shut down all peripherals? What's the power consumption for system OFF state to running state?

    Yes, you can use system OFF with the nRF Connect SDK. Note that a wakeup from system OFF is always in form of a reset, so everything needs to be configured again. There is also a limited set of wakeup sources. For those reasons, system OFF is only useful in some specific use cases.  You can refer to the nRF5x System Off demo.  The current consumption for the nRF52832 in system OFF mode is about 0.7 uA. In system ON mode (which is normally what is used), the current consumption is about 2 uA.

    You may also find Optimizing Power on nRF5340 SoC Designs interesting. While this blog post targets the nRF5340, most of what is covered is equally valid for nRF52 series devices.

Children
  • Thanks Einar. Links provided are certainly useful. And I am sorry, I didn't make myself more clear, so let me try to rephrase the same:

    1. How do I verify that nRF chip is really in sleep mode? Is the using external tools current consumption is the only way to verify?

    2. For System OFF  mode, I checked the power consumption in datasheet. However, what I couldn't get is "What's the cost (in terms of power/timing) of switching from System OFF (and sleep with system ON) to execution mode?" 

    Thanks again!

  • embeddedER said:
    1. How do I verify that nRF chip is really in sleep mode? Is the using external tools current consumption is the only way to verify?

    Measuring the current consumption is the proof of the pudding, yes. It does not help much if you put the CPU to sleep, but current consuming resources are kept active for other reasons (of which there can be many). So you need to measure the current consumption in order to know this.

    embeddedER said:
    2. For System OFF  mode, I checked the power consumption in datasheet. However, what I couldn't get is "What's the cost (in terms of power/timing) of switching from System OFF (and sleep with system ON) to execution mode?" 

    That cost is application specific, as wakeup from system of involves a reset. Typically the cost is high, as all initialization etc. needs to be done again. Due to the limited set of wakeup sources available system OFF may not even be an option in many cases. What will you wake up on? Also, unless you intend the device to sleep for a relatively long time (again how much is application specific so you really need to do measurements with your configuration to get exact numbers), system ON sleep mode will typically be more sensible and give you lower average current consumption, which is in the end what affects battery life.

Related