Page 1 of 1

WDT not working. Won't reboot software

Posted: Tue Jun 10, 2014 12:29 pm
by Ondra
Good day all.
I am trying to use the WDT in a project I'm working on. For some reason I can't get it to work.
Here are the details if any one can help I would much appreciate it thanks in advance.

18LF46k80
19660800

Re: WDT not working. Won't reboot software

Posted: Wed Jun 11, 2014 10:46 am
by Ondra
Hello is anybody out there?
Is this a bug in version 5 that works in version 6?

Re: WDT not working. Won't reboot software

Posted: Wed Jun 11, 2014 11:23 am
by Benj
Hi Ondra,

In your config settings you have the watchdog disabled. If you need the watchdog to be active in your program then try the "WDT enabled in hardware" setting.

Re: WDT not working. Won't reboot software

Posted: Wed Jun 11, 2014 12:13 pm
by Ondra
Thanks Ben.
I did that. Than set the postscaler to 1:4096 which according to the data sheet should work out to about 16 seconds.
I let the device run as per-normal and nothing happens. Shouldn't the device reboot after the WDT times out?

Re: WDT not working. Won't reboot software

Posted: Wed Jun 11, 2014 8:35 pm
by kersing
Could you attach your test program so we can take a look at it?

Re: WDT not working. Won't reboot software

Posted: Thu Jun 12, 2014 4:35 pm
by Ondra
Thanks Kersing.
I don't have a test program. I am trying to implement this on production code.
From the data sheet. I get that the WDT is independent to any code I write; except
when I stop or start the WD timer and that's if I select to software control the timer.
Aside from that I understand that selecting to enable in hardware; all I have to do is clear
before the timer rolls over and my program will continue uninterrupted.

I have not placed any code to clear the WDT. Shouldn't enabling it in hardware cause my Program to
reboot whenever the timer rolls over. If that is the case, I did enable in hardware for 16 seconds.
My code just continues to run. Any solid trouble shooting tips I could use to get to the bottom of this?
Thanks in advance

Re: WDT not working. Won't reboot software

Posted: Thu Jun 12, 2014 8:04 pm
by Kenrix2
I think the wdt postscaler needs to be (divide by 2) to get 16 seconds. Your assuming a wdt timeout will always reset the micro. It might just wake from sleep. So, it is not "independent of any code I write". Some things that will reset the wdt are: sleep, a write to the the clock ircf bits and a clock failure. For trouble shooting, kersing's suggestion might work, just write a test program and run it. If your still having problems, post it and maybe someone can help.

Re: WDT not working. Won't reboot software

Posted: Fri Jun 13, 2014 12:02 am
by kersing
Ondra wrote:I don't have a test program. I am trying to implement this on production code.
If you want us to be able to help there are two options:
- post the production code
- create a test program and post it

Currently I do not have sufficient information and can only guess what might be wrong.

Re: WDT not working. Won't reboot software

Posted: Fri Sep 19, 2014 6:21 pm
by Ondra
Good day all. It's been a while since I tackled this issue. I am uploading this code sample in hopes that someone
can figure out why this does not work. I have tried many different combinations but nothing seems to work.
I'm starting to think this is a Flowcode issue.
Thanks in advance for your help.

Re: WDT not working. Won't reboot software

Posted: Mon Sep 22, 2014 11:54 am
by Ondra
Good day all. I just got a replay from support at microchip.
I sent them a copy of my sample code. The recommendations
they made. I already have setup in PPP. I'm really thinking that
this is a flowcode bug / issue. Can someone please help
with this? Thanks in advance.

Ondra

Re: WDT not working. Won't reboot software

Posted: Mon Sep 22, 2014 12:15 pm
by Benj
Hello,

In your config settings what happens if you change the watchdog setting from the current

"Controlled by SWDTEN bit"

to the top setting

"Enabled in hardware"

The Microchip example uses the initial setting as they do manipulate the SWDTEN bit in software using this line of code.

Code: Select all

WDTCONbits.SWDTEN = 1;

Re: WDT not working. Won't reboot software

Posted: Mon Sep 22, 2014 12:56 pm
by Ondra
"Enabled in hardware"
I tried it again and still no reset.
The Program just hangs in the while loop.

Ondra

Re: WDT not working. Won't reboot software

Posted: Tue Sep 23, 2014 12:13 pm
by Ondra
Good day Ben. Any more on this?

Re: WDT not working. Won't reboot software

Posted: Tue Sep 23, 2014 12:35 pm
by Benj
Hello,

I've double checked that the watchdog config settings are being mapped correctly and passed through correctly. Can't see how / why it wouldn't be working unless the device datasheet is wrong.

Have you tried multiple chips? Might the watchdog on the chip your using be damaged or burnt out? Really grasping at straws now but can't see how this problem can be linked to Flowcode. There is so little code to go wrong.

Config2H controls the Watchdog.
1:1 timing and Hardware enabled = 0x03
Config 2H is at address 0x300003
And this is the code Flowcode is generating - #pragma DATA 0x300003, 0x3

Could be a compiler issue but again this is grasping at straws and seems to be working for other config addresses.

Re: WDT not working. Won't reboot software

Posted: Tue Sep 23, 2014 2:00 pm
by Ondra
Thanks Ben
I got it working. With your confirmation I was forced to look somewhere else.
I unchecked the "use PPP to configure the chip" and instead
used the CCSLoader ICD-U64 programmer application to configure it, and it worked.
I did not think to do this seeing that I have had no problems loading and running the
application in the past.

Many Thanks
Ondra