IMX WDT: Difference between revisions
No edit summary |
|||
Line 26: | Line 26: | ||
Within 128 seconds the board will reset. | Within 128 seconds the board will reset. | ||
= Compile watchdog test application = | = Compile a watchdog test application = | ||
There's a watchdog testing utility C code example in the kernel source tree: tools/testing/selftests/watchdog-test.c (in older kernels: Documentation/watchdog/src/watchdog-test.c). | There's a watchdog testing utility C code example in the kernel source tree: tools/testing/selftests/watchdog-test.c (in older kernels: Documentation/watchdog/src/watchdog-test.c). | ||
To cross compile it:<br> | |||
Install the toolchain and source the environment setup script, by following the {{Varlink2|Yocto Toolchain installation|{{#var:RELEASE_LINK}}}} guide, then run: | |||
$ $CC ./tools/testing/selftests/watchdog-test.c -o ./watchdog-test | $ $CC ./tools/testing/selftests/watchdog-test.c -o ./watchdog-test |
Revision as of 14:44, 4 May 2021
Kernel configuration
The internal watchdog is enabled by default in the kernel configuration.
To verify that the i.MX watchdog driver (CONFIG_IMX2_WDT) is enabled in your kernel configuration:
- In menuconfig: Device Drivers -> Watchdog Timer Support -> <*> IMX2+ Watchdog
Using a command line
Watchdog will be activated as soon as /dev/watchdog is opened and will reboot unless the watchdog is pinged within timeout (128 is the preconfigured value).
$ echo "1" > /dev/watchdog0
Within 128 seconds the board will reset.
Compile a watchdog test application
There's a watchdog testing utility C code example in the kernel source tree: tools/testing/selftests/watchdog-test.c (in older kernels: Documentation/watchdog/src/watchdog-test.c).
To cross compile it:
Install the toolchain and source the environment setup script, by following the Yocto Toolchain installation guide, then run:
$ $CC ./tools/testing/selftests/watchdog-test.c -o ./watchdog-test