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

nrf_delay_ms with a delay above 100msec causes reset with app timers running!

Hi,

I have a reset issue when trying to set a delay greater or equal to 100 milliseconds using nrf_delay_ms(...). This only happens if I start my app timers (app_timer_start(...)) before calling the delay function. If the app timers are not running, the delay executes without any problem even up to 5 seconds!

Is there a watchdog initialised hidden somewhere in these app timer functions that I am missing and that is resetting my MCU above 100 msecs?

Thanks for the help.

Phil

  • No problem, I have a way around the issue. But it would be good to find out! Thanks so far.

    Phil

  • Is there any progress on this problem? I got this same NRFERROR_NO_MEM error in timeout_handler_exec when I use app_timer and schedule, But I think there is no long delay in my code. Which operation to app_timer will be pushed into queue beside start_timer and stop_timer? Will the timeout event be added into this queue? APP_TIMER_OP_QUEUE_SIZE is 20 and APP_TIMER_MAX_TIMERS is 11. image description

  • If your are using sdk8 with timer and scheduler at the same time you need to init the timer with APP_TIMER_APPSH_INIT.

  • Hey John,

    I am facing a similar issue. I have the following code: void timer_handler(void *p_context) { uint32_t err_code = app_timer_stop(timer_id); APP_ERROR_CHECK(err_code); func_2(); }

    void func_1() { /code/

    //create timer
    uint32_t err_code = app_timer_create(&timer_id, APP_TIMER_MODE_SINGLE_SHOT, timer_handler);
    APP_ERROR_CHECK(err_code); 
    err_code = app_timer_start(timer_id, TIMER_INTERVAL(TIMER_INTERVAL_S), NULL);
    APP_ERROR_CHECK(err_code); 
    return;
    

    }

    void func_2() { /* code*/ nrf_delay_ms(125); //system gets stuck here!! /code/ return; }

    for the assert I have this: void app_error_handler(uint32_t error_code, uint32_t line_num, const uint8_t * p_file_name){ //DEBUG_PRINTF("app_error_handler\r\nerror_code=%u\r\nline_num=%u\r\nfile_name=%s",error_code,line_num,p_file_name); SEGGER_RTT_printf(0, "app_error_handler\r\n: 0x%#04x\nline_num=%u\r\nfile_name=%s",error_code, line_num,p_file_name);
    }

    void assert_nrf_callback(uint16_t line_num, const uint8_t * p_file_name) { app_error_handler(1, line_num, p_file_name); }

    I'm getting the following response on RTTviewer: 0> app_error_handler 0> : 0x0005 0> line_num=1371 0> file_name=src\rem.c

    I'm using a custom board with nrf51822. The system gets stuck after this error and doesn't reset. If I enable wdt then I do see a reset. Why is this error occurring even after stopping the timer?

Related