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

Prevent sd_app_evt_wait from wakeup

hello,

I'm currently stuck with sd_app_evt_wait() function leaving for an unknown reason. This function is called in the main loop.

The only reasons that shall exit the low power mode are:

- RTC1 (app_timer) callback trigger, it is triggered every 100ms

- one of 10 GPIOs state change (buttons)

Could you please help me find the reason why the execution does not stay in sd_app_evt_wait wakeup() and eventually guide me to a solution?  If you need more details, please aks, I don't know what you would need.

Note:

- This function leaves with error code 0 and NVIC_GetPendingIRQ() also returns 0 just after this function

- my board does not have any external XTAL, instead I use LF_RC clock and I manually start LFCLK before initializing the softdevice. I do not manually start HFCLK, does the softdevice initialization does it automatically?

- if I do not initialize the softdevice and call  __WFI();__WFE();__SEV();__WFE(); I stay in low power mode. The simple fact to call SOFTDEVICE_HANDLER_INIT() introduces my problem.

- I don't know how to debug to find out the reason

- because of this problem, the board power consumption is 7,5mA instead of few µA which is a current NO GO for production.

- Does it have to do with a disabled interrupt? How could I know which disabled interrupt occurs?

Thanks in advance for your help.

Parents
  • yes, the program passes the ble_stack_init() and yes sd_app_evt_wait() is called in the main loop.

    I can advertise, connect, read/write characteristics.... it's just that the µC does not stay in low power mode and leaves sd_app_evt_wait(), I don't know how to find the wakeup reason.

     

    The clock assignment is the following:

     

    #define NRF_CLOCK_LFCLKSRC {.source = NRF_CLOCK_LF_SRC_RC , \
    .rc_ctiv = 16, \
    .rc_temp_ctiv = 2, \
    .xtal_accuracy = 0} ///ignored when using LF RC
    
    nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;
    
    // Initialize SoftDevice.
    SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL);
    
     

     

     

Reply
  • yes, the program passes the ble_stack_init() and yes sd_app_evt_wait() is called in the main loop.

    I can advertise, connect, read/write characteristics.... it's just that the µC does not stay in low power mode and leaves sd_app_evt_wait(), I don't know how to find the wakeup reason.

     

    The clock assignment is the following:

     

    #define NRF_CLOCK_LFCLKSRC {.source = NRF_CLOCK_LF_SRC_RC , \
    .rc_ctiv = 16, \
    .rc_temp_ctiv = 2, \
    .xtal_accuracy = 0} ///ignored when using LF RC
    
    nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;
    
    // Initialize SoftDevice.
    SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL);
    
     

     

     

Children
No Data
Related