I want to change the watchdog timeout time

Hi I am configuring a Jetson AGX Xavier industrial custom board and I am using l4T version 35.4.1

I searched the forums to change the watchdog timeout time and ended up configuring an app. I’ll share some of the code.

uint32_t SetWatchDogTimeout(int timeout) {
int fd = open(“/dev/watchdog”, O_RDWR);
if (fd == -1) {
perror(“Failed to open /dev/watchdog”);
return STATUS_ERROR;
}

if (ioctl(fd, WDIOC_SETTIMEOUT, &timeout) == -1) {
    perror("Failed to set watchdog timeout");
    close(fd);
    return STATUS_ERROR;
}

printf("Watchdog timeout set to %d seconds.\n", timeout);
close(fd);
return STATUS_SUCCESS;

}

In fact, when I tried to change the timeout through the app, I found that it rebooted after the set time, so I confirmed that the change was made.

However, if you start Watchdog again after changing the time, it goes back to 60 seconds.

root@jetson-agx-xavier-industrial:~# debug-app watchdog stop
Stopping watchdog daemon…Watchdog service stopped.
root@jetson-agx-xavier-industrial:~# debug-app watchdog settime 30
[ 694.411095] tegra_wdt_t18x 30c0000.watchdog: Watchdog(0): wdt timeout set to here 30 sec
Watchdog timeout set to 30 seconds.
[ 694.411535] watchdog: watchdog0: watchdog did not stop!
root@jetson-agx-xavier-industrial:~# debug-app watchdog start
Starting watchdog daemon…[ 700.423605] tegra_wdt_t18x 30c0000.watchdog: Watchdog(0): wdt timeout set to here 60 sec
done
Watchdog service started.

I think I’m using the tegra_wdt_t18x driver… I can’t find the part where I set the timeout when the watchdog starts.
Please help me change it dynamically.

Hi,
It looks like it will be set to default value and you would need to configure it after it is started. You may have a binary to set it in system startup(after watchdog is initialized).

Here is a sample code for reference:
Use of TX2 Watchdog peripheral - role of WDT_TIME_OUT input - #3 by ShaneCCC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.