Page 1 of 1
Watchdog for digital outputs
Posted: 11 Jul 2018, 13:15
by bftrock
Hello,
According to the RevPi documentation, the DIO module uses a watchdog which turns off the digital outputs after a short timeout after the last update from the CPU. To test this, I wrote this simple Python 3 program which toggles a digital output on and off, then leaves it on when the program exits. I expected the hardware to turn the digital output off after the watchdog timeout, but that did not happen. Any idea what is going on here?
Thanks,
Brendan
Code: Select all
import revpimodio2
from time import sleep
rpi = revpimodio2.RevPiModIO(autorefresh=False)
for i in range(1, 6):
x = i % 2
print("x = {}".format(x))
rpi.io.do1.value = x
rpi.writeprocimg()
sleep(1)
print("Exiting")
Re: Watchdog for digital outputs
Posted: 11 Jul 2018, 14:11
by volker
PiControl is going on here
The watchdog you are talking about is monitoring the piBridge data transfer. To emulate a break down of the data transfer simply unplug the piBridge connector. As a result the outputs should go to OFF state.
Would that make any sense to toggle a digital output to assure that the system is alive and then switch it to zero if it is not toggled? It could not be used for controlling actuators any more, right?
b.t.w. there are 2 watchdogs built in the DIO/Di/DO: one is a software WD monitoring the PiBridge data exchange. The other is a hardware SPI watchdog monitoring SPI traffic between the DIO CPU and the digital output IC. If the hardware fails to detect SPi traffic it does reset the output IC to all 0 outputs.
If you are looking for a system watchdog (not a piBridge watchdog) you will find a nice hardware watchdog in our new RevPi Connect. The Connect does have a certain bit in the process image which your application needs to toggle every 30 seconds to reset the WD. if your application fails to do so the HW watchdog will trigger after 60 seconds and then switches off the internal power supply for 3 seconds in order to cause a complete cold start of the system.
Re: Watchdog for digital outputs
Posted: 11 Jul 2018, 14:42
by bftrock
Thanks for your prompt reply. I am looking for a system watchdog that will turn off the digital outputs if my app crashes. It looks like the RevPi Connect is a new CPU option, right? I didn't see it in the Shop section of the web site, so I'm guessing it's still under development? I did find a Quick Start for it on the web site though. We could use that built-in RS485 port too. Can I purchase one of these now? If not, when do you expect them to be available?
Thanks,
Brendan
Re: Watchdog for digital outputs
Posted: 11 Jul 2018, 15:00
by volker
They are in production and will be available before end of July.
If you are using a soft PLC like logi.RTS this has a built in WD for the control application. if logi.RTS is no longer communicating cyclically with the process image then piControl is writing the 0 values to the outputs. The not yet released version of Stretch image will give you ioctl calls to use this functionality. Actually you could use the special ioctl call which is used by 3rd party software like logi.RTS to bulk exchange your data with the process image and thus get the WD functionality too. This function call is not well documented for the public so if you need it just send me a PM and I'll try to do my very best to give you the information you need.
Re: Watchdog for digital outputs
Posted: 29 Jul 2018, 11:25
by RevPiModIO
Hi bftrock!
If you are using a Python Program on the Revolution Pi to control the IOs (With revpimodio for example) you can use RevPiPyLoad.
RevPiPyLoad will execute your Python program an can set all IOs to ZERO, if the program crashes. It can reload your Program an you can monitor the output of the Program over the Network with RevPiPyControl...
https://revpimodio.org/en/revpipyplc-2/
BUT this is not a Watchdog. RevPiPyLoad can not check whether your program hang and does not response... Till now... Maybe it is an interesting new feature
Regards Sven
Re: Watchdog for digital outputs
Posted: 29 Jul 2018, 16:43
by volker
It is just as Sven said: This is not an application WD. The Application WD is built in piControl which can monitor a PLC software like logi.cals. It does measure the last cycle time and if this last cycle time has run out without another write access to piControl it sets the outputs of DIo or DO to save values. This does not work with usual piControl data access but only with the undocumented ioctl call for PLC software.