This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM623: how to use watchdog on AM62

Part Number: AM623

Hello,

[Part Number]  : Custom board (AM6231)

[SDK]               : ti-processor-sdk-linux-am62xx-evm-09.01.00.08

[Build]              : Yocto

[Description]    : 

 I'm trying the watchdog function and have referenced the website.

1.  $ ls /dev/watchdog

root@am62xx-evm:~# ls /dev/watchdog
watchdog   watchdog0

2. gcc watchdog-simple.c -o watchdog-simple

// SPDX-License-Identifier: GPL-2.0
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>

int main(void)
{
	int fd = open("/dev/watchdog", O_WRONLY);
	int ret = 0;
	if (fd == -1) {
		perror("watchdog");
		exit(EXIT_FAILURE);
	}
	while (1) {
		ret = write(fd, "\0", 1);
		if (ret != 1) {
			ret = -1;
			break;
		}
		sleep(10);
	}
	close(fd);
	return ret;
}

3.  ./watchdog-simple

    The AM62 board will reboot in about 30 seconds.

By the way, when I use wdctl, the board also reboots like e2e.

"If I tried to see the status of the watchdog with wdctl, then a countdown DOES start. If I just enter wdctl once, then do nothing, the board will reset after 60 seconds. typing out wdctl again when the "timeleft" value is less than half of the Timeout value leads to the watchdog getting pet and the counter restarting. "