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

gpiote interrupt cannot wake sd_app_evt_wait?

I have tried to use sd_app_evt_wait() to sleep cpu, and use gpiote interrupt to wake up cpu from sleep. However, gpiote interrupt cannot wake up cpu. When I use __WFE(), gpiote interrupt can wake up cpu. And even if I use sd_app_evt_wait(), log print using Segger RTT seems to wake up cpu however log print place is after sleep loop. This is very strange.

Would you explain this phenomenon?

code is like below.

static void sf_gpiote_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
     _print_info("gpiote interrupt\r\n");
     s_is_resp_ready = true;
}


static void sf_wait_resp()
{
     while(!s_is_resp_ready)
     {
        __WFE();
        // sd_app_evt_wait();
     }
     s_is_resp_ready = false;

    //_print_info("resp_ready\r\n");
}
Parents
  • Can you show me the code used to initialize the GPIOTE channel?

    sd_app_evt_wait() is using WFE under the hood, so there shouldn't be a big difference between the two, except sd_app_evt_wait() is running the recommended sleep sequence:

    __WFE();
    __SEV();
    __WFE();
    

    If you only run __WFE(); once then you might not go to sleep at all, if there is already an event pending.

    Best regards

Reply
  • Can you show me the code used to initialize the GPIOTE channel?

    sd_app_evt_wait() is using WFE under the hood, so there shouldn't be a big difference between the two, except sd_app_evt_wait() is running the recommended sleep sequence:

    __WFE();
    __SEV();
    __WFE();
    

    If you only run __WFE(); once then you might not go to sleep at all, if there is already an event pending.

    Best regards

Children
No Data
Related