Closed jiuzhuaxiong closed 4 years ago
but you can call reboot , reboot the device .
Hi,
Please make sure power on setting enables WDT (PA.3), otherwise WDT cannot reboot the system.
Sincerely,
Yi-An Chen
YES
Now I get the PA.3 to NC state , and get the watchdog=on, it works , but only enable it 2s timeout , how can i get this timeout value to 8.03 maximum value ?
Set a timeout value equal to or larger than 8 sec with ioctl() command.
if(timeout < 2) {
val |= 0x5 << 8;
} else if (timeout < 8) {
val |= 0x6 << 8;
} else {
val |= 0x7 << 8;
}
when no feed watchdog , the system will hang, and does not reboot
include
include
include
include
include
include <sys/ioctl.h>
include <linux/types.h>
include <linux/watchdog.h>
include
int fd;
void catch_int(int signum) { signal(SIGINT, catch_int);
}
int main(int argc,char* argv[]) { int ii; int timeout, timeout_bk; //signal(SIGINT, catch_int); fd = open("/dev/watchdog", O_RDWR); if (fd == -1) { perror("watchdog"); exit(EXIT_FAILURE); }
}