WDT not working. Won't reboot software

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

WDT not working. Won't reboot software

Postby Ondra » Tue Jun 10, 2014 12:29 pm

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
Attachments
18LF46K80 Config setup view.doc
Here is a screen shot of the config setup.
(466.5 KiB) Downloaded 119 times

Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

Re: WDT not working. Won't reboot software

Postby Ondra » Wed Jun 11, 2014 10:46 am

Hello is anybody out there?
Is this a bug in version 5 that works in version 6?

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

Re: WDT not working. Won't reboot software

Postby Benj » Wed Jun 11, 2014 11:23 am

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.

Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

Re: WDT not working. Won't reboot software

Postby Ondra » Wed Jun 11, 2014 12:13 pm

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?
Attachments
18LF46K80 Config setup WDT view.doc
Updated file with WDT set
(274 KiB) Downloaded 87 times

kersing
Valued Contributor
Valued Contributor
Posts: 1873
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 530 times
Been thanked: 1040 times
Contact:

Re: WDT not working. Won't reboot software

Postby kersing » Wed Jun 11, 2014 8:35 pm

Could you attach your test program so we can take a look at it?
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

Re: WDT not working. Won't reboot software

Postby Ondra » Thu Jun 12, 2014 4:35 pm

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

Kenrix2
Flowcode v5 User
Posts: 211
Joined: Tue Feb 19, 2013 9:51 pm
Has thanked: 72 times
Been thanked: 177 times
Contact:

Re: WDT not working. Won't reboot software

Postby Kenrix2 » Thu Jun 12, 2014 8:04 pm

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.

kersing
Valued Contributor
Valued Contributor
Posts: 1873
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 530 times
Been thanked: 1040 times
Contact:

Re: WDT not working. Won't reboot software

Postby kersing » Fri Jun 13, 2014 12:02 am

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.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

Re: WDT not working. Won't reboot software

Postby Ondra » Fri Sep 19, 2014 6:21 pm

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.
Attachments
WDT test file.fcf
(43.72 KiB) Downloaded 100 times

Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

Re: WDT not working. Won't reboot software

Postby Ondra » Mon Sep 22, 2014 11:54 am

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
Attachments
Microchip WDT Ticket support.txt
(8.45 KiB) Downloaded 115 times

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

Re: WDT not working. Won't reboot software

Postby Benj » Mon Sep 22, 2014 12:15 pm

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;

Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

Re: WDT not working. Won't reboot software

Postby Ondra » Mon Sep 22, 2014 12:56 pm

"Enabled in hardware"
I tried it again and still no reset.
The Program just hangs in the while loop.

Ondra

Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

Re: WDT not working. Won't reboot software

Postby Ondra » Tue Sep 23, 2014 12:13 pm

Good day Ben. Any more on this?

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

Re: WDT not working. Won't reboot software

Postby Benj » Tue Sep 23, 2014 12:35 pm

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.

Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

Re: WDT not working. Won't reboot software

Postby Ondra » Tue Sep 23, 2014 2:00 pm

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
These users thanked the author Ondra for the post:
Benj (Tue Sep 23, 2014 4:11 pm)
Rating: 5.26%