Full Chip Simulatin with external cllock source - DEMOQE128

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

Full Chip Simulatin with external cllock source - DEMOQE128

1,597 Views
KarelAd
Contributor I
Hi,
Is it possible to perform Full chip simulation for project using external crystal?
 
I´m using 32.768 external crystal on DEMOQE128 and works fine on real HW.
 
When I want to run simulation on this code I got stuck in  "  while(!ICSSC_OSCINIT) {              /* Wait until the initialization of the external crystal oscillator is completed */
  }"
How should I setup the simulator to be able to simulate external clock source? 
 
Thx for your help.
 
Karel
 
 
Added p/n to subject.
 
 
Code:
void MCU_init(void){  asm SEI;                             /* Disable interrupts */  /* ### MC9S08QE128_80 "Cpu" init code ... */  /*  PE initialization code after reset */  /* Common initialization of the write once registers */  /* SOPT1: COPE=0,COPT=1,STOPE=0,RSTOPE=0,BKGDPE=1,RSTPE=0 */  SOPT1 = 0x42;                                        /* SOPT2: COPCLKS=0,SPI1PS=0,ACIC2=0,IIC1PS=0,ACIC1=0 */  SOPT2 = 0x00;                                        /* SPMSC1: LVDF=0,LVDACK=0,LVDIE=0,LVDRE=1,LVDSE=1,LVDE=1,BGBE=0 */  SPMSC1 = 0x1C;                                        /* SPMSC2: LPR=0,LPRS=0,LPWUI=0,PPDF=0,PPDACK=0,PPDE=1,PPDC=0 */  SPMSC2 = 0x02;                                        /* SPMSC3: LVDV=0,LVWV=0,LVWIE=0 */  SPMSC3 &= (unsigned char)~0x38;                       /*  System clock initialization */  /* ICSC1: CLKS=0,RDIV=0,IREFS=0,IRCLKEN=0,IREFSTEN=0 */  ICSC1 = 0x00;                        /* Initialization of the ICS control register 1 */  /* ICSC2: BDIV=1,RANGE=0,HGO=0,LP=0,EREFS=1,ERCLKEN=0,EREFSTEN=0 */  ICSC2 = 0x44;                        /* Initialization of the ICS control register 2 */  while(!ICSSC_OSCINIT) {              /* Wait until the initialization of the external crystal oscillator is completed */  }  /* ICSSC: DRST_DRS=2,DMX32=1 */  ICSSC = (ICSSC & (unsigned char)~0x40) | (unsigned char)0xA0; /* Initialization of the ICS status and control */  while((ICSSC & 0xC4) != 0x80) {      /* Wait until the FLL switches to High range DCO mode */  }  /* Common initialization of the CPU registers */  /* SCGC1: TPM3=1,TPM2=1,TPM1=1,ADC=1,IIC2=1,IIC1=1,SCI2=1,SCI1=1 */  SCGC1 = 0xFF;                                        /* SCGC2: DBG=1,FLS=1,IRQ=1,KBI=1,ACMP=1,RTC=1,SPI2=1,SPI1=1 */  SCGC2 = 0xFF;                                        /* PTAPE: PTAPE0=0 */

 




Message Edited by NLFSJ on 2008-10-06 06:58 AM
Labels (1)
0 Kudos
Reply
1 Reply

657 Views
bigmac
Specialist III
Hello Karel,
 
You might use conditional compiling.
 
#define  FCS_MODE
 
void MCU_init( void) {
   ...
   ...
 
#ifndef  FCS_MODE
   /* Wait until initialization of external oscillator complete */
   while (!ICSSC_OSCINIT);
#endif
   ...
   ...
}
 
To compile for normal hardware operaton, comment out the #define.
 
Regards,
Mac
  
0 Kudos
Reply