Configuring WDT causes reboot during FOTA

Hello,

I am writing an application based in nrf1.9.1 in a nrf9160 based board.

AWS FOTA is working fine.

I recently added a watchdog for the application, following this steps:

- Initialize the watchdog

- Configure a channel with a generous timeout (for testing purposes 100s)

- I feed the watchdog in a loop that is running in the main thread every 100ms

The application works fine but as soon as I try a FOTA update the application reboots after a few seconds, not completing the FOTA download. If I comment out the code that configures the watchdog channel (leving the the watchdog init intact) the FOTA works correctly.

Initi of the watchdog is done like this:

int watchdog_init() {
	int ret;
	const struct device *hw_wdt_dev = DEVICE_DT_GET(WDT_NODE);

	LOG_DBG("Task watchdog init.\n");

	if (!device_is_ready(hw_wdt_dev)) {
		LOG_ERR("Hardware watchdog %s is not ready; ignoring it.\n",
		       hw_wdt_dev->name);
		hw_wdt_dev = NULL;
	}

	ret = task_wdt_init(hw_wdt_dev);
	if (ret != 0) {
		LOG_ERR("task wdt init failure: %d\n", ret);
		return ret;
	}
    return 0;
}

Configuration of the channel:

    char *wdt_msg="motion";
    uint32_t wdt_timeout = MOTION_THRESH_DETECT_DELAY_MS*1000U;
    LOG_DBG("Configuring watchdog %s with timeout %dms",wdt_msg,wdt_timeout);
    motion_thresh_detect_wdt_id = task_wdt_add(wdt_timeout, &reboot_callback_wdt, (void *)wdt_msg);

Feeding of the watchdog:

task_wdt_feed(motion_thresh_detect_wdt_id);

Callback function when the watchdog is triggered:

void reboot_callback_wdt(int channel_id, void *user_data)
{
	//Needs to be a quick operation (32k ticks?)
	printk("------>WATCHDOG REBOOT: Task watchdog channel %d callback, thread: %s\n",
		channel_id, (char *)user_data);
}

Parents Reply Children
No Data
Related