Hi,
I am trying to configure the watchdog in TS7500 to achieve the following:
1) Automatically reboot the board if the app hangs.
2) Reboot the board if the application gets killed and stops at command
line/shell prompt.
The first requirement is satisfied but somehow the watchdog doesnt time out if
I kill the application from the console.Even when I exit from the application
after some iterations of watchdog feed the results are the same.The board just
stops at command line.Any ideas what could be wrong here?
The code is as below:
//////////////////////////////////
#include <time.h>
#include <stdio.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <unistd.h>
#include <ctype.h>
#include <linux/rtc.h>
#include <sys/time.h>
#include <sys/types.h>
#include <string.h>
#include <ctype.h>
#include <pthread.h>
#include "sbus.h"
#include "termios.h"
#include "fcntl.h"
#include "stdlib.h"
#include "malloc.h"
int main(int argc, char **argv)
{
unsigned char iii=0;
///initialize watchdog
system("ts7500ctl -W");
printf("\n watchdog init \n");
///set autofeed interval for watchdog
/*
0x74: Watchdog feed register (write only)
write value 0x0: feed watchdog for another .338s (approx)
write value 0x1: feed watchdog for another 2.706s (approx)
write value 0x2: feed watchdog for another 10.824 (approx)
write value 0x3: disable watchdog
*/
sbuslock();
sbus_poke16(0x74,1);
sbusunlock();
for(iii=0;iii<50;iii++)
{
sleep(1);
sbuslock();
sbus_poke16(0x74,1);
sbusunlock();
printf("\n feeding watchdog = %d\n",iii);
printf("\n in while \n");
}
exit(0);
///exiting from app here back to shell prompt...hoping for watchdog to timeout
and reboot the board
}
////////////////////////////////////////////
Thanks,
Ramandeep
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|