COP Watchdog

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

COP Watchdog

7,913 Views
patti
Contributor I
Hi, am using CodeWarrior 4.1 (HCS12) with support for XGATE. Processor MC9S12XDP512.
I am having problems to get my processor to reset/restart after watchdog expires. Notting happens when I enter the infinite loop. What should I do?
Whats wrong?
thanks in advance Patrik
Labels (1)
0 Kudos
Reply
8 Replies

1,634 Views
J2MEJediMaster
Specialist I
The infinite loop is in the the routine _dummyISR, correct? That interrupt routine uses the loop to trap the thread of execution so that the processor doesn't run off into the weeds. When debugging, if you land in _dummyISR, it's because some unanticipated interrupt fired. What to do about a COP interrupt? That depends. If there's a way to recover from the event that delayed the processor (perhaps an I/O routine waiting on a response), you'd put code in the handler to retry the I/O interface. More often the COP signals that something catastrophic happened, and there's no possibility of recovery. In that case, in the vector table you'd just plug the reset interrupt vector into the COP interrupt vector. In other words, if the COP occurs, you reset the processor.

For now, I'd suggest disabling the COP and see if the processor continues to run, or at least hangs in a new location.

---Tom
0 Kudos
Reply

1,634 Views
pIx
Contributor I
How do I plug the reset interrupt vector into the COP interrupt vector? I am using codewarrior 4.5 and the interrupt vectors are specified in MC9S12DP512.h.

Suppose I want to enter the ISR of COP, here is what I do:

#ifndef __SMALL__
#pragma CODE_SEG __NEAR_SEG NON_BANKED
#endif
interrupt 2 void COP(){

}

#ifndef __SMALL__
#pragma CODE_SEG DEFAULT
#endif

Please help as I have only half a day to fix the issue or go without the COP feature altogether.

Thanks a million.
0 Kudos
Reply

1,634 Views
pIx
Contributor I
The vector Table has COP and RESET etc written in this format:

.....

#define Vcop 0x0000FFFA
#define Vclkmon 0x0000FFFC
#define Vreset 0x0000FFFE

.........

All this is specified in the MC9S12DP512.h file. I tried putting "0x0000FFFE" against Vcop and 0x0000FFFA against Vreset but that did nothing to solve the problem. My controller just shuts down when COP runs out, but fails to restart.
0 Kudos
Reply

1,634 Views
peg
Senior Contributor IV
Hi plx,
 
To achieve this simply place the same address value that is stored at FFFE:FFFF at FFFA:FFFB.
 
Regards
Peg
 
0 Kudos
Reply

1,634 Views
J2MEJediMaster
Specialist I
In the header file you would simply change

#define Vcop 0x0000FFFA

to

#define Vcop 0x0000FFFE

Leave everything else alone. Don't mess with the reset vector address! You're counting on it to point the the start-up code that properly resets and restarts the processor. If that doesn't work, you need to study the COP registers and see if an interrupt flag bit is being set somewhere that you need to clear. Otherwise, it will keep signaling a COP interrupt and you'll keep spinning in the reset interrupt routine.

---Tom

Message Edited by J2MEJediMaster on 2006-11-29 09:56 AM

0 Kudos
Reply

1,634 Views
pIx
Contributor I
That is what I did and all other possible combinations, but nothing worked. I though it may be resultant because my Low voltage reset chip (external to the microcontroller) was causing it and spend some time de-soldering and re-soldering my boards too without any luck.

But, I got a spot on answer from MICHAEL (Freescale technical support) and here is his solution:

"If You are writing in "C" in Codewarrior, go to linker parameter file *.prm for your target device.

Find the line: "VECTOR 0 _Startup" and write two additional lines below that:
VECTOR 1 _Startup /* Clock Monitor fail reset */
VECTOR 2 _Startup /* COP failure reset*/"

Solved all the issues and now when my COP runs out or my clock is shorted, it immedietely resets the controller.

Thanks to everyone who helped....
~Sujith

Message Edited by pIx on 2006-12-0108:28 PM

0 Kudos
Reply

1,634 Views
Alban
Senior Contributor II
Hi,

You should check that the COP is set as enabled in BDM (Special Single Chip) Mode for it to work with the debugger. Usually the developer disables it not to get COP Reset in step-by-step debugging.

In the stand alone application, you need to check the COP is enabled.

Alban.
0 Kudos
Reply

1,634 Views
pIx
Contributor I
My microcontroller is also not reseting. It switches itself off but does not come back up. Same is the case with BDM attached and/or disconnected.
 
WHat could the problem be? Why is there an interrupt vector for COP? What do you need to write inside that interrupt routine?
 
I have a feeling Patti too is having the same problem. Please clarify and hope one solution solves all problem.
 
Thanks,
Sujith
0 Kudos
Reply