Watchdog RevPi Connect

Your RevPi Connect is equipped with a hardware watchdog.

A watchdog is a timer that runs for 60 seconds after power up and then restarts the RevPi. Therefore, as long as your system is functioning properly, the watchdog must be restarted again and again. If an error occurs (e.g. if the application process crashes), this restart does not take place and the watchdog restarts the system.

Activate Watchdog

We supply you with a plug that is already prewired. The watchdog is deactivated by the jumper on terminals 0V and WD.

The watchdog is active without this cable and the watchdog timer must be restarted cyclically by your application software so that your system is not restarted. Until you have such software, it makes sense to deactivate the watchdog. Otherwise it might disturb you during your development work.

  • Remove the jumper cable from pin 0 to pin WD to activate the watchdog.

Monitor Connected Devices

A relay output makes it possible for devices connected to the X2 connector to be monitored by the watchdog.

You can switch the relay output bitwise in the process image (RevPiLED, bit 6). With this you can also set that the relay switches if the watchdog has reported an error, for example.

On your RevPi Connect you will find an example script.

You can find the file “watchdog.sh” in the directory “/etc/rc.local”.

You can execute the script by typing the following command in the command line:

/home/pi/connect/revpi-connect-watchdog.sh/>dev/null_&

This script is only an example and is not suitable for controlling watchdog or relays. However, you can use it as a template to create your own command in an application program (e.g. logiRTS).

This is how you use the watchdog to restart the relay:

  • Patch the FTDI-EEPROM:

devnum=$(cat /sys/bus/usb/devices/1-1.5.2/devnum)

sudo /home/pi/connect/patch_eeprom d:1/$devnum 0x14=0xaa 0x15=0x00

You no longer have to do this step if you have already used the watchdog to control the relay.

  • Restart RevPi Connect.

sudo reboot

  • Enter one of the following commands to turn the relay on or off when the watchdog responds:

Switch on:

sudo /home/pi/connect/enable_relay_watchdog.py

Switch off:

sudo /home/pi/connect/disable_relay_watchdog.py

You have to run the command again after each reboot.

If you have entered this command, it is possible that the interface “/dev/ttyRS485” will temporarily disappear.