MC9S08QG8 clocks generation from internal reference

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

MC9S08QG8 clocks generation from internal reference

3,546 Views
Tomik
Contributor I
Hi everybody,
I have 1 question about clock generation in MC9S08QG8 MCU. I set ICSC registers to clocks generation on output of PLL with internal reference. The clocks have the maximum value for this case, the divider is set to 1. One small problem is the difference between clock value after flashing and the value after switch off and on. Immediate after flashing the MCU, the bus clock value is 8 MHz, but after switch off and switch on the MCU, the value of bus clock changes 9 MHz. This value keeps until next flashing of MCU. The switching off and on has no effect on the 9 MHz value of the bus clock.
I would like to know, if I did some mistake in the program code, or if it is some bug of this MCU. I have to note, that I have this experience on two pieces of this MCUs with different programs and in both cases there was the same differencies in bus clock values after flashing and after switching.

Message Edited by Tomik on 2006-10-0505:07 AM

Labels (1)
0 Kudos
Reply
7 Replies

1,360 Views
Alban
Senior Contributor II
Dear Tomik,
 
Freescale MCUs with an Internal Clock Generator module (ICG) usually include a trimming capability.
The Internal RC oscillator can vary with fabrication process. The trimming allow users to get always the target frequency precisely.
 
Also usually, the programming tool do the trimming and store the trimming value in Flash.
 
However, usually again, the trim value is not loaded into REGISTER automatically after RESET.
 
So what probably occurs is that the ICG is trimmed and value adjusted when you Flash.
After pressing Reset you lose the TRIM and get a different reference clock which multiplied by the FLL/PLL, amplifies the difference.
 
Look in the datasheet for "TRIM" and usually (the last one for this post, I promise) you just need to write one line to load the value from FLASH to REGISTER.
 
Cheers,
Alban. {usually}
0 Kudos
Reply

1,360 Views
NormanB
Contributor I
A further question on the trimming of the QG8.  The internal 32kHz osc can be trimmed from 32 to 38kHz in order that a wide range of internal bus frequencies can be obtained.  I use a USB Multilink to program QG8's and use the "PT" command in the CFG file to enable auto-trim of the devices (I use PE Micro's CPROGHCS08).
 
But, how does the Multilink know what frequency to trim to - that depends on the desired bus frequency?
0 Kudos
Reply

1,360 Views
peg
Senior Contributor IV
Hello and welcome Norman,

Please refer to this old post for this info.

0 Kudos
Reply

1,360 Views
peg
Senior Contributor IV
And usually you check if the value in flash is not "erased state" first.
 
Regards
David
 
0 Kudos
Reply

1,360 Views
Alban
Senior Contributor II
Oh Yes indeed otherwise instead of middle it will be max value for the TRIM !
 
It's very good to have usually good Contributors here to spot these :smileyvery-happy:
 
Alban.
0 Kudos
Reply

1,360 Views
Tomik
Contributor I
Thanks all for help.
The problem is solved. I'm using Pemicro USB Multilink for burning. While burning process, the multilink writes the TRIM value both to the ICSTRM register and to the nonvolatile flash register on the adress 0xFFAF. So, after power on the MCU, I read the value from the nonvolatile register and write it to ICSTRM.
Everything is now OK. And I hope it will be in the next delivery of these MCUs :smileyhappy:
0 Kudos
Reply

1,360 Views
tonyp
Senior Contributor II
It must have something to do with the trim value.  The BDM pod possibly writes a different trim value than the one you write (if you write any at all).
0 Kudos
Reply