Personal tools

Log in

Changes

From IGEP - ISEE Wiki

Jump to: navigation, search

Watchdog timers on AM335x boards

1,230 bytes added, 18:38, 30 June 2015
no edit summary
== Watchdog timers on AM335x boards ==
{{Message/Work in progress}}
=== Overview of this article ===
=== Aquila watchdog overview ===
There are 2 Texas Instruments' AM3354 processor has one 32bits watchdog timers in the Aquila, inside the /dev/ directory: *watchdog*watchdog0timer.
This watchdogs Watchdogs are special files which, when opened, count time while there's no writing on them. Whenever a process writes data on that filesor uses ''KEEP_ALIVE ioctl'' on them, they reset the timer. But if timer reaches the timeout value between writings, then watchdog forces the microcontroller microprocessor to reboot, as it detects it as that process is freezing.
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====Timeout==== Default timeout for AM3354's watchdog is 60 seconds, but we can change the timeout value by adding the following lines to our main function, before the ''while'' loop:
int timeout = 45;
#include <linux/watchdog.h>
Note too that We can also request the timeout value by using the following commands:  ioctl(fd, WDIOC_GETTIMEOUT, &timeout ); printf("The timeout value is %d seconds\n", timeout); ====Pretimeout==== The AM3354's watchdog timer doesn't support pretimeout, so we can be 't set to 60 seconds depending on it. ====Time left==== Sitara's watchdog can't show the deviceamount of time that's granularityremaining before rebooting the machine. ====Environmental Monitoring==== To learn about all the characteristics available for our watchdog timer, we can use ''ioctl'' it with the following command, which will fill the watchdog_info structure with the WDT identification and its Firmware version, as well as some flags with extra information about available options:  struct watchdog_info ident; ioctl(fd, WDIOC_GETSUPPORT, &ident); printf("\n%s\n%d\n%d\n", ident.identity, ident.firmware_version, ident.options); If we add this lines to our program, we will see something like this:  OMAP Watchdog 0 32896 In order to decrypt the options integer, we must apply a bitwise AND operation between it and the different watchdog options flags. With a simple conditional we can print if a flag is activated, so we will know which functionalities does our watchdog support. We can do it like this:  if (ident.options & WDIOF_SETTIMEOUT) printf("SET_TIMEOUT\n"); For further information on WD parameters, please refer to [http://www.kernel.org/doc/Documentation/watchdog/watchdog-api.txt Linux Watchdog driver API.]
<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]]