Watchdog for digital outputs

Moderator: RevPiModIO

Post Reply
User avatar
bftrock
Posts: 11
Joined: 11 May 2018, 13:16
Answers: 0
Location: Burlington, Vermont, USA

Watchdog for digital outputs

Post 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")
User avatar
volker
Posts: 1046
Joined: 09 Nov 2016, 15:41
Answers: 1

Re: Watchdog for digital outputs

Post 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.
Unser RevPi Motto: Don't just claim it - make it!
User avatar
bftrock
Posts: 11
Joined: 11 May 2018, 13:16
Answers: 0
Location: Burlington, Vermont, USA

Re: Watchdog for digital outputs

Post 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
User avatar
volker
Posts: 1046
Joined: 09 Nov 2016, 15:41
Answers: 1

Re: Watchdog for digital outputs

Post 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.
Unser RevPi Motto: Don't just claim it - make it!
User avatar
RevPiModIO
KUNBUS
Posts: 322
Joined: 20 Jan 2017, 08:44
Answers: 0
Contact:

Re: Watchdog for digital outputs

Post 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 :D

Regards Sven
python3-RevPiModIO - https://revpimodio.org/ || Der RevPi ist das Beste, was passieren konnte!
User avatar
volker
Posts: 1046
Joined: 09 Nov 2016, 15:41
Answers: 1

Re: Watchdog for digital outputs

Post 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.
Unser RevPi Motto: Don't just claim it - make it!
Post Reply