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

NRF_ERROR_NO_MEM in app_timer timeout handler

Hello,

I'm developing a bootloader based on the one included in SDK 13.1. It is now restarting due to an NRF_ERROR_NO_MEM that I'm not sure where it's coming from. It must come from an APP_ERROR_CHECK but I don't know which one.

I used to have a RAM warning from softdevice_enable and I got rid of it by changing the RAM region in the linker script accordingly.

/** RAM (rwx) :  ORIGIN = 0x20002C00, LENGTH = 0x5380 ORIGINAL RAM REGION */
  RAM (rwx) :  ORIGIN = 0x20002060, LENGTH = 0xDFA0

I thought that maybe with such an increase in the RAM region it would be solved but I was wrong.

I read in some threads that it may have something to do with the usage of timers (I added two to the bootloader) and an APP_TIMER_MAX_TIMERS macro that I should be modifying each time I add a timer, but the APP_ERROR_CHECKS after the timer initializations work without a problem. I also believe that that macro does not exist anymore in SDK 13.

What else can I do to solve this problem besides trying to reduce the RAM usage of my application? The NRF52832 chipset I'm using has 64 KB of RAM.

Update: I found the APP_ERROR_CHECK that's failing:

static void timeout_handler_exec(timer_node_t * p_timer)
{
#if APP_TIMER_CONFIG_USE_SCHEDULER
    app_timer_event_t timer_event;

    timer_event.timeout_handler = p_timer->p_timeout_handler;
    timer_event.p_context       = p_timer->p_context;
    uint32_t err_code = app_sched_event_put(&timer_event, sizeof(timer_event), timeout_handler_scheduled_exec);
    NRF_LOG_INFO("timeout handler err code: %d\r\n", err_code);
    APP_ERROR_CHECK(err_code);
#else
    p_timer->p_timeout_handler(p_timer->p_context);
#endif
}

It looks like app_sched_put_event() fails because the app scheduler queue is full, and it therefore returns an NRF_ERROR_NO_MEM error.

Parents Reply Children
No Data
Related