Watchdog Time-out.

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Watchdog Time-out.

Post by medelec35 »

With ‘Auto clear watchdog’ selected and a quiet a few

Code: Select all

clear_wdt(); 
C boxes.
I have also added

Code: Select all

option_reg = 0x4F; //Enable port B weak pull-ups and set WDT prescaler at 1:128  
at the beginning.

But still Flowcode resets every so often (47 resets in 2 hours)
I have noticed that increased port B interrupt detection increases number of resets.
This increase is due to 2 fan demands increasing, so RPM’s are faster, and taco i/ps connected to port B interrupt increase. Both fans are running at 2700 RPM = 45 detections per second * 2

Is there any way to find out at which point time out occurs so can add extra clear_wdt(); at correct locations, rather then very randomly?
Martin

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Watchdog Time-out.

Post by Benj »

Hi Medelec,

Thats a tricky one. Im sure there must be a good way of doing it but cant really think how at the moment. Could you add a reset to the start of your interrupt service macros (maybe add to the end too). This way the rate of interrupts should not effect the watchdog timing. Eg you could then disable all interrupts and ensure you are running ok without them firing.

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Watchdog Time-out.

Post by medelec35 »

Ben, Thanks for your reply. Do you mean add clear_wdt(); to the start and end of interrupts, If so, already did that before posting. Or do you mean reset something else?
Not quiet sure what you ment. Sorry
Martin

User avatar
Steve
Matrix Staff
Posts: 3434
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times

Re: Watchdog Time-out.

Post by Steve »

First - are you sure the reset is caused by a watchdog timeout? It could be a brownout or perhaps something else. You can check this by checking the state of a register (can't remember which one off the top of my head) at the beginning of your program.

Also, putting the clrwdt into the ISR for a timer interrupt might actually negate any benefit from having the watchdog on. Your main-loop code could still get "stuck" somewhere. The ISR would then keep firing periodically, but would always jump back to the same stuck point.

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Watchdog Time-out.

Post by medelec35 »

steve wrote:Also, putting the clrwdt into the ISR for a timer interrupt might actually negate any benefit from having the watchdog on. Your main-loop code could still get "stuck" somewhere. The ISR would then keep firing periodically, but would always jump back to the same stuck point.
Thanks Steve. That’s a good point! I’m fairly sure is watchdog, since if I reduce fan speeds, no resets are detected. I will measure the 5V supply with fans running fast to check. Also brown out detection is disabled in the configuration settings. To prove its watchdog, I will switch WD off, and see if continues to reset or not.
Martin

Post Reply