Watchdog

Started by iprobertson January 15, 2003
Hi,

Is there a way to detect that the watchdog timer has expired and the
cpu has been reset? I'd like to be able to detect that there has
been a problem so that I can notify the user.

Thanks



You could use:
If Not FirstTime Then
'your code
Else
'your other code
End if
or set a variable in Persistent mem to do similar

Ian
iprobertson wrote:

> Hi,
>
> Is there a way to detect that the watchdog timer has expired and the
> cpu has been reset? I'd like to be able to detect that there has
> been a problem so that I can notify the user.
>
> Thanks >
> HGTV Dream Home Giveaway
> <http://www.hgtv.com/hgtv/pac_ctnt/text/0,,HGTV_3936_5802,FF.html" target="_blank" rel="nofollow">http://rd.yahoo.com/M$1773.2861420.4212388.1925585/D=egroupweb/S06554205:HM/A94045/R=0/*http://www.hgtv.com/hgtv/pac_ctnt/text/0,,HGTV_3936_5802,FF.html >
> ">http://docs.yahoo.com/info/terms/>.




It is my understanding that 'FirstTime' is only ever run once after
downloading a prog? so I dont believe I could use it as my app will
be stopped and started when the kit is powered on and off.

Also you would need to initialize the persitent variable somwhere in
the app. As the wathdog resets the processor I would have the same
issue as I dont see a way of differentiating between a power up
restart and a watchdog restart.

Ian

--- In , Ian Casey <ian.casey@s...> wrote:
> You could use:
> If Not FirstTime Then
> 'your code
> Else
> 'your other code
> End if
> or set a variable in Persistent mem to do similar
>
> Ian >
> iprobertson wrote:
>
> > Hi,
> >
> > Is there a way to detect that the watchdog timer has expired and
the
> > cpu has been reset? I'd like to be able to detect that there has
> > been a problem so that I can notify the user.
> >
> > Thanks
> >
> >
> >
> > HGTV Dream Home Giveaway
> >
<http://rd.yahoo.com/M$1773.2861420.4212388.1925585/D=egroupweb/S=1
706554205:HM/A94045/R=0/*http://www.hgtv.com/hgtv/pac_ctnt/text/0,
,HGTV_3936_5802,FF.html>
> >
> >
> >
> > ">http://docs.yahoo.com/info/terms/>.




Ian,
Look at the MCUSR porf bit (power on reset flag)
Ian

iprobertson wrote:

> Hi,
>
> Is there a way to detect that the watchdog timer has expired and the
> cpu has been reset? I'd like to be able to detect that there has
> been a problem so that I can notify the user.
>
> Thanks



Ian

That Should do it ;-0

Thanks

Ian

--- In , Ian Casey <ian.casey@s...> wrote:
> Ian,
> Look at the MCUSR porf bit (power on reset flag)
> Ian
>
> iprobertson wrote:
>
> > Hi,
> >
> > Is there a way to detect that the watchdog timer has expired and
the
> > cpu has been reset? I'd like to be able to detect that there has
> > been a problem so that I can notify the user.
> >
> > Thanks
> >
> >
>




As has been discussed before, if the watchdog timer is enabled (from a
previous code upload), when uploading to the BX-24 again and that download
takes longer than the watchdog timeout period, the '24 becomes really
unhappy. I personally have had persistent variables totally roached because
of this, not to mention the unpredictable behavior of the BX-24 after this
happens.

I know the watchdog timer is hardware, but obviously it is being enabled
(or disabled?) by the uploaded code, so why can't the compiler kill the
thing until after the download is complete? This would sure save a LOT of
headaches for those of us using the watchdog and dealing with upload times
of > 2 seconds....

Ken

------ Amateur Radio Station AH6LE
http://www.ah6le.net
The new RC-110 Repeater Controller is now shipping. For details see:
http://www.ah6le.net/arcom/rc110.html
AH6LE/R - IRLP Node 3000
http://www.irlp.net



Hi Ken!

Just a thought for a work-around, but why not write a super short program
that disables the watchdog, download it before downloading your "Real"
program?

Sloan
----- Original Message -----
From: "Ken Arck" <>
To: <>
Sent: Wednesday, January 22, 2003 12:33 PM
Subject: [BasicX] Watchdog > As has been discussed before, if the watchdog timer is enabled (from a
> previous code upload), when uploading to the BX-24 again and that download
> takes longer than the watchdog timeout period, the '24 becomes really
> unhappy. I personally have had persistent variables totally roached
because
> of this, not to mention the unpredictable behavior of the BX-24 after this
> happens.
>
> I know the watchdog timer is hardware, but obviously it is being enabled
> (or disabled?) by the uploaded code, so why can't the compiler kill the
> thing until after the download is complete? This would sure save a LOT of
> headaches for those of us using the watchdog and dealing with upload times
> of > 2 seconds....
>
> Ken
>
> -- > Amateur Radio Station AH6LE
> http://www.ah6le.net
> The new RC-110 Repeater Controller is now shipping. For details see:
> http://www.ah6le.net/arcom/rc110.html
> AH6LE/R - IRLP Node 3000
> http://www.irlp.net >
>
> ">http://docs.yahoo.com/info/terms/ >




At 01:16 PM 1/22/2003 -0500, you wrote:

Hi Ken!

Just a thought for a work-around, but why not write a super short program
that disables the watchdog, download it before downloading your "Real"
program?

<---That's a good workaround (exactly what I've been doing - loading
Demo.Bas first).

A kludge at best and cumbersome, IMHO. I still don't see why the compiler
can't do what I suggested though <--constructive criticism

Ken
------ Amateur Radio Station AH6LE
http://www.ah6le.net
The new RC-110 Repeater Controller is now shipping. For details see:
http://www.ah6le.net/arcom/rc110.html
AH6LE/R - IRLP Node 3000
http://www.irlp.net



From: "Ken Arck" <>

> [...]
> I know the watchdog timer is hardware, but obviously
> it is being enabled (or disabled?) by the uploaded
> code, so why can't the compiler kill the thing until
> after the download is complete? [...]

This would require that the downloader do a hardware reset of the
system, which is more than just a software change. The PC needs a
way to control the hardware reset line. BX-01 systems already have
that capability, and we may add it to other systems as well.

Here's what's going on -- in a BasicX processor, there's really
only one program that ever runs, which is the BasicX engine.
Whenever you download and run a new BXB file, what you're really
doing is telling the interpreter part of the engine to start
executing instructions from the BXB file.

Since the engine is just a computer program, like any other
computer program, the watchdog timer imposes the same constraints
on the engine as on any other program.

But once you start the watchdog, it's very difficult to turn off.
It was intentionally designed to be difficult to turn off, short
of a hardware reset. Which makes sense (to me, anyway), since the
watchdog is supposed to be a last-ditch safety mechanism that
reboots the system if a program somehow ends up in the weeds.

The last thing you want is a crashed program that accidentally
turns off the watchdog.

So how does this affect downloads? With the current downloader,
you basically have to do a hardware reset whenever you download a
new BX-24 or BX-35 program, if there's any chance the watchdog
could time out during a download (BX-01 systems don't have this
limitation, since the PC controls the hardware reset line).

-- Frank Manning
-- NetMedia, Inc.


At 03:15 PM 1/22/2003 -0700, you wrote: So how does this affect downloads? With the current downloader,
you basically have to do a hardware reset whenever you download a
new BX-24 or BX-35 program, if there's any chance the watchdog
could time out during a download (BX-01 systems don't have this
limitation, since the PC controls the hardware reset line).

<--So if I understand this correctly, I could hold the reset line low while
downloading to the BX-24 and that would prevent the watchdog from starting?

Ken

------ Amateur Radio Station AH6LE
http://www.ah6le.net
The new RC-110 Repeater Controller is now shipping. For details see:
http://www.ah6le.net/arcom/rc110.html
AH6LE/R - IRLP Node 3000
http://www.irlp.net