hi, I'm setting up qe32 clock. It is very difficult.
I have an external crystal wit 32768 kHz.
I need a 39.85 MHz DCOoutput and f_bus about 20 MHz.
I also use rtc => 2 s. interrupt. ( RTCSC = 0x65; RTCMOD = 0x03
Actually I use this procedure to setup the ICS:
/* ICSC1: CLKS=0,RDIV=0,IREFS=0,IRCLKEN=1,IREFSTEN=1 */
setReg8(ICSC1, 0x03); /* Initialization of the ICS control register 1 */
/* ICSC2: BDIV=0,RANGE=0,HGO=0,LP=0,EREFS=1,ERCLKEN=1,EREFSTEN=0 */
setReg8(ICSC2, 0x06); /* Initialization of the ICS control register 2 */
while(!ICSSC_OSCINIT) { /* Wait until the initialization of the external crystal oscillator is completed */
}
/* ICSSC: DRST_DRS=1,DMX32=1 */
clrSetReg8Bits(ICSSC, 0x80, 0x60); /* Initialization of the ICS status and control */
while((ICSSC & 0xC0) != 0x40) { /* Wait until the FLL switches to Mid range DCO mode */
}
If i am connect with bdm and I go in stopmode3, after resume I have a correct clock. If I disconnect the bdm, clock changes. Why? Where I am wrong?
Thank you.
Roberto.