Assertion fail after initializing task watchdog with hardware watchdog fallback

I'm using nRF Connect SDK v2.7.0 with v2.7.0 toolchain to program a device with nRF52840 SoC.

When configuring task watchdog timer with hardware fallback an assertion fails in nrfx_wdt.c:277.

In the main function the task watchdog timer is configured as such:

  const struct device* const hw_wdt_dev = DEVICE_DT_GET_OR_NULL(WDT_NODE);
    if (!device_is_ready(hw_wdt_dev)) {
        LOG_INF("Hardware watchdog not ready; ignoring it.\n");
    }
    // assertion fail after this line if hardware watchdog is passed
    err = task_wdt_init(hw_wdt_dev);
    if (err != 0) {
        LOG_ERR("task wdt init failure: %d\n", err);
        return 0;
    }

Where WDT_NODE is defined as DT_ALIAS(watchdog0)

After debugging the program in Ozone I found that deeper inside the call stack of task_wdt_init there is a call to function nrfx_wdt_channel_feed.

During the execution of this function the expression the left is equal to  NRFX_DRV_STATE_INITIALIZED and so the assertion fails.
This is the function body:

void nrfx_wdt_channel_feed(nrfx_wdt_t const * p_instance, nrfx_wdt_channel_id channel_id)
{
    NRFX_ASSERT(m_cb[p_instance->drv_inst_idx].state == NRFX_DRV_STATE_POWERED_ON);
    nrfy_wdt_reload_request_set(p_instance->p_reg, channel_id);
}

I also noticed that the NRFX_DRV_STATE_POWERED_ON is set in function nrfx_wdt_enable and seemingly nowhere else in the files concearning watchdog driver, but it is not called anywhere before the assertion fail.

The assertion also fails when compiling an official task watchdog sample and enabling CONFIG_ASSERT in prj.conf

This is the relevant RTT log

00:00:00.632,751] <inf> bt_sdc_hci_driver: SoftDevice Controller build revision:
                                            d6 da c7 ae 08 db 72 6f  2a a3 26 49 2a 4d a8 b3 |......ro *.&I*M..
                                            98 0e 07 7f                                      |....             
[00:00:00.640,319] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
[00:00:00.640,686] <inf> bt_hci_core: HW Variant: nRF52x (0x0002)
[00:00:00.641,021] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 214.51162 Build 1926957230
[00:00:00.642,517] <inf> bt_hci_core: No ID address. App must call settings_load()
[00:00:00.642,883] <inf> main: Bluetooth initialized
ASSERTION FAIL [m_cb[p_instance->drv_inst_idx].state == NRFX_DRV_STATE_POWERED_ON] @ WEST_TOPDIR/modules/hal/nordic/nrfx/drivers/src/nrfx_wdt.c:277
[00:00:00.643,768] <err> os: r0/a1:  0x00000004  r1/a2:  0x00000115  r2/a3:  0x00000000
[00:00:00.644,195] <err> os: r3/a4:  0x00000004 r12/ip:  0x000002d5 r14/lr:  0x0005b649
[00:00:00.644,592] <err> os:  xpsr:  0x01000000
[00:00:00.644,897] <err> os: s[ 0]:  0x00000001  s[ 1]:  0x0006954b  s[ 2]:  0x00069535  s[ 3]:  0x0004a33b
[00:00:00.645,446] <err> os: s[ 4]:  0xffffffff  s[ 5]:  0xffffffff  s[ 6]:  0x20009650  s[ 7]:  0x00000000
[00:00:00.646,026] <err> os: s[ 8]:  0x2000a58c  s[ 9]:  0x0006a11d  s[10]:  0x00000000  s[11]:  0x0004a3f3
[00:00:00.646,575] <err> os: s[12]:  0x000000a2  s[13]:  0x00000001  s[14]:  0x00000000  s[15]:  0x0006a11d
[00:00:00.647,094] <err> os: fpscr:  0x00000000
[00:00:00.647,369] <err> os: Faulting instruction address (r15/pc): 0x00065a58
[00:00:00.647,735] <err> os: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0
[00:00:00.648,101] <err> os: Current thread: 0x20009650 (main)
[00:00:00.648,437] <err> os: Halting system

Parents Reply Children
No Data
Related