Watchdog (/dev/watchdog0)not getting disabled - jetson nano

Need to exit from application gracefully after kicking watchdog last time…(application on jetson nano - Package: nvidia-jetpack Version: 4.5.1-b17)

Application opened up the watchdog as below…
open("/dev/watchdog0", O_RDWR);

to keep watchdog alive, application calls at regular interval (interval < timeout for wdg set previously)

Want to exit from application gracefully - e.g. disabling reboot of system through watchdog with below code…
int options = WDIOS_DISABLECARD;
ret = ioctl(fd, WDIOC_SETOPTIONS, &options);

Above call of disabling wdg returns value -1 and seems the watchdog is not getting disabled by this call, which later causes the system to reboot with watchdog timer. (visible in /var/log/syslog as last reboot happened due to PMIC watchdog reset)

Is there a way using which I can disable the watchdog before exiting from application and prevent system reboot by watchdog? Any steps I am following wrong here ?

Any guidance would be of great help!

Have a reference to below code to change the timeout time.

Thanks Shane for reply and useful example !

I found below messages in my /var/log/syslog - which clearly indicates why I am not able to disable watchdog…the same is the case with above example and the program which I was experimenting with.

19900 Mar 29 11:04:03 XXXX-desktop kernel: [59549.391547] watchdog: watchdog0: nowayout prevents watchdog being stopped!
19901 Mar 29 11:04:03 XXXX-desktop kernel: [59549.391551] watchdog: watchdog0: watchdog did not stop!

20533 Mar 29 11:06:29 XXXX-desktop kernel: [    1.445512] last reset is due to pmic watchdog timeout

This indicates that the kernel (coming with nvidia-jetpack 4.5.1) mostly has been compiled with CONFIG_WATCHDOG_NOWAYOUT - flag enabled or set to value 1.

Is there a way I can disable this flag to false without recompiling the kernel ? Probably this may help me in disabling watchdog.

Thanks for your reply in advance!

Watchdog won’t trigger reboot if system alive in default system configure.
There is no way to disable it without kernel reconfigure and compile.

Thanks Shane for quick reply!

The first statement last part was not clear - request to clarify it further… e.g. “system alive in default system configure”. What I understand from last statement is: we have only option to reconfigure/re compile the kernel to disable this flag(CONFIG_WATCHDOG_NOWAYOUT) - that is the only way out (for preventing system reboot by watchdog)- hope I am clear on my understanding…

If system keep alive(CPU alive) watchdog won’t reboot the system no need to reconfigure the kernel.

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