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

System OFF/ wake up with NRF51822

Hi,

I have a simple battery powered remote control device with a NRF51822 and using the Gazelle protocol for communication with the host.

To save battery the MCU goes into System OFF state (I am using the power management module from the Smart Remote example). To wake up one of two push buttons have to be pressed or a rotary encoder has to be turned. Basically this works as desired and the power consumption is sufficiently low.

My questions are:

  1. How do I avoid to re-initialize Gazelle protocol after a wake up? In general is there a way to preserve the system status before entering System OFF state, thus avoiding re-initialization?

  2. When I press a button to wake up the MCU, the button press is not recognized by the application (though the system wakes up as desired). I have to press a button once to wake up and again to be recognized by the application (gpiote event handler). I assume this happens because multiple initialization routines are executed in the main(), so the transition from high to low is missed. Is there a way to figure out which gpio pin has woke up the system? Is there a general advise how to handle a wake up situation?

  3. How would an alternative to System OFF look like? Is if possible to achieve similar results regarding power saving when setting the system to sleep mode (using __WFI or __WFE commands)?

Thank you in advance!

  • The alternative to system off is called system on, idle, and is entered by doing a __WFI() call. When you wake up from this state, execution will continue from where it left off, and not cause a reset. You therefore need to make sure that this is handled appropriately.

    Using this power saving mode instead of system off is the only way to avoid reinitalization completely, and this would also remove your other problem with buttons not being correctly detected on startup.

    The alternative is to check which buttons are pushed on startup and act appropriately. There isn't any way to know which button woke you up when using the GPIOTE port event, so you have to check each button and do whatever is needed manually.

  • Hi Ole,

    thank you for your reply.

    I was able to find a workaround by using the GPREGRET register.

Related