I would like to use a hard watchdog with TX2 in an application where an external device could refresh such a watchdog timer. I’ve see that there are some linux drivers but I can’t find a clear descriptino of how to use the WDT_TIME_OUT hardware input.
The WDT0 device node is /dev/watchdog0. The following user-space sample code shows opening, enabling, obtaining and specifiying the timeout value, and kicking the watchdog timer.
int fd, ret;
int timeout = 0;
/* open WDT0 device (WDT0 enables itself automatically) */
fd = open("/dev/watchdog0", O_RDWR);
if(fd < 0) {
fprintf(stderr, "Open watchdog device failed!\n");
return -1;
}
/* WDT0 is counting now,check the default timeout value */
ret = ioctl(fd, WDIOC_GETTIMEOUT, &timeout);
if(ret) {
fprintf(stderr, "Get watchdog timeout value failed!\n");
return -1;
}
fprintf(stdout, "Watchdog timeout value: %d\n", timeout);
/* set new timeout value 60s */
/* Note the value should be within [5, 1000] */
timeout = 60;
ret = ioctl(fd, WDIOC_SETTIMEOUT, &timeout);
if(ret) {
fprintf(stderr, "Set watchdog timeout value failed!\n");
return -1;
}
fprintf(stdout, "New watchdog timeout value: %d\n", timeout);
/*Kick WDT0, this should be running periodically */
ret = ioctl(fd, WDIOC_KEEPALIVE, NULL);
if(ret) {
fprintf(stderr, "Kick watchdog failed!\n");
return -1;
}
My purpose depends on the exact role of this pin of the TX2:
Is it an output indicating that the TX2 resets because of a watchdog timeout?
Is it an output indicating a watchdog refresh by user space?
Is it an input that can simulate a watchdog refresh?
Anything else?
My TX2 must be integrated on a carrier board were another component (PLD) is monitoring the complete system and provide watchdog funtionnality. I need to know how to integrate both.
Is it an output indicating that the TX2 resets because of a watchdog timeout? Yes
At the moment there is no software configuration that can enable generation of WDT_RESET_OUT signal.
But the register PMC_IMPL_RST_REQ_CONFIG_0(0xc360114) can be written from BPMP.
Set the value using command
echo “mw 0xc360114 1” > /sys/kernel/debug/bpmp/debug/cons
Pinmux should be updated to configure WDT_RESET_OUT pin (SOC_GPIO23) as WDT_RESET_OUTA using the customer_pinmux.xlsm
WDT reset after this will pull the WDT_RESET_OUT signal low. But the system will reboot only when SYS_RESET_N is toggled.
So the external PLD will have to capture WDT_RESET_OUT signal going low and then drive SYS_RESET_N to reboot the system.
I have a customised tx2 board which does not have the /dev/wathdog0 node. Is any other way to know if watchdog circuit is active or not. So that we can configure and test with the script mentioned.
Hi @siddharth2,
considering that you have a custom design is very hard to guess why you don’t have the /dev/wathdog0.
Did you customize the kernel?
Do you have a schematic excerpt of WD section?
hi:
I encountered the following problems using the above code 。
The new watchdog timeout value can only be set to 25. I want to set a smaller value. What should I do?