Orin NX;hardware watchdog

Is the hardware watchdog integrated on the Orin NX module integrated inside the CPU or exists independently of the CPU on the module?

Both PMIC and Orin SoC on module have their own internal WDT.

What is the minimum timeout period for the hardware watchdog integrated on the Orin NX module? Millisecond level?

The minimum WDT period is 2ms.

How can I verify that the minimum timeout of the hardware watchdog integrated on the orin nx module is 2ms? Can I provide a test program? I can only set the guard dog’s feeding time to the level of seconds.

Please reference to this source for wdt configuration.

I executed this verification procedure you provided:

include <stdio.h>
include <fcntl.h>
include <stdlib.h>
include <string.h>
include <unistd.h>
include <errno.h>
include <string.h>
include <sys/ioctl.h>

include <linux/watchdog.h>

define DEV_NAME “/dev/watchdog”

int main(int argc, char **argv) {
int interval, margin;

if (argc >= 2) interval = atoi(argv[1]);
if (argc >= 3) margin = atoi(argv[2]);

printf("watchdogd started (interval %d, margin %d)!\n", interval, margin);

int fd = open(DEV_NAME, O_RDWR|O_CLOEXEC);
if (fd == -1) {
    fprintf(stderr, "watchdogd: Failed to open %s: %s\n", DEV_NAME, strerror(errno));
    return 1;
}

int timeout = interval + margin;
int ret = ioctl(fd, WDIOC_SETTIMEOUT, &timeout);
if (ret) {
    ret = ioctl(fd, WDIOC_GETTIMEOUT, &timeout);
    if (ret) {
        fprintf(stderr, "watchdogd: Failed to get timeout: %s\n", strerror(errno));
    } else {
        if (timeout > margin) {
            interval = timeout - margin;
        } else {
            interval = 1;
        }
        fprintf(stderr, "watchdogd: Adjusted interval to timeout returned by driver: timeout %d, interval %d, margin %d\n",
              timeout, interval, margin);
    }
} else {
            printf ("watchdogd: set timeout success\n");
}

    return 0;

}

The printed information is:
watchdogd started (interval -1489891884, margin 65535)!
watchdogd: Adjusted interval to timeout returned by driver: timeout 120, interval 1, margin 65535

The orin nx module restarts in the 120S.

I made changes to the program:

include <stdio.h>
include <fcntl.h>
include <stdlib.h>
include <string.h>
include <unistd.h>
include <errno.h>
include <sys/ioctl.h>
include <linux/watchdog.h>

define DEV_NAME “/dev/watchdog”

int main(int argc, char **argv) {
int interval = 10;
int margin = 5;

if (argc >= 2) {
    interval = atoi(argv[1]);
    if (interval <= 0) {
        fprintf(stderr, "Invalid interval value. It must be a positive integer.\n");
        return 1;
    }
}
if (argc >= 3) {
    margin = atoi(argv[2]);
    if (margin < 0) {
        fprintf(stderr, "Invalid margin value. It must be a non-negative integer.\n");
        return 1;
    }
}

printf("watchdogd started (interval %d, margin %d)!\n", interval, margin);

int fd = open(DEV_NAME, O_RDWR | O_CLOEXEC);
if (fd == -1) {
    fprintf(stderr, "watchdogd: Failed to open %s: %s\n", DEV_NAME, strerror(errno));
    return 1;
}

int timeout = interval + margin;
int ret = ioctl(fd, WDIOC_SETTIMEOUT, &timeout);
if (ret) {
    ret = ioctl(fd, WDIOC_GETTIMEOUT, &timeout);
    if (ret) {
        fprintf(stderr, "watchdogd: Failed to get timeout: %s\n", strerror(errno));
    } else {
        if (timeout > margin) {
            interval = timeout - margin;
        } else {
            interval = 1;
        }
        fprintf(stderr, "watchdogd: Adjusted interval to timeout returned by driver: timeout %d, interval %d, margin %d\n",
              timeout, interval, margin);
    }
} else {
    printf("watchdogd: set timeout success\n");
}

close(fd);
return 0;

}

The printed information is:
watchdogd started (interval 10, margin 5)!
watchdogd: set timeout success

The system restarts in 16s.

In addition, in the tegra_wdt.c file, I see that the minimum and maximum timeout times of the watchdog timer are set to 1 second and 255 seconds respectively.
define MIN_WDT_TIMEOUT 1
define MAX_WDT_TIMEOUT 255

Run the sudo wdctl command, and the printed information also shows that the watchdog timeout period is in seconds.
nvidia@ubuntu:~$ sudo wdctl
[sudo] password for nvidia:
Device: /dev/watchdog
Identity: Tegra WDT [version 1]
Timeout: 120 seconds
Pre-timeout: 0 seconds
FLAG DESCRIPTION STATUS BOOT-STATUS
KEEPALIVEPING Keep alive ping reply 0 0
MAGICCLOSE Supports magic close char 0 0
SETTIMEOUT Set timeout (in seconds) 0 0

How is the minimum watchdog time of 2ms achieved?