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
Watchdog timeout issue 16f1827
Moderator: Benj
-
medelec35
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- 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 timeout issue 16f1827
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
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 timeout issue 16f1827
Thanks Ben.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.
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?
I am using both timer0 and PWM components so don't believe this will be achievable.Benj wrote: Otherwise is there a way to increase the prescaler for the watchdog timer or are you using the prescaler for a timer?
Thanks for suggestion anyway
Martin
-
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 timeout issue 16f1827
After re-looking in the datasheet and looks like its not sharing prescaller with timer 0.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.
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.
Martin
-
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 timeout issue 16f1827
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.
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.
Martin