This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How do you put the nrf51822 chip to sleep?

I am wondering how you put the nrf51822 chip to sleep. I've determined that the way to do this with the soft device is sd_app_event_wait() in the while loop. What about non-softdevice?

I am wanting to have it sleep until woken by interrupts, then sleep again. In another example, I found __wfi() used. Also, __WFI(). Neither seem to do anything, though.

Thanks!

Parents
  • Something like this should work:

    
    void sleep()
    {
    
        /* Clear Event Register */
        __SEV();
        /* Wait for event */
        __WFE();
        /* Wait for event */
        __WFE();
    }
    
    
  • I agree what Radoslaw says. I think the correct order should be __WFE(); __SEV(); __WFE(); This way we make sure that the first __WFE does not sleep if the event just happened before calling it. The other way would just clear that event, which is not a problem if this is called in loop inside main. But it will be problem if it is called in different priority context.

Reply
  • I agree what Radoslaw says. I think the correct order should be __WFE(); __SEV(); __WFE(); This way we make sure that the first __WFE does not sleep if the event just happened before calling it. The other way would just clear that event, which is not a problem if this is called in loop inside main. But it will be problem if it is called in different priority context.

Children
No Data
Related