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

  • 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

  • Hi John,

    Thanks, that seem's to be the problem, timeout_handler_exec(..) in app_timer.c is sending me back a (timeout?) error N° 4 on a 10msec application callback timer created and started before my delay function. I suppose the callback function is not being processed (and setting a breakpoint there confirms this).

    The problem now is why am I getting this error? Is my delay function non interruptible? I seriously doubt this is the case... and if it is how can I get around this issue?

    Phil

  • Hi Phil,

    That error is a NRF_ERROR_NO_MEM. So, you ran out of memory allocated for timer operations. Try bumping up the number of APP_TIMER_OP_QUEUE_SIZE and APP_TIMER_MAX_TIMERS you are allocating.

    John

  • Hi John,

    This unfortunately did not help, I pushed the queue size even up to 30 and it did not change anything. I also tried increasing the max amount of timers too without any result, but this should not help in any way since it is the amount of simultaneous timers you are setting up , or am I misunderstanding something? Well I am still getting the same error. I suppose I will have to start my 10 msec app timer after this delay.

    Phil

  • That's a bummer. I don't think you are missing something. I was more hopeful about the queue size than the max timers. But apparently neither worked. I'll post again if I think of something else.

Related