11.16 Watchdog; How To Manage The Watchdog Using The C Programming Language; How To Manage The Watchdog From The Command Line - Eurotech DynaGate 10-12 Series User Manual

Automobile iot edge gateway ti am335x, lte cat 1
Table of Contents

Advertisement

11 How to access interfaces under Linux

11.16 Watchdog

The DynaGATE 10-12 exposes the watchdog as follows:
Watchdog: /dev/watchdog1
l
11.16.1

How to manage the watchdog using the C programming language

To manage the watchdog using the C programming language enter the following commands:
Int interval;
Int bootstatus;
Long value;
/* display current watchdog value */
If (ioctl(fd,WDIOC_GETTIMEOUT,&interval)==0)
{
   // interval contains current timeout in seconds
}
/* Check if lasdt boot is caused by watchdog */
If (ioctl(fd,WDIOC_GETBOOTSTATUS,&bootstatus)==0)
{
   //bootstatus <> 0 Watchdog
   //bootstatus = 0 Power-on reset
}
/* set the watchdog value (for example: 30 seconds) */
value=30;
If (ioctl(fd,WDIOC_SETTIMEOUT,&value)==0)
{
   //Watchdog has been set to value content
}
/* stop the watchdog */
write(fd,"V",1);
/* feed the watchdog */
ioctl(fd,WDIOC_KEEPALIVE,0);
11.16.2

How to manage the watchdog from the command line

To set the watchdog value (for example: 30 seconds), enter the following command:
wdt_setup –d /dev/watchdog1 –t 30
To start and feed the watchdog, enter the following command:
echo 1 > /dev/watchdog1
To stop the watchdog, enter the following command:
echo V > /dev/watchdog1
76 / 94
DynaGATE 10-12 User manual Rev. 0-14

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the DynaGate 10-12 Series and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents