I am trying to add the scheduler to an existing program. The program works fine as is, but every now and then I see some timing issues that I believe are caused by everything running in interrupt context. This program has ~20 timers.
In an attempt to add the scheduler, I made the following additions:
#include "app_timer_appsh.h"
#include "app_scheduler.h"
#include "softdevice_handler_appsh.h"
//in timers_init()
//APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, false);
APP_TIMER_APPSH_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, true);
//in ble_stack_init(()
//SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_250_PPM, NULL);
SOFTDEVICE_HANDLER_APPSH_INIT(NRF_CLOCK_LFCLKSRC_XTAL_250_PPM, true);
//added to main()
APP_SCHED_INIT(sizeof(app_timer_event_t), 10);
//added into main loop
app_sched_execute();
Those are all the changes I made, and the now the program runs, but crashes all over the place, especially on button presses.
It's my understanding that all the timer_timeout_handlers would now be automatically added to the scheduler queue and in theory everything should still works as before.
Did I miss something major?