MC9S08QE4 not running with external crystal

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

MC9S08QE4 not running with external crystal

Jump to solution
591 Views
soli255
Contributor II

Hello, I have a problem with running my QE4 with external crystal (I have tried 11.0592MHz / 8MHz / 4MHz - different packages and manufacturers)

 

My code:

 

  ICSC2_BDIV     = 0b10;

  ICSC2_RANGE    = 1;

  ICSC2_HGO      = 1;

  ICSC2_LP       = 0;

  ICSC2_EREFS    = 1;

  ICSC2_ERCLKEN  = 0;

  ICSC2_EREFSTEN = 0;

  

while ( ICSSC_OSCINIT == 0 );

  ICSC1_CLKS     = 0b10;

  ICSC1_RDIV     = 3;

  ICSC1_IREFS    = 0;

  ICSC1_IRCLKEN  = 0;

  ICSC1_IREFSTEN = 0;

 

Problem is that program freez on while condition - crystal is not running. I use standart connection to XTAL and EXTAL pins with 22p capacitors and 1MR resistor.

 

Any suggestion what is wrong?

 

Thx

Labels (1)
0 Kudos
1 Solution
412 Views
soli255
Contributor II

I just run my QE with 6MHz crystal in FBELP mode by this code:

// *** FBELP MODE ***

  // 6MHz Crystal

  // Fbus = ( Fext * 1 / BDIV ) / 2

  ICSC2_BDIV     = 0b00;  // selected clock / 1

  ICSC2_RANGE    = 1;     // high range select

  ICSC2_HGO      = 0;     // low power

  ICSC2_LP       = 1;     // FLL disabled

  ICSC2_EREFS    = 1;     // oscillator request

  ICSC2_ERCLKEN  = 0;

  ICSC2_EREFSTEN = 0;

  for ( i=0 ; i<1000 ; i++ );

  //while ( ICSSC_OSCINIT == 0 );

  ICSC1_RDIV     = 0b111;  //

  ICSC1_IREFS    = 0;

  ICSC1_IRCLKEN  = 0;

  ICSC1_IREFSTEN = 0;

  ICSC1_CLKS     = 0b10;  // external reference clock selected

I am still quite confused by this many modes of operation, and fact that in FBELP mode BDC should not be active, but I have full functional debuging (code step, breakpoint, periodical RAM readouts ...)

View solution in original post

0 Kudos
4 Replies
412 Views
bigmac
Specialist III

Hello,

Are you attempting to use FEE mode or FBE mode - there is some ambiguity?

For FEE mode and RDIV setting of 3 (reference division by 256), only the 8 MHz will work.  A lower division setting would be required for the 4 MHz crystal.  The 11.0592 MHz crystal is unsuited to FEE mode.

You could also try commenting out the wait loop for the OSCINIT flag.

Regards,

Mac

0 Kudos
412 Views
soli255
Contributor II

Hello Mac,

I am following the "Using the Internal Clock Source (ICS) for the HCS08 Microcontrollers" chapter in HCS08QRUG.pdf and I was trying to run in this FBE.

I was also using wait loop like this for ( i=0 ; i<10000 ; i++ );

And also I modified my layout and move 22p capacitors very close to crystal and each other.

But franklly i will be glad for any mode runnig with crystal - because i already try several crystals and many of code.

Thx

0 Kudos
412 Views
soli255
Contributor II

I just finish working on QE with 32,768kHz crystal, but another fail. Code for FEE and 32kHz here:

// Fbus = ( Fext / RDIV * 512 / BDIV ) / 2

  ICSC2_BDIV     = 0b01;  // selected clock / 2

  ICSC2_RANGE    = 0;     // low range select

  ICSC2_HGO      = 1;

  ICSC2_LP       = 0;

  ICSC2_EREFS    = 1;     // oscillator request

  ICSC2_ERCLKEN  = 0;

  ICSC2_EREFSTEN = 0;

  //for ( i=0 ; i<10000 ; i++ );

  while ( ICSSC_OSCINIT == 0 );

  ICSC1_RDIV     = 0;     // div by 1

  ICSC1_IREFS    = 0;

  ICSC1_IRCLKEN  = 0;

  ICSC1_IREFSTEN = 0;

  ICSC1_CLKS     = 0b00;  // output from FLL     

my QE is still without clock from external crystal ...

0 Kudos
413 Views
soli255
Contributor II

I just run my QE with 6MHz crystal in FBELP mode by this code:

// *** FBELP MODE ***

  // 6MHz Crystal

  // Fbus = ( Fext * 1 / BDIV ) / 2

  ICSC2_BDIV     = 0b00;  // selected clock / 1

  ICSC2_RANGE    = 1;     // high range select

  ICSC2_HGO      = 0;     // low power

  ICSC2_LP       = 1;     // FLL disabled

  ICSC2_EREFS    = 1;     // oscillator request

  ICSC2_ERCLKEN  = 0;

  ICSC2_EREFSTEN = 0;

  for ( i=0 ; i<1000 ; i++ );

  //while ( ICSSC_OSCINIT == 0 );

  ICSC1_RDIV     = 0b111;  //

  ICSC1_IREFS    = 0;

  ICSC1_IRCLKEN  = 0;

  ICSC1_IREFSTEN = 0;

  ICSC1_CLKS     = 0b10;  // external reference clock selected

I am still quite confused by this many modes of operation, and fact that in FBELP mode BDC should not be active, but I have full functional debuging (code step, breakpoint, periodical RAM readouts ...)

0 Kudos