Personal tools

Log in

Changes

From IGEP - ISEE Wiki

Jump to: navigation, search

Watchdog timers on AM335x boards

3,461 bytes added, 15:01, 26 June 2015
Created page with '== Watchdog timers on AM335x boards == {{Message/Work in progress}} === Overview of this article === This article is meant to be a starting point for people to learn setup the…'
== Watchdog timers on AM335x boards ==

{{Message/Work in progress}}

=== Overview of this article ===

This article is meant to be a starting point for people to learn setup the watchdog timer on IGEP0033 AQUILA COM MODULE boards.

=== Feedback and Contributing ===

Creating articles in the wiki is a collaborative process, at any point, if you see a mistake you can contribute to this article.

Please, use the discussion tab for user comments. This is useful to separate page content and the discussion thereof and also, if you don't want to give normal users the right to edit the page but still want user contributed notes.

Editing permissions are restricted to registered users. [http://www.igep.biz Register in the main IGEP site] and you will have single sign-on.

Consult the [http://www.mediawiki.org/wiki/Help:Contents User's Guide] for information on using the wiki software.

There is a set of [[Wiki contribution guidelines]].


=== Aquila watchdog overview ===

There are 2 watchdog timers in the Aquila, inside the /dev/ directory:
*watchdog
*watchdog0

This watchdogs are special files which, when opened, count time while there's no writing on them. Whenever a process writes data on that files, they reset the timer. But if timer reaches the timeout value between writings, then watchdog forces the microcontroller to reboot, as it detects it as that process is freezing.


=== Watchdog timers under Linux kernel ===

The following documentation from [http://www.kernel.org kernel.org] can give you more information about the watchdogs:
* [http://www.kernel.org/doc/Documentation/watchdog/watchdog-api.txt Linux Watchdog driver API.]
* [http://www.kernel.org/doc/Documentation/watchdog/src Watchdog related example programs.]

Compile the ''watchdog-simple.c'' source code with your board's compiler. This is the application we will use demonstrate the basical watchdog functionality.

With this tiny piece of software, we can enable, and tick the watchdog card. First, we will run it to see the typical behaviour:

$ watchdog-simple

As the program ticks the card (writes on it every 10 seconds), the watchdog observes normal activity and doesn't reset the board.

Now we will modify the code in order to avoid the ticking, and only enabling the watchdog to count. For that purpose, we will comment or erase all the code inside the ''while loop'', obtaining an infinite loop that makes nothing (which simulates the system freezing).

$ watchdog-simple

After the timer reaches the timeout value, the board resets on itself.

=== Adding configuration parameters and flags ===

The watchdog can be configured by editing the underlying device parameters of special files. It can easily be implemented inside our simple test with ''ioctl()''.

For example, we can change the timeout value by adding the following lines to our main function, before the ''while'' loop:

int timeout = 45;
ioctl(fd, WDIOC_SETTIMEOUT, &timeout);
printf("The timeout was set to %d seconds\n", timeout);

Please, note that you may include some header files in order to compile the program succesfully:
#include <sys/ioctl.h>
#include <linux/watchdog.h>

Note too that the timeout can be set to 60 seconds depending on the device's granularity.

<center>''Work in progress, for more information on WD parameters please read [http://www.kernel.org/doc/Documentation/watchdog/watchdog-api.txt Linux Watchdog driver API.]''</center>

[[Category:Software]]