Activating The External Oscillator on QG8

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

Activating The External Oscillator on QG8

1,791 Views
Davo
Contributor II
I am trying to get a 32.768kHz watch crystal to oscillate on a QG8. However despite trying various ICS register options I have had no luck - the chip continues to run on the internal oscillator.  I know this as I can trim the oscillator and see a frequency change on a port I am using as a freq-out pin.
 
Here is the code I am using.  I have tried toggling HGO on and off as well. I am using FFL Engaged External (FEE) mode.

 lda    #%00000110     ;Set EREFS and ERCLKEN
  sta   rICSC2
  lda   #%00000000
  sta   rICSC1
With a 32,768Hz crystal this equals a bus clock of 8,388,608 Hz.
Advice appreciated.
 
Davo
Labels (1)
0 Kudos
4 Replies

242 Views
tonyp
Senior Contributor II
It could be because you're not waiting for the oscillator to start (BRCLR instruction) that the switch isn't made.

I use this code and it works:

mov       #%00000110,ICSC2
brclr     OSCINIT.,ICSSC,*
mov       #%00000000,ICSC1

0 Kudos

242 Views
Davo
Contributor II
Tony, thanks for the advice. This works fine. 
 
Should I be in High Gain mode or Low Gain mode for a 32.768kHz crystal ?
0 Kudos

242 Views
tonyp
Senior Contributor II
That depends on what drive level your crystal requires.  In my case, it works as it was given to you (with HGO=0) which consumes less power.  I wouldn't set it to high-gain if I get a reliable oscillation otherwise.
0 Kudos

242 Views
Alban
Senior Contributor II
Hello,

32kHz crystals tend to oscillate easily and don't need the high gain.
Above 1MHz the story would differ and I would go for high gain.
Above 4MHz, I would not even wonder and switch the high gain straight away.

I though the datasheet would mention something like this.
Anyway, the user should see the stability of his/her oscillator and act accordingly.
Oscillators are not really part of the microcontroller part, but part of the analog world.

Alban.
0 Kudos