Enable and setup watchdog for Jetson Nano


We want to enable the watchdog of Jetson Nano. We did some adjustments in device tree to enable it.

watchdog@60005100 {
    status = "okay";
    nvidia,expiry-count = <1>;
    nvidia,heartbeat-init = <30>;

The output looks okay to me and we also see the /dev/watchdog and /dev/watchdog0 files:

$ dmesg | grep watchdog
[    1.085808] tegra-wdt 60005100.watchdog: Tegra WDT enabled on probe. Timeout = 30 seconds.
[    1.086176] tegra-wdt 60005100.watchdog: initialized (timeout = 30 sec, nowayout = 1)

And we can test it by issuing the following command.

echo 1 > /dev/watchdog && while true; do date; sleep 1; done

However the timeout is still (the default) 120 seconds. How can I change the watchdog timeout? Please notice that the outputs above already suggest that the timeout is set to 30 seconds as set in the device tree snippet. It seems that this is not applied correctly.

And additionally I wonder, when the watchdog is enabled. I have read some threads, which suggest that this is possible to enable it by cboot, but I am not sure about this. So the question is: Is the watchdog enabled in some bootloader code or is it enabled only in the kernel driver? (we want to enable the watchdog as early as possible to ensure that kernel and device tree are okay)


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


Hi ShaneCCC,

I think the watchdog-test.c basically does the same as I did when setting nvidia,heartbeat-init in device tree.

However I have looked into tegra_wdt_t21x.c (in tegra_wdt_init()) and found the issue regarding setting the timeout. It seems I misunderstood the meaning of nvidia,expiry-count = <1>. To make the driver work as expected I needed to set it to nvidia,expiry-count = <4>. (This is already the default value) The driver will then divide the nvidia,heartbeat-init by four to set the timeout of the timer, which then expires four times and then resets the device in case it is not serviced. Quite confusing to be honest but this works now.

But still the other question remains. Is it possible to enable the watchdog during boot and if so, how do I enable it? Is there some built-in support for u-boot or cboot or some other bootloader component?