2010-09-24 05:17:03     Watchdog in uClinux-2008R1.5

Document created by Aaronwu Employee on Aug 23, 2013
Version 1Show Document
  • View in full screen mode

2010-09-24 05:17:03     Watchdog in uClinux-2008R1.5

Patrick Hotz (GERMANY)

Message: 93814   

 

Hi,

 

currently i am trying to get the watchdog running on my blackfin 537.

 

I have enabled the watchdog in kernel config and also set the "nowayout" to enabled.

In my software i initialize the watchdog:

 

    watchdog_fd = open("/dev/watchdog", O_WRONLY);

    if (watchdog_fd == -1)

        {

        printf("%s: Kann Watchdog nicht öffnen\n", PROGNAME);

        }

    else

        {

        int timeout = 120;

        ioctl(watchdog_fd,WDIOC_SETTIMEOUT,&timeout);

        }

 

The keepalive is this ( in a loop every 10 sec):

 

        if(watchdog_fd > 0)

            {

            ioctl(watchdog_fd, WDIOC_KEEPALIVE, 0);

            }

 

 

 

This is working ok, and i can see the registers:

WDOG_CTL is 0x0000 (enabled and reset)

WDOG_CNT is 0xCB4417800 ( my timeout)

WDOG_STAT is decrementing all the time... and reset to WDOG_CNT if the Keepalive is triggered.

 

This values i read every second directly out in the bfin_wdt.c with a added timer which prints the values of the register...

 

 

 

My problem is following:

If the watchdog reaches 0 in WDOG_STAT the blackfin freezes and nothing happens.

First i have thought that the BFIN_SYSCR NOBOOT bit is set, but the register is 0x0000

 

 

 

Does anybody have an idea to solve the "freeze" and make a reset to the blackfin ?

 

My uClinux is 2008R1.5, u-boot is 2009.01-svn1696

 

 

 

Patrick

TranslateQuoteReplyEditDelete

 

 

2010-09-24 08:47:03     Re: Watchdog in uClinux-2008R1.5

Mike Frysinger (UNITED STATES)

Message: 93817   

 

what exactly is a "freeze" ?  do you have jtag on there so you know where things end up ?

 

you know there is already a watchdog daemon integrated into the dist right ?  unless you're trying to integrate the watchdog into your end application (which may never quit), it doesnt make much sense to write your own.

QuoteReplyEditDelete

 

 

2010-09-24 09:24:59     Re: Watchdog in uClinux-2008R1.5

Patrick Hotz (GERMANY)

Message: 93818   

 

Hi,

 

with "freeze" i mean that the console on ttyBF0 (uart0) accepts no new commands (not even a character).

Also all other functions are stopped, like i press the reset button on my board and hold it in reset.

 

I think also the watchdog-reset occurs but the reset isn´t released anymore....

 

The Watchdog-Driver is the original fromuClinux-dist-2008R1-RC8/linux-2.6.x/drivers/char/watchdog/bfin_wdt.c.

I have only added the timerfunction which prints some registers (i have added the file).

 

 

 

The watchdog-deamon in the dist isn´t used, i use a own prog which checks my processes and resets the watchdog periodical if everything is ok with my software. So i have only the two snippets i have shown bevore (open the file-descriptor, set the timeout and trigger the keepalive)

 

Also i havn´t a jtag, only the uart-console...

 

 

 

Patrick

 

bfin_wdt.c

TranslateQuoteReplyEditDelete

 

 

2010-09-24 10:11:08     Re: Watchdog in uClinux-2008R1.5

Mike Frysinger (UNITED STATES)

Message: 93819   

 

not sure why you modified things that way.  the debug-mmrs interface cleanly exposes all MMRs so you could simply cat them from the command line while developing.

 

the when the watchdog expires, it resets the system.  there is nothing left to process your UART commands.  it's the same as doing `reboot`.  so i dont think your system is hanging.  more likely it isnt booting properly.

 

do you have JTAG ?  this would be the time to connect and find out where the $PC is sitting.  what exactly are you booting from (BMODE) ?

QuoteReplyEditDelete

 

 

2010-09-24 10:33:51     Re: Watchdog in uClinux-2008R1.5

Patrick Hotz (GERMANY)

Message: 93820   

 

Hi,

 

the printouts in the driver are only a fast way to look to this registers every second (it was a idea which is easy to do), i only want to see the values, not more.

 

That the watchdog resets the system is clear, thats what i want if my software doesn´t sends the keepalive.

 

The Bootmode is 000 (from 16Bit memory on the Async Bank 0).

The problem is that i havn´t a JTAG, so the only way is the uart-console.

 

Is it possible that the watchdog triggers the reset all the time?

or does the u-boot needs to much time to load (that i need to disable the watchdog during u-boot load) ?

 

Patrick

TranslateQuoteReplyEditDelete

 

 

2010-09-24 10:49:24     Re: Watchdog in uClinux-2008R1.5

Mike Frysinger (UNITED STATES)

Message: 93821   

 

root:/> cd /sys/kernel/debug/blackfin/

root:/sys/kernel/debug/blackfin> watch -n 1 grep . */WDOG*

 

is your parallel flash in a readable state ?  if you search the forums, you'll see that if your parallel flash is not directly readable when the watchdog expires, the system will not boot (since the processor immediately attempts to read 0x20000000).  what that means is that if your flash is in the middle of programming and thus not in a readable state when the watchdog kicks the system, your board "hangs".

 

this is why the MTD layer often tries to put the flash back into the "read" state whenever it is done.

 

iirc, the parallel flash must be available very fast ... i believe the Blackfin will actually attempt execution in nanosecond time frames, not microseconds.

Attachments

Outcomes