Hello all,
I use a nrf9160. In my program, I would like to use a watchdog to be sur than my application is running.
1. I would like to save some data in memory without clean it on restart (reaseon of crashed, differents states), first I would like to use the NCS, but I think it would use too much time.
Do you have an idea how to save this data and how to access it?
2. The watchdog works, but the callback function looks never come.
I have used the sample to init it, but nothing to do. The wdg seems to initialize well because I get no error and I also get "IWDG driver for STM32 support callback".
Do you have an idea what I'm doing wrong?
Thank you
printk("WDT_DEV_NAME: %s\n", WDT_DEV_NAME); wdt = device_get_binding(WDT_DEV_NAME); if (!wdt) { printk("Cannot get WDT device\n"); return -1; } if (!wdt) { printk("WatchdogController not init!\n"); return -1; } /* Reset SoC when watchdog timer expires. */ wdt_config.flags = WDT_FLAG_RESET_SOC; /* Expire watchdog after timeMax milliseconds. */ wdt_config.window.min = timeMin*1000; wdt_config.window.max = 30*1000; /* Set up watchdog callback. Jump into it when watchdog expired. */ wdt_config.callback = wdt_callback; wdt_channel_id = wdt_install_timeout(wdt, &wdt_config); if (wdt_channel_id == -ENOTSUP) { /* IWDG driver for STM32 doesn't support callback */ printk("IWDG driver for STM32 doesn't support callback\n"); wdt_config.callback = NULL; wdt_channel_id = wdt_install_timeout(wdt, &wdt_config); } else printk("IWDG driver for STM32 support callback\n");
wdt_callback(struct device *wdt_dev, int channel_id) { }