COP function ok, but COP interrupt does not occur , at S12XDP512

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

COP function ok, but COP interrupt does not occur , at S12XDP512

2,285 Views
harry_haeusern
Contributor I
Hi,
 
I have a strange result.
 
I need a information if a COP reset has occured to generate a errormessage in the EEPROM
 
The COPCTL is loaded at startup  with RSBCK_M_=1 CR2_=1 CR1_=1 CR0_=1. 
In the debugger I see, when the COP is served that no reset occur.  When I dont serve it, a reset accur.
 
I set at the vectoraddress 0xFFFA (COP-interrupt) to a function, on which I set a breakpoint.  But when the COP timeout occur, the the cop-ISR is not called.
I read somewhere in the forum, that COP-ISR could not be service, when a the reset-pin is connected to a 0,1uF , on my board the reset pin is dirctly connected to a voltage-IC with reset output.
 
How, can I fetch or generate the real COP-ISR??
Labels (1)
0 Kudos
Reply
6 Replies

722 Views
kef
Specialist I
First of all COP is not an interrupt but a reset. That means it doesn't make sense to put breakpoint at COP routine, because on COP reset breakpoints hardware also get reset. Also your chip resets to normal mode and BDM communications are lost.
 
Regarding large cap on /RESET pin you should read XDP512 datasheet, chapter 2.5.1 Description of Reset Operation. Having large RC on /RESET pin COP and CME vectors won't ever trigger.
0 Kudos
Reply

722 Views
harry_haeusern
Contributor I
Ok. COP is not a interrupt but a reset.
But I can give the PC a adress to which he can jump, if a COP-timeout will appear .
And just there (0xFFFA) I have placed a software breakpoint (debugger).  The same case a I can repoduce with a reset (Pin-Reset,POR...) at adress (0xFFFE).
0 Kudos
Reply

722 Views
Lundin
Senior Contributor IV
If you want to know whether the code enters the COP interrupt or not, set an I/O pin or something from inside the isr. Because the debugger will lose track as soon as a reset occurs.

The cap indeed seems to be too large. At least on S12 you can't have 100nF on the reset pin, and I assume the same goes for S12X. Try switching to a 47pF or 100pF.
0 Kudos
Reply

722 Views
harry_haeusern
Contributor I
I tested the ISR, and there I drive a I/O-Pins. It seems to be good. In deed with the debugger this function is not testable.

Thank you Lundin

Harry
0 Kudos
Reply

722 Views
harry_haeusern
Contributor I
But now I have the problem, how to save the information, that a COP-Reset has occured?
 
I wrote a function which save this info to a EE-Memory. This function is called in the ISR of the COP-and after then jump to Reset adress 0xFFFE.
The problem ist, that the Controller restarts only when no function is called in the ISR. so that is not possible to catch the cop-event and save it.
Any other ideas??
0 Kudos
Reply

722 Views
kef
Specialist I
Do you initialize stack pointer, eeprom, and everything else needed for you COP handler? Remember COP in S12X is reset, not interrupt, so you should initialize everything again.
Also be careful with writing to EE in you COP handler. In case error is permanent and COP timeout happens again and again, you can loose your eeprom. At least verify if error happened already and prevent overwriting the same cell zilions of times.
0 Kudos
Reply