Watch Dog & debug Questions

02 Apr 2011

Hi All,

Looking for some suggestions here... I have a program that is pretty large. It's running pretty well actually but every now and then the main loop just stops...

I'm not sure what has caused it to crash... There are 5 seperate loops spinning outside the main loop. these other loops are not very labor intensive and have been running fine for awhile. The main loop is not doing much either except reading CAN messages from two CAN-Buses and shuttling them into a Queue... Each bus is at a different speed... But I do not think that is the issue either. I say this because that part of the program has been in place for over a month and has been running fine. In the last week or so the main loop "Freezes" from time to time... It's not very often tht it does this... maybe once every hour or two...

Here are some direct questions...

1.) Is there any way to do error trapping to try and find what's going wrong?

2.) Is this a reason why I might ant to install a watchdog? Could a WD rest the PIC if it see's the main loop has stopped?

3.) Can a process on another loop stop the main loop?

4.) Could the posting of a CAN message (TX) cause an error in the main loop while it's reading messages? That is a change I just added in the last week... I do have a bool that I'm using to interrupt the read line of code while it transmits however...

Any other thoughts / suggections?

-

02 Apr 2011

Hi, I had the same problem "every now and then the main loop just stops..." . The origin was a memory full (or too fragmented) and the allocation of a new object fails.

Robert

02 Apr 2011

Thanks Robert...

Still not sure how to track this down...

I think I'll start by turning off the TX message and just run the program and see if it does not freeze...

If that is not it I'll start shutting down loops maybe...

I'm not sure how else to track this down...

---

So... I'm still wondering about the following...

1.) If the main loop stops will others continue to run? 2.) Do we have a example of a watchdog that wil kickstart the main loop if it sees that it stopped?...

-