AM62 hardware watchdog

Hi there,

We’re currently trying to make use of the AM62’s hardware watchdog but are having problems getting it to work properly. Our hardware and software setup looks like this:

  • Verdin AM62 Quad/2GB in a Yavia 1.0A development board
  • Custom Yocto image built on top of the Toradex 6.5.0 BSP (though also tried the 6.5.0 minimal reference image which showed the same behaviour)

And the output from tdx-info:

Software summary
------------------------------------------------------------
Bootloader:               U-Boot
Kernel version:           6.1.46-6.5.0+git.8e6a2ddd4fe6 #1 SMP PREEMPT Thu Dec 21 17:08:38 UTC 2023
Kernel command line:      root=PARTUUID=ea3c08a9-02 ro rootwait console=tty1 console=ttyS2,115200 consoleblank=0 earlycon=ns16550a,mmio32,0x02800000
Distro name:              NAME="TDX Wayland with XWayland"
Distro version:           VERSION_ID=6.5.0-build.9
Distro variant:           -
Hostname:                 verdin-am62-15190383
------------------------------------------------------------
Hardware info
------------------------------------------------------------
HW model:                 Toradex Verdin AM62 WB on Verdin Development Board
Toradex version:          0076 V1.1A
Serial number:            15190383
Processor arch:           aarch64

To use the watchdog, I uncommented the RuntimeWatchdogSec option in the systemd configuration file which as far as I can tell is all that should be required. Once booted with this option enabled, I can see journal messages confirming the watchdog has been started, but unfortunately the system resets after approximately half of the timeout interval has passed (so 30 seconds with the default minute timeout the RTI watchdog uses). This seems to be supported by the fact that if I configure the watchdog timeout to say 2 minutes (adding rti-wdt.heartbeat=120 to the kernel command line) it resets after around a minute.

My only thought currently is that the kernel driver is incorrectly sending pings too early (ie. in the first 50% of the timeout interval), which according to the AM62 reference manual could have the same effect as being too late, but I haven’t had any luck trying to confirm that so I’m hoping someone might be able to shed some light either on what the problem is or what I’m doing wrong!

Any help/recommendations would be much appreciated.

Many thanks,
Chris

Hello @cshipman,

Welcome to the Toradex Community!

The AM62 SoC has a Windowed Watchdog, which generates a reset signal or an interrupt if there is any attempt to service the watchdog outside the configured window.
As stated in the AM62 Reference Manual, Section 12.7.2.3.1 - RTI Digital Windowed Watchdog:

The DWWD opens a configurable time window in which the watchdog must be serviced. Any attempt to service the watchdog outside this time window , or a failure to service the watchdog in this time window, will cause the watchdog to generate either a reset or a non-maskable interrupt to the CPU.

Systemd’s watchdog implementation always tries to service the watchdog at least once before 50% of the watchdog heartbeat time, as stated in the RuntimeWatchdogSec option on Systemd’s system.conf documentation.
This behavior coupled with the windowed nature of the AM62 watchdog is likely what is causing the reset after around 50% of the rti-wdt.heartbeat time.

Looking at the rti-wdt driver, the watchdog appears to only support windows of at most 50% of the heartbeat time.

I also observe the same reset behavior with the watchdog enabled.
We will look for possible workarounds to this issue, but it may be needed to service the watchdog using something other than Systemd.

Best Regards,
Bruno

Hello @cshipman,

Looking further into the situation, SystemD is hard-coded to:

  • Never ping the watchdog before 25% of the heartbeat time
  • Try to ping the watchdog before 50% of the heartbeat time

The implementation is on the watchdog_ping function.

As the SystemD behavior is incompatible with the AM62 watchdog implementation, there are two alternatives to use the watchdog with the AM62:

  • Patch SystemD to work with the AM62 watchdog
  • Ping/Service the watchdog with another application

Best Regards,
Bruno