sebasira

HCS12 Crystal Monitor Failure

Discussion created by sebasira on Apr 29, 2011
Latest reply on May 3, 2011 by kef

Hi all!


I have some troubles with the Clock Monitor. I'm not sure I fully understand it. I'm working with HCS12


Here's what I want to do:

- I work with a 16MHz OSC and uses the PLL to set the frequency at 48MHz (bus = 24MHz). If I touch the crystal (insert noise on it) the MCU crushes (not reset, it stays still)

I want the MCU to reset when losses the crystal or it fails. I assume that's the Clock Monitor Failure Reset for. So I implement it. But still the same


Here's what I'm doing:


PRM FILE:

 

VECTOR ADDRESS 0xFFFE  _Startup
VECTOR ADDRESS 0xFFFC  _Startup
VECTOR ADDRESS 0xFFFA  COP_ISR

As you can see when Clock Monitor Failure Reset is fetched the StartUp sequence is initiated


MAIN FUNCTION

 

COP_init();

/* PLL */
/*******/
SYNR = 5;
REFDV = 3;
    
PLLCTL_PLLON = 1;
PLLCTL_AUTO = 1;
PLLCTL_CME = 1;
PLLCTL_SCME = 0;
    
while(!CRGFLG_LOCK);
CRGFLG_LOCKIF = 1;
   
CLKSEL_PLLSEL = 1;


// Then goes all the other initializations and the main LOOP
// For now, the COP is only feeded no the main LOOP

 

When I touchd de xtal or some noise disturb it, the MCU crushes.

It seems that the RESET sequence is executed as the MCU remains still, but no StartUp...

 

An alternative to this is executing the StartUp code in the LOCKIF ISR, when the PLL is unlocked (LOCK == 0). If I do this, when noise enter the xtal pins, the MCU resets and starts again.

 

I'll like to know why is failing what's mentioned above. And why won't the CMF Resets & StartUp again the MCU.

 

Thanks in advance!!!

 


Outcomes