Menu
JAQForum Ver 19.10.27

Forum Index : Microcontroller and PC projects : Watchdog does not work

Posted: 10:26am
23 Dec 2025
Copy link to clipboard
wolfme
Newbie

Hi,

I am desperately trying to set the watchdog, but without success.
The Pico (RP2040) does not restart.


> option list
WebMite MMBasic RP2040 Edition V6.01.00
OPTION AUTORUN  ON
OPTION COLOURCODE ON
OPTION CPUSPEED (KHz) 200000
OPTION DISPLAY 50, 230
OPTION WIFI ***, *********, ***
OPTION TELNET CONSOLE ON
>
>
> list
WatchDog 10000
Print 10/0
>
>
> run
[2] Print 10/0
Error : Divide by zero
>
 
Posted: 10:35am
23 Dec 2025
Copy link to clipboard
matherp
Guru

The watchdog is nothing to do with error handling and errors cancel the watchdog. To cause a restart after an error use ON ERROR RESTART in a program. If you set the watchdog and do nothing it will restart the processor after the timeout has expired
 
Posted: 10:37am
23 Dec 2025
Copy link to clipboard
JohnS
Guru

Doesn't look a valid test of Watchdog.

edit: Peter beat me to it!

John
Edited 2025-12-23 20:39 by JohnS
 
Posted: 10:44am
23 Dec 2025
Copy link to clipboard
wolfme
Newbie

Thanks for the info, but the “Watchdog Timer” section in the documentation states that the watchdog continues counting and restarts the CPU when an error occurs and the program returns to the command prompt.
Or have I misunderstood?
 
Posted: 10:53am
23 Dec 2025
Copy link to clipboard
matherp
Guru

The phrasing in the manual perhaps needs changing. The watchdog is intended to deal with the situation where a program has gone rogue e.g. in a tight loop. Errors cancel the watchdog so that you can see what the error was. ON ERROR RESTART deals with the production use of error detection when the program is, in theory, error free.
 
Posted: 11:02am
23 Dec 2025
Copy link to clipboard
wolfme
Newbie

  matherp said  The phrasing in the manual perhaps needs changing. The watchdog is intended to deal with the situation where a program has gone rogue e.g. in a tight loop. Errors cancel the watchdog so that you can see what the error was. ON ERROR RESTART deals with the production use of error detection when the program is, in theory, error free.


Oh, ok. Thanks for info. I'll try that.
 
Posted: 11:34pm
23 Dec 2025
Copy link to clipboard
Grogster
Admin Group


  matherp said  The phrasing in the manual perhaps needs changing. The watchdog is intended to deal with the situation where a program has gone rogue e.g. in a tight loop. Errors cancel the watchdog so that you can see what the error was. ON ERROR RESTART deals with the production use of error detection when the program is, in theory, error free.


Manual ver 6.00.03(all versions) Revision 3, dated 8 September 2025, does not even mention ON ERROR RESTART in the commands under ON ERROR....(page 139)

Only ON ERROR options mentioned, are ABORT, IGNORE, SKIP and CLEAR.
Manual needs updating there.  

Poor wolfme would never have even known about that......  
Edited 2025-12-24 09:36 by Grogster
 
Posted: 11:51pm
23 Dec 2025
Copy link to clipboard
phil99
Guru


  Wolfme said  > option list
WebMite MMBasic RP2040 Edition V6.01.00
OPTION AUTORUN  ON
  V6.01.00 manual, p151 said  ON ERROR RESTART
ON ERROR RESTART will cause MMbasic to execute a Hardware Reset and, of course, if you have OPTION AUTORUN set the program will then restart cleanly
 
Posted: 05:48am
24 Dec 2025
Copy link to clipboard
Grogster
Admin Group


D'OH!

It must be Christmas.....

I just automatically ASSUMED that the manual from only a couple of months ago, would be the latest one.  But you know what they say about assumptions being the mother of all....., don't you!  

Made it to Christmas Eve.
Now I can relax a bit!  
Edited 2025-12-24 15:48 by Grogster
 
Posted: 01:29pm
24 Dec 2025
Copy link to clipboard
wolfme
Newbie

Yes, in manual 6.01.00 there is ON ERROR RESTART, but the wrong description of WATCHDOG Timer is still present (page 21).

Happy Christmas!
 
Posted: 05:50pm
03 Feb 2026
Copy link to clipboard
poeli111
Newbie

Hi folks, my 1st post here...  

I have a small program running on the 2350 webmite (fw:6.02.00) that uses both TCP server and client connections. It retrieves the current frequency from a ham radio transceiver and reports the antenna rotator position to a logging software. Sometimes a connection drops, or the logger software is closed and consequently the programm stops throwing an error and returns to the prompt. I have tried for hours to cover this with a watchdog, but those connection errors do not trigger the watchdog (as I found here in the forum as well)...  

I now have implemented a real and very simple hardware watchdog and just wanted to let you know how, maybe it is useful to someone else. The extra hardware is only 2 parts, a 470 ohms resistor (any wattage) and a 10 µF electrolytic capacitor (min. voltage 10 volts). These parts were handy and may be altered in a wide range.

The resistor is wired from GP22 to RUN, and the capacitor from GND to RUN, its negative terminal to GND, of course.

The software is very simple and self explaining. This line is at the very beginning of the program:

SETPIN GP22,DOUT: PIN(GP22)=0: PULSE GP22,10000: WD=1

A 10 sec positive pulse is generated which (via the resistor) keeps the RUN pin high. (A very short low pulse occurs on GP22 between changing from input (default) to output and the pulse command, but the capacitor maintains the high level on the RUN pin for this short time.)

This line is placed in the middle of the program and is frequently processed:

IF WD=1 THEN PULSE GP22,10000

This re-activates the 10 sec long pulse and keeps the RUN pin high. If an error occurs, the "endless" pulse will time out and GP22 will go low, forcing the RUN pin low as well, which finally causes a restart.

For debugging, just REM the first line. Have fun!

Kind regards, Christian
Edited 2026-02-04 03:53 by poeli111
 
Posted: 06:12pm
03 Feb 2026
Copy link to clipboard
lizby
Guru

Welcome to the forum and thanks for posting.

  poeli111 said  I now have implemented a real and very simple hardware watchdog

SETPIN GP22,DOUT: PIN(GP22)=0: PULSE GP22,10000: WD=1

...

For debugging, just REM the first line


Very timely for me, very much a non-analog guy, even at the most simple level.
 


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026