qe32 - ics

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

qe32 - ics

Jump to solution
619 Views
roberto_m
Contributor III

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:smileywink:

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.

Labels (1)
0 Kudos
1 Solution
361 Views
roberto_m
Contributor III

Solved.

I forget to set EREFSTEN = 1. If this option is set, crystal, keeps going on, after mcu enters in stop mode.

Thank you bigmac.

Roberto 

View solution in original post

0 Kudos
4 Replies
361 Views
bigmac
Specialist III

Hello Roberto,

 

How do you ascertain that the bus frequency has altered when you remove the Multilink?  The bus frequency cannot be determined from the RTC module, since this makes use of the internal reference source.

 

It would be expected that the internal reference frequency will differ between BDM and normal operating mode.  But this would not affect the bus frequency for FEE mode.  An excerpt from the Reference manual:

 

ICS Trim Register (ICSTRM)

Note: TRIM is loaded during reset from a factory programmed location when not in BDM mode. If in a BDM

mode, a default value of 0x80 is loaded.

 

Regards,

Mac

 

0 Kudos
361 Views
roberto_m
Contributor III

Hi Bigmac.

 

I'm using a TPM module, and tpm overflow to genrate a clock on a pin (bus clock is the clock source for tpm, in my case). I made some calculus and set an appropriate "modulo". When I am in bdm mode the clock works as I expected. If I am not in bdm mode it doesn't work as I expected.

Roberto

0 Kudos
361 Views
roberto_m
Contributor III

If I use an external crystal as reference, why I have to set up the trim?

Thank you.

0 Kudos
362 Views
roberto_m
Contributor III

Solved.

I forget to set EREFSTEN = 1. If this option is set, crystal, keeps going on, after mcu enters in stop mode.

Thank you bigmac.

Roberto 

0 Kudos