Hi!
I started to modify the ble_app_blinky example. I need to increase ATT_MTU, so I modified NRF_SDH_BLE_GATT_MAX_MTU_SIZE. For this, I needed to increase the RAM of the softdevice. Now, the firmware is hard faults, exactly when FIRST_CONN_PARAMS_UPDATE_DELAY expires. I see the stack trace as this:
#0 prvGetRegistersFromStack (pulFaultStackAddress= ) at /home/hollosi/projects/sa/firmware/firmware/main.c:218
#1
#2 scheduled_timeout_handler (p_event_data=0x20002f7a , event_size=8) at /home/hollosi/projects/sa/sdk/nRF5/components/libraries/timer/app_timer2.c:146
#3 0x0002b9e6 in app_sched_execute () at /home/hollosi/projects/sa/sdk/nRF5/components/libraries/scheduler/app_scheduler.c:280
#4 0x00000000 in ?? ()
The hardfault is in app_timer2.c, at the line when calling the timeout_handler (I am using the scheduler):
static void scheduled_timeout_handler(void * p_event_data, uint16_t event_size)
{
ASSERT(event_size == sizeof(app_timer_event_t));
app_timer_event_t const * p_timer_event = (app_timer_event_t *)p_event_data;
p_timer_event->timeout_handler(p_timer_event->p_context);
}
p_timer_event is not NULL, however, p_context is NULL:
(gdb) p *(app_timer_event_t*)0x20002f7a
$1 = {timeout_handler = 0x2f5a9 , p_context = 0x0}
It is interesting, that using the default ATT_MTU, hard fault disappears, so does, when I disable optimization fully.
I was aware that update_timeout_handler() uses p_context as conn_handle, however, the code does not enter into the function (I tried it with GDB and a LED flashing).
I hope someone can help me to debug this, I would not like to disable Connection Parameter Updates (which also solves the problem, since the hardfault happens there)!