Qe128 ICS with external crystal

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

Qe128 ICS with external crystal

488 Views
LeoS08
Contributor I

Good morning everyone,

I'm having problems to set up the ICS with an external 10MHz crystal, without FLL so I expect a 5 MHz bus freq.

I've seen that ICSC1 and ICSC2 registers  bit are quite similar on MC9S08QG8 so I'm setting them as on QG8, in which I've a bit more experience.

And here comes the problem, in fact after the initialization part, OSCINIT bit of ICSSC doesn't change status, meaning that ICS isn't ready, while on QG8 with the same settings, it's immediatly set after setting up the registers.

As an additional information, with this problem if I setup a TPM interrupt overflow calculated to 1ms, it instead overflows in 1.25ms.

Could please someone clarify me how to set up correctly ICS using external crystal on this MCU and what may cause this issue?

Many thanks!

0 Kudos
1 Reply

483 Views
vicentegomez
NXP TechSupport
NXP TechSupport

Hi

You should have a similar configuration like this

 

/* System clock initialization */
/*lint -save -e923 Disable MISRA rule (11.3) checking. */
if (*(uint8_t*)0xFFAFU != 0xFFU) { /* Test if the device trim value is stored on the specified address */
ICSTRM = *(uint8_t*)0xFFAFU; /* Initialize ICSTRM register from a non volatile memory */
ICSSC = (uint8_t)((*(uint8_t*)0xFFAEU) & (uint8_t)0x01U); /* Initialize ICSSC register from a non volatile memory */
}
/*lint -restore Enable MISRA rule (11.3) checking. */
/* ICSC1: CLKS=2,RDIV=3,IREFS=0,IRCLKEN=1,IREFSTEN=0 */
setReg8(ICSC1, 0x9AU); /* Initialization of the ICS control register 1 */
/* ICSC2: BDIV=0,RANGE=1,HGO=1,LP=0,EREFS=1,ERCLKEN=1,EREFSTEN=0 */
setReg8(ICSC2, 0x36U); /* Initialization of the ICS control register 2 */
while(ICSSC_OSCINIT == 0U) { /* Wait until the initialization of the external crystal oscillator is completed */
}
/* ICSSC: DRST_DRS=0,DMX32=0 */
clrReg8Bits(ICSSC, 0xE0U); /* Initialization of the ICS status and control */
while((ICSSC & 0xC0U) != 0x00U) { /* Wait until the FLL switches to Low range DCO mode */
}

 

 

I hope this will help you

0 Kudos