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

Parents
  • Hi Phil,

    I believe the answer to your question if there is a watchdog timer initialization hidden in the app timer functions is "no". I'm using the app timer C file provided by Nordic and there is no watchdog timer started in that code.

    Regarding the reset you are seeing, it is hard to say what that might be. Have you turned on the assert callback and set a breakpoint in it to see if something in your code is throwing an assert? Can you check the reset reason in the POWER registers to see what the reset reason is?

    John

Reply
  • Hi Phil,

    I believe the answer to your question if there is a watchdog timer initialization hidden in the app timer functions is "no". I'm using the app timer C file provided by Nordic and there is no watchdog timer started in that code.

    Regarding the reset you are seeing, it is hard to say what that might be. Have you turned on the assert callback and set a breakpoint in it to see if something in your code is throwing an assert? Can you check the reset reason in the POWER registers to see what the reset reason is?

    John

Children
  • 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