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

How to get NRF52840 into deep sleep while power supply is low?

Chip: NRF52840

Firmware platform: Wirepas V5

Hello!

I am now writing firmware for a product based on HW&SW mentioned above.

It is powered by battery and sends data periodically.

I want to halt or deep-sleep the chip after detecting the supply voltage is low enough(~2.5V), and resume after voltage is normal.

Problem is that Wirepas SDK doesn't provide such APIs, so I have to implement it in application code.

Will you please provide some advice? Where to find related APIs, and how to implement them correctly?

Best regards,

Daniel Duan

Parents
  • Hi Shaney,

    Thanks for your suggestion!

    Sorry I can't implement this since the Wirepas stack takes control of related registers and no APIs to share with application.

    I also asked them for suggestion, seems the best way is to turn off the radio part, and I am waiting for their suggestion.

    Anyway I really appreciate your immediate help.

    Thanks and best regards!

    DanielDuan

  • Hello Daniel,

    I guess you would have to check with the authors of the Wirepas stack to make sure that you don't break anything by entering system off at the wrong time. Check whether there are some graceful shutdown considerations you need to take. I am not familiar with Wirepas, but based on a quick Google search, it looks like some sort of (Bluetooth?) Mesh stack.

    So I guess it holds some network information that may or may not need to be stored in flash before entering system off.

    However, there is an API to enter system off, found in nrf_power.h in NCS:

    __STATIC_INLINE void nrf_power_system_off(void)
    {
        NRF_POWER->SYSTEMOFF = POWER_SYSTEMOFF_SYSTEMOFF_Enter;
        __DSB();
    
        /* Solution for simulated System OFF in debug mode */
        while (true)
        {
            __WFE();
        }
    }

    You can check out the implementation of nrf_power_system_off. It tells you the address of the system off register, which you can also find here.

    Best regards,

    Edvin

Reply
  • Hello Daniel,

    I guess you would have to check with the authors of the Wirepas stack to make sure that you don't break anything by entering system off at the wrong time. Check whether there are some graceful shutdown considerations you need to take. I am not familiar with Wirepas, but based on a quick Google search, it looks like some sort of (Bluetooth?) Mesh stack.

    So I guess it holds some network information that may or may not need to be stored in flash before entering system off.

    However, there is an API to enter system off, found in nrf_power.h in NCS:

    __STATIC_INLINE void nrf_power_system_off(void)
    {
        NRF_POWER->SYSTEMOFF = POWER_SYSTEMOFF_SYSTEMOFF_Enter;
        __DSB();
    
        /* Solution for simulated System OFF in debug mode */
        while (true)
        {
            __WFE();
        }
    }

    You can check out the implementation of nrf_power_system_off. It tells you the address of the system off register, which you can also find here.

    Best regards,

    Edvin

Children
Related