AnsweredAssumed Answered

MC9S12XEP100 oscillator problem (sw/hw)

Question asked by Taavi Rouhiainen on Oct 16, 2015
Latest reply on Oct 19, 2015 by lama

Hi all.

 

I have a problem when I try to program MCU with 4MHz oscillator. It works when the oscillator is not used.

 

Setup:

CodeWarrior 5.9.0

Vdd: 3.3 V

MCU: MC9S12XEP100-144

External oscillator: http://datasheet.octopart.com/ASV-48.000MHZ-EJ-T-Abracon-datasheet-5458457.pdf  (4MHz)

External oscillator output: amplitude is ~ 3.2 V (square wave).

Output of the oscillator has a voltage divider with resistors and capacitor. Oscillator gives ~1.95 V amplitude to EXTAL pin.

XTAL is not connected. VDDpll is bypassed to ground.

 

Code I'm using to program PLL:

void SetupPLL(void)

{

  // SYNR_SETUP = 0x04 (SYNDIV[1])

  SYNR = SYNR_SETUP;

// REFDV_SETUP = 0x04 (REFFRQ[1])

  REFDV = REFDV_SETUP;

// POSTDIV_SETUP = 0

  POSTDIV = POSTDIV_SETUP;

  

  // wait for the PLL to lock into correct frequency

  while(!(CRGFLG & CRGFLG_LOCK_MASK));

 

  // CLKSEL_SETUP = 0x80 (PLLSEL[1])

  CLKSEL = CLKSEL_SETUP;

 

 

  // Check if everything is ok

  while(!(CLKSEL & CLKSEL_PLLSEL_MASK));

}

 

When oscillator is connected and SetupPLL function is used, the programmer gives verification error @ 0x0000C008.

Also, I have came across with illegal breakpoints and xgate breakpoints. At first I couldn't find the right delay for programming even if automatic delay was used, but when I increased the output voltage from oscillator it started to work. I can use steps until init() functions when it crashes.

 

When both oscillator and SetupPLL are not used, I can program the MCU without any problems.

 

I have tried to use signal generator (Vpp 1.8v: 0-1.8 V, 4MHz, same code,) for EXTAL pin, but it didn't work.

 

If you have any experience about these kind of problems or you could share some ideas how to proceed with this system, I'd be grateful.

 

-Taavi

Outcomes