Difference between revisions of "Example watchdog"
(→Usage and Behavior) |
(→Usage and Behavior) |
||
| Line 12: | Line 12: | ||
==Usage and Behavior== | ==Usage and Behavior== | ||
| − | + | The <code>watchdog-test</code> application can enable, disable, activate, configure and interrupt the watchdog hardware circuit. | |
| − | + | ||
| + | |||
| + | {{imbox| type = content| image = [[Image:Emblem-question-yellow.svg|40px]]| style = width: 400px;| textstyle = color: red; font-weight: bold; font-style: italic;| text = Activating watchdog causes a system reset.}} | ||
| + | |||
| + | |||
| + | |||
<code>watchdog</code> | <code>watchdog</code> | ||
| Line 54: | Line 59: | ||
===Usage Example. Enabling <code>watchdog</code>=== | ===Usage Example. Enabling <code>watchdog</code>=== | ||
| − | This will activate <code>watchdog</code> but it won't perform a periodic timeout interrupt (see the first usage example). So when you run it the program activates <code>watchdog</code> and then <code>watchdog</code> resets the system. | + | This will enable and activate <code>watchdog</code> but it won't perform a periodic timeout interrupt (see the first usage example). So when you run it the program activates <code>watchdog</code> and then <code>watchdog</code> resets the system. |
<syntaxhighlight lang="text"> | <syntaxhighlight lang="text"> | ||
Revision as of 11:07, 3 January 2014
This is a guide to the watchdog C example project included in the EMAC OE SDK.
A Watchdog Timer (WDT) is a hardware circuit that can reset the computer system in case of a software fault. This is an example test for the Linux watchdog API.
The watchdog project builds one executable: watchdog-test.
Opening, Building and Uploading the Project Files
stubbooo
Usage and Behavior
The watchdog-test application can enable, disable, activate, configure and interrupt the watchdog hardware circuit.
|
|
Activating watchdog causes a system reset. |
watchdog
Hardware Requirements
fof ofoo
watchdog Usage
./watchdog-test [-det]
- d Disable the watchdog card.
- -e" to enable the watchdog card
- -s set the watchdog timeout
Usage Example. Activating watchdog with a periodic interrupt
This will activate watchdog and initiate a periodic interrupt to keep it from timing out.
root@som9g20:/tmp# ./watchdog-test
Watchdog Ticking Away!
We have activated watchdog and now it is counting down to computer reset - or rather it would be if we didn't keep resetting it's timer. That's the LED on the SoM blinking at about 1 Hz. Every second watchdog-test is sending an IOCTL to the watchdog driver, which in turn ticks watchdog to reset its internal timer so it doesn't timeout and trigger a system reset.
Now we will stop interrupting watchdog and let it trigger a computer reset. Hit CTRL-C.
...and the system resets.
Usage Example. Disabling watchdog
root@som9g20:/tmp# ./watchdog-test -d
Watchdog card disabled.
...and the program exits normally.
Usage Example. Enabling watchdog
This will enable and activate watchdog but it won't perform a periodic timeout interrupt (see the first usage example). So when you run it the program activates watchdog and then watchdog resets the system.
root@som9g20:/tmp# ./watchdog-test -e
Watchdog card enabled.
...and the system resets.
Usage Example. Setting watchdog timeout
This will activate watchdog and set it to timeout in 5 seconds.
root@som9g20:/tmp# ./watchdog-test -t
Watchdog timeout set to 5 seconds!
...the program exits normally, then 5 seconds elapse, and then the system resets.
Summary
The watchdog C example project demonstrates how to use the Watchdog Timer. We provide examples of how to enable, disable, activate, configure and interrupt the watchdog hardware circuit.