Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 19:55 12 Nov 2025 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 : Quick C-function/C-sub question...

Author Message
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9755
Posted: 11:34pm 24 Mar 2019
Copy link to clipboard 
Print this post

Hi all.

If you are executing a C routine, and it crashes inside the routine, if you have the WATCHDOG command set, will the processor still be restarted by it?

IE: If the C routine crashes and never returns to the interpreter, does the watchdog still reboot the core? I am just wondering if the WATCHDOG command acts on the PIC32 watchdog, or is is just a routine running in the back of the interpreter?

If the latter, and a C routine makes the chip fall over, then it would never return to the interpreter, and so then the watchdog would never operate.

Hopefully you can see what I am getting at.
Smoke makes things work. When the smoke gets out, it stops!
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10572
Posted: 08:12am 25 Mar 2019
Copy link to clipboard 
Print this post

  Quote  If you are executing a C routine, and it crashes inside the routine, if you have the WATCHDOG command set, will the processor still be restarted by it?


No: if a CFunction starts looping then it can only be recovered by a H/W reset. You would need to use an external watchdog to overcome this.
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2171
Posted: 09:51am 25 Mar 2019
Copy link to clipboard 
Print this post

Ah! that is interesting.

Having worked with PICs in the 16F and 18F families for ages, I had made the mistake of assuming that the MMBasic watchdog was based around the hardware WDT.

Important to know this - although, touch wood, I haven't had a problem like Grogs describes.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10572
Posted: 10:08am 25 Mar 2019
Copy link to clipboard 
Print this post

Sorry - should have been more specific.

You can't guarantee it will work - depends on the CFunction and whether the timer interrupt is disabled or has been compromised. Some CFunctions that do time specific activities disable the timer interrupt. Others don't, some hook into the timer routine and so could stop the watchdog even if the interrupt isn't disabled.

  Quote  I had made the mistake of assuming that the MMBasic watchdog was based around the hardware WDT.

No, it is based on a counter in the main timer interrupt
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9755
Posted: 06:58am 26 Mar 2019
Copy link to clipboard 
Print this post

Thank you for the reply, Peter.

I have not been having any issues, but I was wondering what would happen IF that event.....eventuated.

For some reason, I thought that the MMBASIC WATCHDOG command set the PIC32 hardware WDT, not just a background timer. Good to know going forward.
Smoke makes things work. When the smoke gets out, it stops!
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1646
Posted: 09:13am 26 Mar 2019
Copy link to clipboard 
Print this post

Hi Grogster,

If the above means that you are going to do a re-run of your Watchdog boards please save some for me.

Bill
Keep safe. Live long and prosper.
 
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 2025