Difference between revisions of "Example watchdog"
(→watchdog Usage) |
(→Usage Example) |
||
Line 26: | Line 26: | ||
* -s set the watchdog timeout | * -s set the watchdog timeout | ||
− | ===Usage Example=== | + | ===Usage Example. Letting watchdog reset the system=== |
<syntaxhighlight lang="text"> | <syntaxhighlight lang="text"> | ||
Line 33: | Line 33: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | We have activated the watchdog and it's 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 <code> watchdog-test</code> is sending an IOCTL to the watchdog driver, which in turn ticks the watchdog to reset its internal timer so it doesn't | + | We have activated the watchdog and it's 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 <code> watchdog-test</code> is sending an IOCTL to the watchdog driver, which in turn ticks the watchdog to reset its internal timer so it doesn't timeout and trigger a system reset. |
Now we will stop interrupting the watchdog and let it trigger a computer reset. Hit CTRL-C. | Now we will stop interrupting the watchdog and let it trigger a computer reset. Hit CTRL-C. | ||
+ | |||
+ | ...and the system resets. | ||
+ | |||
+ | ===Usage Example. Disabling the watchdog=== | ||
+ | |||
+ | <syntaxhighlight lang="text"> | ||
+ | root@som9g20:/tmp# ./watchdog-test -d | ||
+ | Watchdog card disabled. | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | ===Usage Example. Enabling the watchdog=== | ||
+ | |||
+ | This will activate the watchdog but it won't perform a periodic timeout interrupt (see the first usage example). So when you run this the program will activate watchdog and then watchdog will reset the system. | ||
+ | |||
+ | <syntaxhighlight lang="text"> | ||
+ | root@som9g20:/tmp# ./watchdog-test -e | ||
+ | Watchdog card enabled. | ||
+ | </syntaxhighlight> | ||
...and the system resets. | ...and the system resets. |
Revision as of 10:33, 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
.
Contents
Opening, Building and Uploading the Project Files
stubbooo
Usage and Behavior
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. Letting watchdog reset the system
root@som9g20:/tmp# ./watchdog-test
Watchdog Ticking Away!
We have activated the watchdog and it's 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 the watchdog to reset its internal timer so it doesn't timeout and trigger a system reset.
Now we will stop interrupting the watchdog and let it trigger a computer reset. Hit CTRL-C.
...and the system resets.
Usage Example. Disabling the watchdog
root@som9g20:/tmp# ./watchdog-test -d
Watchdog card disabled.
Usage Example. Enabling the watchdog
This will activate the watchdog but it won't perform a periodic timeout interrupt (see the first usage example). So when you run this the program will activate watchdog and then watchdog will reset the system.
root@som9g20:/tmp# ./watchdog-test -e
Watchdog card enabled.
...and the system resets.