Personal tools

Log in

Changes

From IGEP - ISEE Wiki

Jump to: navigation, search

Watchdog timers on AM335x boards

232 bytes added, 18:34, 30 June 2015
no edit summary
=== 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.
#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.
We can also request the timeout value by using the following commands:
====Pretimeout====
If your The AM3354's watchdog supports timer doesn't support pretimeout, you so we can 't set the time lapse between the pretimeout and the timeout:it. ====Time left====
pretimeout = 10; ioctl(fd, WDIOC_SETPRETIMEOUT, &pretimeout);Sitara's watchdog can't show the amount of time that's remaining before rebooting the machine.
It can be useful for recording useful information and/or saving the data that the program was handling before rebooting the machine.===Environmental Monitoring===
We To learn about all the characteristics available for our watchdog timer, we can also request use ''ioctl'' it with the following command, which will fill the timeout value by using watchdog_info structure with the following commandsWDT identification and its Firmware version, as well as some flags with extra information about available options:
struct watchdog_info ident; ioctl(fd, WDIOC_GETPRETIMEOUTWDIOC_GETSUPPORT, &pretimeoutident); printf("The pretimeout value is \n%s\n%d\n%d seconds\n", pretimeoutident.identity, ident.firmware_version, ident.options);
====Time left====If we add this lines to our program, we will see something like this:
Some watchdog drivers can report the remaining time before the system will reboot. With these lines we can ask the driver for the number of seconds remaining before timeout: OMAP Watchdog 0 32896
ioctl(fdIn order to decrypt the options integer, WDIOC_GETTIMELEFT, &timeleft); printf("The time left 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 %d seconds\n"activated, timeleft);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]]