CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Watchdog reset

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
benoitstjean



Joined: 30 Oct 2007
Posts: 566
Location: Ottawa, Ontario, Canada

View user's profile Send private message

Watchdog reset
PostPosted: Mon May 13, 2024 5:00 pm     Reply with quote

Compiler: 5.026

Hi guys,

Just a quick question, is there a way to know what part of the code causes a watchdog reset to occurre, A little bit like that piece of code that can tell you where an address strap or stack error occurred.

Thanks!

Ben
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon May 13, 2024 6:48 pm     Reply with quote

hmm, something tells me maybe BUT my gut says a WDT reset 'should' start the program 'from the beginning' ,which should be a 'clean slate'.
It's one of those have to read the datasheet for your PIC...might be a special feature ??
you could code like the POST cards for PC did. set a counter,display the number do an 'operation or test', next..... When the POST card 'stopped' , it was the PREVIOUS test that failed.
Ttelmah



Joined: 11 Mar 2010
Posts: 19538

View user's profile Send private message

PostPosted: Tue May 14, 2024 8:44 am     Reply with quote

No, as Jay says, this is a full reset.
Also a watchdog will not repeatedly happen at one location. The watchdog
timer is quite inaccurate, and so exactly the same watchdog may/will
trigger at lots of different instructions.
Calculate the minimum watchdog time for your chip. Then use something like
the MPLAB simulator to count instructions. When it gets to the count for
the watchdog, every location after this could have it trigger.
Ttelmah



Joined: 11 Mar 2010
Posts: 19538

View user's profile Send private message

PostPosted: Tue May 14, 2024 11:28 pm     Reply with quote

As a comment to this the normal way to track where you are in a program,
is to 'cheat'. Assuming you chip has a spare UART, set this up to a fast
baud rate, and link the output to a USB serial adapter running one of
the standard terminal programs. Then at key points in your code, add
a simple putc, sending marker bytes. Using a hardware UART, the code
time needed by this is tiny. So when it watchdogs, you will have a list
of bytes, suddenly jumping back to the start of code one. The last byte
before the jump back, will be the marker at the start of the code section
you need to look at.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group