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
  • Hi,

    Yes, the device should enter System ON mode when you call __WFE in a loop. This is often all you have to do to get a ~2-3 uA idle idle current because the Power management unit (PMU)  takes care of the rest. But there are some exceptions, for instance,  when you use peripherals such as TIMER and UART that require a HF clock source to be kept active while in sleep, then you will see a floor current of around 0.5 - 1 mA.

    Note that if you use any FPU instructions you should also include the workaround for errata 87: [87] CPU: Unexpected wake from System ON Idle when using FPU. This workaround is already included in most examples as they use the Power Management library to enter sleep.

    Best regards,

    Vidar

  • 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()"?

Reply
  • 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()"?

Children
Related