Enabling Watchdog Based on RTC Alarm

The device has a built-in hardware watchdog and supports a software watchdog function based on the RTC alarm. The following describes how to enable this watchdog function by installing the DKMS package and updating initramfs.

Enabling Watchdog

Preparation:

The device is properly started and connected to the network.

Steps:

  1. In the command pane, run the following commands in sequence to add the edatec APT source.
curl -sS https://apt.edatec.cn/pubkey.gpg | sudo apt-key add -
echo "deb https://apt.edatec.cn/raspbian stable main" | sudo tee /etc/apt/sources.list.d/edatec.list
sudo apt update
image-20250320151035016
  1. Run the following command to install the tool packages.
sudo apt install debhelper dh-dkms dkms fakeroot
  1. Run the following command to install the ed-rtc-watchdog software package.
sudo apt install ./ed-rtc-watchdog_1.0.0_all.deb
  1. Run the following command to verify whether the software package is installed successfully.
dpkg -l | grep ed-

The following figure indicates a successful installation.

  1. Run the following command to update initramfs.
sudo update-initramfs -u
  1. Run the following command to restart the device.
sudo reboot

Modifying the Watchdog Counter Reset Time

The default watchdog counter reset time is set to 2 minutes. You can modify it as needed.

  1. Run the following command to open the rtc_alarm.conf configuration file. The value after the parameter alarm_timeout= indicates the current watchdog counter reset time, in minutes.
sudo nano /etc/rtc_alarm.conf
image-20250320152614284
  1. Modify the value after the parameter alarm_timeout= as needed.

  2. Press ctrl+o to save the configuration file, then press Enter, and finally press ctrl+x to exit the configuration file.

  3. Run the following command to restart the ed-rtc-alarm.service service for the configuration to take effect.

sudo systemctl restart ed-rtc-alarm.service

TIP

After enabling the watchdog, if you need to switch the kernel version, make sure to install the corresponding kernel header files at the same time to ensure that related drivers and modules can be properly compiled and loaded. It is recommended to use the following command format for installation:

sudo apt install linux-image-<kernel version> linux-headers-<kernel version>

Example command (taking switching to kernel version 6.12.47 as an example):

sudo apt install linux-image-6.12.47+rpt-rpi-v8 linux-headers-6.12.47+rpt-rpi-v8