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

How to put nRF52833 to sleep mode? we are not using softdevice.

Hi Devzone:

I want to make nRF52833 chip enter sleep mode but not deep sleep(SYSTEM OFF) so that real time clock can still wake up the system. We don't use softdevice.

Digging around the forum, it seems to me that if I write my main as follows:

void main()
{
...
while(1)
    {
    _WFE()
    }
}

Then when the code sits at _WFE, it should count as a "sleep mode", is that right? Please confirm this concept for me.

Some other posts I saw use "sd_app_evt_wait()"instead in the while loop and treat that as sleep mode. Since we don't' have soft device, we can't use this function.

According to the spec the current drawn in "SYSTEM ON, sleep mode" is 2.6 uA.

My question is, in order to achieve the stated low current (2.6uA), is putting the code in _WFE() enough? Do I need to do some i/o config? Do I need to turn off all interrupts (except, of course, RTC so it can be waken)?

Thanks.

Parents Reply Children
  • Hi Vidar:

    Thanks for replying. It sounds like in order to achieve sleep mode, PMU needs to be initialized and used.

    According to the power management example project provided by Nordic, the code to set up sleep mode and enter it seems to be:

    void main()
    {
    ...
    nrf_pwr_mgmt_init();
    ...
    while (1)
        {
        ...
         nrf_pwr_mgmt_run();
        ...
        }
    }

    I assume nrf_pwr_mgmt_init() and  nrf_pwr_mgmt_run() is the PMU you talked about is that right?

    But I was recommended in the past to do this instead:

    void main()
    {
    ...
    
    while (1)
        {
        ...
        _WFE();
        _SEV();
        _WFE();
        ...
        }
    }

    As you can see in the while loop it's not nrf_pwr_mgmt_run() but it's a sequence of WFE and SEV

    So which way is the correct way? would "nrf_pwr_mgmt_run();" run "_WFE()"?

  • Hi,

    The PMU is always enabled as a part of the system and not really related to the Power Management library. I mentioned the library mainly because it incorporates the FPU workaround. It also includes other features as mentioned in the documentation that you may find useful. It's however perfectly fine to not use the library. Calling __WFE() directly will have the same result.

    cpeng said:
    So which way is the correct way? would "nrf_pwr_mgmt_run();" run "_WFE()"?

    There is not really any difference when you call it from the main loop as I see it, both will make the CPU execute __WFE() until the system enters sleep. Note that the __WFE instruction is conditional and may not enter sleep the first time its called, please refer to the ARM doc here https://developer.arm.com/documentation/dui0552/a/the-cortex-m3-processor/power-management/entering-sleep-mode for a more detailed explanation on this. 

Related