Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 19:26 15 Feb 2026 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

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

Author Message
wolfme
Regular Member

Joined: 26/10/2021
Location: Germany
Posts: 41
Posted: 10:26am 23 Dec 2025
Copy link to clipboard 
Print this post

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
>
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10953
Posted: 10:35am 23 Dec 2025
Copy link to clipboard 
Print this post

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
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4233
Posted: 10:37am 23 Dec 2025
Copy link to clipboard 
Print this post

Doesn't look a valid test of Watchdog.

edit: Peter beat me to it!

John
Edited 2025-12-23 20:39 by JohnS
 
wolfme
Regular Member

Joined: 26/10/2021
Location: Germany
Posts: 41
Posted: 10:44am 23 Dec 2025
Copy link to clipboard 
Print this post

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?
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10953
Posted: 10:53am 23 Dec 2025
Copy link to clipboard 
Print this post

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.
 
wolfme
Regular Member

Joined: 26/10/2021
Location: Germany
Posts: 41
Posted: 11:02am 23 Dec 2025
Copy link to clipboard 
Print this post

  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.
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9874
Posted: 11:34pm 23 Dec 2025
Copy link to clipboard 
Print this post

  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
Smoke makes things work. When the smoke gets out, it stops!
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 3006
Posted: 11:51pm 23 Dec 2025
Copy link to clipboard 
Print this post

  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
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9874
Posted: 05:48am 24 Dec 2025
Copy link to clipboard 
Print this post

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
Smoke makes things work. When the smoke gets out, it stops!
 
wolfme
Regular Member

Joined: 26/10/2021
Location: Germany
Posts: 41
Posted: 01:29pm 24 Dec 2025
Copy link to clipboard 
Print this post

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!
 
poeli111
Newbie

Joined: 09/01/2026
Location: Germany
Posts: 1
Posted: 05:50pm 03 Feb 2026
Copy link to clipboard 
Print this post

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
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3611
Posted: 06:12pm 03 Feb 2026
Copy link to clipboard 
Print this post

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.
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
Print this page


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