03-16-2012 10:34 AM
Is there a way to check if the last reboot of a sbRIO has been triggered by the watchdog ?
Thanks in advance,
regards,
Marco
03-16-2012 01:45 PM
When I handle the watchdog reboot on cRIO and FieldPoint, I write out a file with the contents of my data queue, so I can repopulate the queue on reboot; then delete the file. If the file exists on reboot, then reboot was caused by the watchdog, otherwise reboot was not caused by the watchdog. Same approach should work with just a marker file. Of course you have to handle the reboot occurrance yourself, and not let it trigger the restart.
Matt
03-21-2012 10:06 AM
Thanks for replying Matt.
The problem is that I use the watchdog to trigger a reboot in case the software hangs (as a last remedy...).
I would prefer to avoid software handling of the occurrence...
Regards,
Marco
03-21-2012 05:10 PM
Hmm. Is there an unused I/O pin pair where you can set the state of the output pin and have the state be different between a watchdog reboot and power up? Something like force to 0 on power up, set it to 1 once your code is running. If the watchdog restart doesn't force to 0, just read the pin to know what your previous state was. You could accomplish the same thing with just an external OR gate. Wire one input to an output pin of the sbRIO, wire the other input pin to the OR output. As long as the OR has power and has been set, it will read 1 after a watchdog reset and 0 for a power up restart. You will have to watch your startup transients, but this approach should do what you want.
Matt
03-25-2012 09:38 AM
If I remember correctly, shared variables on VxWorks will maintain their state after a reboot. (that is if I remember correctly)
As such, you could use a shared variable in conjunction with your watchdog. Every time you reset the watchdog, you could also reset an incrementing shared variable or something similar. Alternatively, in the case of a safe shutdown you could set the variable to a known state. Then check the variable when you come back up and you should be able to tell what your last state was.
Not sure how well this will work for a hardware reboot, but it can at least rule out a controlled reboot.
03-28-2012 05:30 AM
thank you Chris.
We would like to avoid the use of shared variables.
At the moment we are trying an approach based on FPGA code saved on the Flash memory ab the sbRIO.
Regards,
Marco