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

Can't enter app_sched_execute, is the scheduler blocked

Hi everyone, I am now writing a program with scheduler. But the program always can't enter app_sched_execute. I don't kow the reason. Is the scheduler blocked.

Firstly, in main I just initialize scheduler, such as APP_SCHED_INIT(0, 5);

Then, in for, for(;;) { app_sched_execute(); power_manage(); }

power_manage:
  static void power_manage(void) 
  {
    uint32_t err_code = sd_app_evt_wait();
    APP_ERROR_CHECK(err_code);
  }

I have a interrupt which has a 3s interval. when the interrupt happens, I just call the function(app_sched_event_put), such as app_sched_event_put(NULL, 0, test_example_sched_event_handler);

My program also have two timers, and the one interval is 1s, the other is 5s, with calling APP_TIMER_INIT and app_timer_create to initialize timer, app_timer_start start the timer.

The program run in the nrf51822. After 15 hours or longer hours, the program can't enter the app_sched_execute.

Parents Reply Children
  • Hi Aryan, I appreciate very much that you give me help and your kindness.You said "I am not convinced that your timer interrupts working and still app_Sched_execute cannot work", I sure the timer interrupts is ok when app_Sched_execute cannot work. My colleague find the one reason that the program is blocked in a "while" cycle. In the code, we use I2C, and the I2C diver code has "while" cycle, such as

    while(NRF_TWI1->EVENTS_STOPPED == 0) {
    }
    

    So, when the code enter that "while", the app_sched_execute can't execute. I wonder that except this reason there are other reasons?

Related