Page 1 of 1

Watchdog Time-out.

Posted: Mon Mar 15, 2010 11:36 am
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?

Re: Watchdog Time-out.

Posted: Mon Mar 15, 2010 1:41 pm
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.

Re: Watchdog Time-out.

Posted: Mon Mar 15, 2010 1:47 pm
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

Re: Watchdog Time-out.

Posted: Mon Mar 15, 2010 2:18 pm
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.

Re: Watchdog Time-out.

Posted: Mon Mar 15, 2010 4:07 pm
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.