Watchdog clear DIO | LabJack
 

Watchdog clear DIO

7 posts / 0 new
Last post
yannick
yannickbaehler's picture
Watchdog clear DIO

Hello,

I'm currently testing the watchdog and i want to set DOs to low and inibit it in case the communication is lost (security relay)

This could be easily achieved, however, what i couldn't do is to go back to the initial state once the communication is reestablished and let the LUA script write the DO again, without rebooting the device.

Any solutions ?

Best regards,

Yannick

LabJack Support
labjack support's picture
Sounds like you have the

Sounds like you have the watchdog configured to set some DIO to output-low after the timeout period.

Make sure your timeout is long enough that you are able to regain communication without the watchdog repeatedly timing out.

Try doing all testing with Kipling without other software running or any Lua script running (disable script).

The most common way to use the watchdog is to configure the reboot condition of your DIO to output-low and then set the watchdog to simply reboot on timeout.  The way you are using the watchdog is fine also, but for troubleshooting it is tougher to tell when the watchdog is timing out if the device is not rebooting every time.

 

yannick
yannickbaehler's picture
For know I could inhibit and

For know I could inhibit and set the output low without problem, but I couldn't find anything in the documentation about the watchdog behavior when the communication is reestablished.

In my case the DIOs react as i want went the communication is out but don't go back to the initial state. (So the LUA script can control the DIOs again)

Should the DIO register go back to the state it was before automatically ? If not (which seems to be the case), how can I detect the watchdog is ok again from the LUA script in order to remove the Inhibit ?

LabJack Support
labjack support's picture
Each time the watchdog times

Each time the watchdog times out, it does the actions you have specified.  Say you have configured the watchdog with a 10 second timout and specified that DIO0 be set to output-low upon timeout.  That means that at any time, if the T7 does not get any incoming communication for 10 seconds, a single command is executed to set DIO0 to output low.  At that point the watchdog is re-armed and if the T7 does not get any incoming communication for 10 seconds, a single command is executed to set DIO0 to output low.  And so on.

 

yannick
yannickbaehler's picture
OK, thank you for your answer

OK, thank you for your answer.

I still have one last question : Is there any way to know if the watchdog went off from the lua script ?

For exemple in my case, I inhibit the DOs when the watchdog goes off so the program can not set an output to High. I want to check from the script if the watchdog went off and then if it has been properly reset so I can remove the inhibit and continue normally.

LabJack Support
labjack support's picture
Is there any way to know if

Is there any way to know if the watchdog went off from the lua script?

I can't think of a read of the watchdog itself, but seems like you can detect something the watchdog does when it times out.  For example, have some DIO that you know is set to output-low by default, and never written to by anything but the watchdog which sets it output-high, and then your script can watch for the DIO to change to output-high.

First though, we need to clarify the following:

For example in my case, I inhibit the DOs when the watchdog goes off

I don't understand what you are saying.  Are you talking about these registers?

WATCHDOG_DIO_ENABLE_DEFAULT
WATCHDOG_DIO_STATE_DEFAULT
WATCHDOG_DIO_DIRECTION_DEFAULT
WATCHDOG_DIO_INHIBIT_DEFAULT

That last INHIBIT register is just a mask that controls which DIO the STATE & DIRECTION writes act upon and don't act upon.  It just affects the state & direction writes that happen 1 time when the watchdog times out.  After that there is no inhibiting going on.

 

yannick
yannickbaehler's picture
Thank you for your answer.

Thank you for your answer.

your script can watch for the DIO to change to output-high

I will probably do it like that.

I don't understand what you are saying.  Are you talking about these registers?

yes I am

It just affects the state & direction writes that happen 1 time when the watchdog times out.

Mmm yes I relized that in fact it didn't really worked as expected, so this is why.

Thank you very much