Page 1 of 1
Watchdog timeout issue 16f1827
Posted: Tue Feb 08, 2011 11:42 am
by medelec35
I am having an issue of watchdog timeout on 16F1827 with Auto watchdog enabled ticked. Internal oscillator is set for 8MHz. Not using RS232. just using ADC's, logic i/p's. calculations, delays and 2 PWM channels. I Have placed quiet a few 'MX_CLEAR_WATCHDOG;' all over flowchart, but still timing out.Time out times can be random from 2 mins to 5 mins. Problem does not occur if disabled WDT.
I thought If I could place a MX_CLEAR_WATCHDOG; command within the common delay function, like I did with RS232, that may solve issue. But unlike RS232 I can't see the .c that is used for delay generation as I thought I could put a 'MX_CLEAR_WATCHDOG within the common delay?
Also is there a way of determining at what point watchdog timeout occurs, e.g using a simulator?
Thank you.
Martin
Re: Watchdog timeout issue 16f1827
Posted: Tue Feb 08, 2011 12:18 pm
by Benj
Hello Martin,
I wonder if the ADC sample or some other component macro call is lasting too long and causing the watchdog to overflow. You could try turning down the ack time via the ADC component properties and seeing if that makes a difference. Otherwise is there a way to increase the prescaler for the watchdog timer or are you using the prescaler for a timer? Could be that the watchdog is being driven directly from the internal clock which would account for the rapid resetting you are experiencing.
2mins to 5mins sounds like I may be wrong with my above estimations. Maybe it is being caught 99% of the time before it overflows and it is a rare occurance where the watchdog gets enough time to reset the device.
Determining when in the program the watchdog resets the device could be tricky. Im sure there is an easy way to do this so I will have a think.
Re: Watchdog timeout issue 16f1827
Posted: Tue Feb 08, 2011 12:33 pm
by medelec35
Benj wrote:
I wonder if the ADC sample or some other component macro call is lasting too long and causing the watchdog to overflow. You could try turning down the ack time via the ADC component properties and seeing if that makes a difference.
Thanks Ben.
That's a good point. I will give it a go and let you know how I got on.
I was using 12F615 and that did not suffer with the same problem. so acquisition time perhaps vary from chip to chip?
Benj wrote:
Otherwise is there a way to increase the prescaler for the watchdog timer or are you using the prescaler for a timer?
I am using both timer0 and PWM components so don't believe this will be achievable.
Thanks for suggestion anyway
Re: Watchdog timeout issue 16f1827
Posted: Tue Feb 08, 2011 1:24 pm
by medelec35
Benj wrote:Is there a way to increase the prescaler for the watchdog timer or are you using the prescaler for a timer? Could be that the watchdog is being driven directly from the internal clock which would account for the rapid resetting you are experiencing.
After re-looking in the datasheet and looks like its not sharing prescaller with timer 0.
So I'd thought I will give this method a try, since decreasing acquisition time to 15 cycles did not work.
After adding wdtcon = 0x1b; // interval = 8 seconds
Did not make any difference. Unless I have missed something. Thanks for the suggestion though.
Re: Watchdog timeout issue 16f1827
Posted: Tue Feb 08, 2011 3:27 pm
by medelec35
Still puzzled. Altered wdtcon to 0x23 so in theory a reset should occur every 128 seconds if timer is not reset.
unticked auto clear watchdog, then let program run. chip did a reset in 8 mins which does not make any sense.
Within programmer options I had disabled BOREN and Stack under/overflow just in case its not WDT issue.