Because this is my first time on this forum, therefore first: "Greetings to everybody".
I'm just start digging into nrf with FreeRTOS (NRF52832, custom board, SDK14.0.0.3, SD 5.0, GCC, debugging through NRF52DK). I start my job base on example "ble_app_hrs_freertos". In main function there is bunch of initialisations and AFTER that is created task with softdevice. Snippet:
sensor_simulator_init();
conn_params_init();
peer_manager_init();
application_timers_start();
// Create a FreeRTOS task for the BLE stack.
// The task will run advertising_start() before entering its loop.
nrf_sdh_freertos_init(advertising_start, &erase_bonds);
During my test I met assertion failure. Stack looks in this way:
Thread #1 57005 (Suspended : Signal : SIGTRAP:Trace/breakpoint trap)
0xa2c94710
<signal handler called>() at 0xfffffff1
app_error_fault_handler() at app_error_weak.c:54 0x233c8
app_error_handler() at app_error.c:73 0x2330a
assert_nrf_callback() at main.c:246 0x2a31c
vTaskNotifyGiveFromISR() at tasks.c:4 309 0x2859e
SWI2_EGU2_IRQHandler() at nrf_sdh_freertos.c:65 0x33e84
<signal handler called>() at 0xfffffff9
xTaskGetSchedulerState() at tasks.c:3 365 0x28262
xQueueGenericSend() at queue.c:624 0x26c5a
xTimerGenericCommand() at timers.c:338 0x287a2
application_timers_start() at main.c:585 0x2aa9c
main() at main.c:1 086 0x2b20a
In main() NRF was in application_timers_start(), so before creating task with softdevice. In SWI2_EGU2_IRQHandler() processor attempt to run this function: vTaskNotifyGiveFromISR(m_softdevice_task, &yield_req). But variable m_softdevice_task was equal to 0 (because there wasn't such task).
Now, according FAQ in FreeRtos page, this isn't allowed to init interrupt before we create tasks, those can i.e. receive notifications, sent from these IRQ.
My question is: is this example incorrect, or I miss something? Let me note, that in SDK13.1.0.7, same example looks differ, in my opinion in correct way. There initialization of i.e. timers was made inside of task, at begin.
best regards, Gregor