simple watchdog time for nRF9160 DK board for V2.5.0

I have a nrf9160 DK board that I am running asset_tracker_v2. all is working fine. I want to add a simple watchdog timer control that will reset the board if I do not refresh the timer in N seconds. I do not need anything fancy. I just need the simplest implementation of a watchdog timer. Can you show me what I need to configure, setup, initialize, and call. I tried calling the function below but I got the error messages below in .../src/watchdog/watchdog_app.c; what am I doing wrong? I appreciate any help you could give.

watchdog_init_and_start()
watchdog_init_and_start called
*** Booting nRF Connect SDK v2.5.0 ***
ASSERTION FAIL [p_cb->state == NRFX_DRV_STATE_INITIALIZED] @ WEST_TOPDIR/modules/hal/nordic/nrfx/drivers/src/nrfx_wdt.c:164
[00:00:00.278,350] <err> os: r0/a1: 0x00000004 r1/a2: 0x000000a4 r2/a3: 0x00000002
[00:00:00.278,381] <err> os: r3/a4: 0x2000f560 r12/ip: 0x00000014 r14/lr: 0x00060707
[00:00:00.278,381] <err> os: xpsr: 0x41000000
[00:00:00.278,411] <err> os: s[ 0]: 0x200124e8 s[ 1]: 0x0006f490 s[ 2]: 0x00000000 s[ 3]: 0x00051de7
[00:00:00.278,411] <err> os: s[ 4]: 0x0006ea64 s[ 5]: 0x0006f490 s[ 6]: 0x00000001 s[ 7]: 0x0006ea3c
[00:00:00.278,442] <err> os: s[ 8]: 0x0006ea64 s[ 9]: 0x00046b5b s[10]: 0x0004ff71 s[11]: 0x00000000
[00:00:00.278,472] <err> os: s[12]: 0x2000cb84 s[13]: 0x0004e445 s[14]: 0x0006a0eb s[15]: 0x0006a0f1
[00:00:00.278,472] <err> os: fpscr: 0x0006ea3c
[00:00:00.278,503] <err> os: Faulting instruction address (r15/pc): 0x00069324
[00:00:00.278,564] <err> os: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0
[00:00:00.278,594] <err> os: Current thread: 0x200120b0 (unknown)
*** Booting nRF Connect SDK v2.5.0 ***Resetting system
  • Hello,

    Since you are using Asset Tracker v2, there is a watchdog in the utility module that you can enable (and look at its code).

    Best regards,

    Michal

  • Michal

    I believe I am using the watchdog utility. I called watchdog_init_and_start() to start and initialize the watchdog but I got an assertion error as shown above. what do I need to do to start, initialize, and use the watchdog time.

    ASSERTION FAIL [p_cb->state == NRFX_DRV_STATE_INITIALIZED] @ WEST_TOPDIR/modules/hal/nordic/nrfx/drivers/src/nrfx_wdt.c:164

  • I moved the watchdog_init_and_start right before the "while(true)" infinite loop at the end of main(). I still get the assert. any idea what I am missing?

    *** Booting nRF Connect SDK v2.5.0 ***
    [00:00:00.278,625] <inf> app_event_manager: APP_EVT_START
    [00:00:00.524,536] <inf> app_event_manager: MODEM_EVT_INITIALIZED
    ASSERTION FAIL [p_cb->state == NRFX_DRV_STATE_INITIALIZED] @ WEST_TOPDIR/modules/hal/nordic/nrfx/drivers/src/nrfx_wdt.c:164
    [00:00:00.558,410] <err> os: r0/a1: 0x00000004 r1/a2: 0x000000a4 r2/a3: 0x00000004
    [00:00:00.558,410] <err> os: r3/a4: 0x2000f608 r12/ip: 0x00000014 r14/lr: 0x00060e4f
    [00:00:00.558,441] <err> os: xpsr: 0x41000000
    [00:00:00.558,471] <err> os: s[ 0]: 0x20012590 s[ 1]: 0x0006fef0 s[ 2]: 0x2000f5d0 s[ 3]: 0x00052433
    [00:00:00.558,471] <err> os: s[ 4]: 0x0006f4ac s[ 5]: 0x0006fef0 s[ 6]: 0x00000001 s[ 7]: 0x2001db40
    [00:00:00.558,502] <err> os: s[ 8]: 0x00070744 s[ 9]: 0x00046cb3 s[10]: 0x00000000 s[11]: 0x00046bf1
    [00:00:00.558,532] <err> os: s[12]: 0x00000000 s[13]: 0x00000108 s[14]: 0x2000ce10 s[15]: 0x2000f288
    [00:00:00.558,563] <err> os: fpscr: 0x00064845
    [00:00:00.558,563] <err> os: Faulting instruction address (r15/pc): 0x00069d18
    [00:00:00.558,624] <err> os: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0
    [00:00:00.558,654] <err> os: Current thread: 0x20012158 (unknown)
    *** Booting nRF Connect SDK v2.5.0 ***Resetting system
    Attempting to boot slot 0.

  • I will try to do some tests and I'll get back to you.

    Best regards,

    Michal

  • Michal

    I have it working. It turns out all I needed to do was add "CONFIG_WATCHDOG_APPLICATION=y" to prj.conf. I can then modify the KCONFIG in the watchdog directory to set the time. It was operator error. Watchdog timer is super easy to use and is working. you can close this ticket.

Related