|
Forum Index : Microcontroller and PC projects : Watchdog does not work
| Author | Message | ||||
| wolfme Regular Member Joined: 26/10/2021 Location: GermanyPosts: 41 |
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 KingdomPosts: 10953 |
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 KingdomPosts: 4233 |
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: GermanyPosts: 41 |
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 KingdomPosts: 10953 |
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: GermanyPosts: 41 |
Oh, ok. Thanks for info. I'll try that. |
||||
Grogster![]() Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9874 |
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: AustraliaPosts: 3006 |
|
||||
Grogster![]() Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9874 |
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: GermanyPosts: 41 |
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: GermanyPosts: 1 |
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 StatesPosts: 3611 |
Welcome to the forum and thanks for posting. 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 |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |