BCM SoC hardware watchdog and systemd RuntimeWatchdog: arm state across warm reboot vs power cycle
0 reputation · 14 Jan 2022, 18:44 UTC
0 reputation · 14 Jan 2022, 18:44 UTC
Goal is to use the Broadcom SoC hardware watchdog exposed by the bcm2835-wdt driver via /dev/watchdog together with systemd RuntimeWatchdogSec for unattended Raspberry Pi operation.
The integration requires the kernel driver to be present, userspace to keep the watchdog alive, and a clear definition of when the watchdog is armed or disarmed across boot transitions. Behavior differs between generations, and the nowayout parameter changes whether a clean close is possible. RuntimeWatchdogSec and ShutdownWatchdogSec are separate settings.
Documentation is inconsistent about whether the watchdog remains armed across a warm reboot versus a full power cycle, and how firmware or bootloader state influences that persistence across Pi generations.
Does the watchdog remain armed after a warm reboot on BCM2711/2712 and Pi 5 RP1 watchdog platforms? Under what conditions does firmware or bootloader clear the SoC counter? How should RuntimeWatchdogSec be chosen to avoid clamping or boot loops given generation-specific hardware limits?
32775 reputation · 15 Jan 2022, 01:25 UTC
On current Raspberry Pi 4 (BCM2711) and Pi 5 (BCM2712/RP1) with bootloader firmware dated 2023-07-10 or later: the hardware watchdog does not remain armed across a warm reboot. The bootloader explicitly disarms the SoC watchdog early in the boot sequence before handing control to the kernel. A full power cycle also leaves the watchdog disarmed (reset).
This behavior is a consequence of the default EEPROM setting POWER_OFF_ON_HALT=1, which causes even a systemctl reboot to cycle the PMIC power rails — effectively making a warm reboot indistinguishable from a power cycle for watchdog state purposes.
bcm2835-wdt driver at /dev/watchdog0.bcm2835_wdt.heartbeat= (range ~1–16 s, default 10 s).bcm2835-wdt compatible) and RP1 southbridge watchdog (rp1-wdt)./dev/watchdog (typically the SoC watchdog). Verify with ls -la /dev/watchdog* and dmesg | grep -E '(bcm2835|rp1).*wdt'.Raspberry Pi kernels ship with nowayout=Y (check /sys/module/bcm2835_wdt/parameters/nowayout). This means:
/dev/watchdog, it cannot disarm the watchdog by closing the file descriptor.Set the hardware heartbeat first via kernel command line (e.g., bcm2835_wdt.heartbeat=10 in /boot/firmware/cmdline.txt), then choose systemd values:
7 (for 10 s hardware timeout).30.If RuntimeWatchdogSec >= hardware timeout, systemd's ping interval may be clamped or missed, causing spurious resets.
dmesg -T | grep -i watchdog — confirm driver load, reported timeout, and nowayout status.cat /sys/class/watchdog/watchdog0/timeout — shows current kernel timeout in seconds.rpi-eeprom-config (Pi 4/5) or vcgencmd bootloader_version (Pi 4) — verify bootloader ≥ 2023-07-10.RuntimeWatchdogSec=7 in /etc/systemd/system.conf, run systemctl reboot, then check journalctl -b -1 | grep -i watchdog for any spurious reset messages during the previous boot.What is the output of rpi-eeprom-config (or vcgencmd bootloader_version on Pi 4) on your device? If the bootloader is older than 2023-07-10, the watchdog may remain armed across warm reboot, changing the recommended RuntimeWatchdogSec margin.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.