Herve CLARET

MC9S08QG8 external crystal problem

Discussion created by Herve CLARET on Aug 9, 2010
Latest reply on Aug 10, 2010 by Herve CLARET

Hello,

 

I wire a  crystal 3.579 Mhz on EXTAL and XTAL pins via 2 capacitors and RF resistor.

I want to use it for the bus clock CPU.

First, to test it, I write a code for blinking a LED. It does'nt work in external clock mode. No problem in internal clock mode.

 

Here the initialization :

 

I set up ICSC1 like this :

CLKS = 10

RDIV = 000

IREFS=0

IRCLKEN=0

IREFSTEN=0

 

and ICSC2 like below:

BDIV=01

RANGE, HGO,LP, EREFS =1

ERCLKEN=0

EREFSTEN=0

 

I am waiting until external reference is stable  between ICSC2 and ICSC1 :

while (!ICSSC_OSCINIT){}

 

 

Must I set IREFS to 1 because my crystal isn't multiple of 32 Khz ?

 

Why, when I delete the "while !ICSSC_OSCINIT){}" line, the uC switch in internal clock ?

 

Thanks for your help.

 

Herve

Outcomes