32kHz External Clock Source for HCS08

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

32kHz External Clock Source for HCS08

Jump to solution
938 Views
Smiffytech
Contributor III

Firstly, a confession: until recently, I regarded clock generation as a Black Art and, whilst quite happy with the concept of clock division, could not get my head around FLL/clock multiplication. That is, until I read this article: http://blogs.freescale.com/2012/08/20/the-bare-metal-enthusiast-winding-the-clock/ 

Reading this made the FLL concept a lot clearer, and left me only slightly flummoxed

 

Having a quick search, I have found that I can clock a Kinetis part using the EXTAL32 pin to feed a 32kHz into the clocking system. Can I achieve the same with HCS08 (specifically, MC9S08AC128,) with only the EXTAL pin?

 

My reason for asking is that I would like to run a high-accuracy RTC, using a DS32KHZ TCXO as the clock source.

Labels (1)
Tags (2)
0 Kudos
Reply
1 Solution
563 Views
Derrick
NXP Employee
NXP Employee

Hi Mathew,

I'm happy to help remove the veil of mystery surrounding MCU clock generation. :smileyhappy:

In the MC9S08AC128 Reference Manual (Rev. 3, 09/2008), section 10.5.2 provides an example that uses an external 32kHz crystal.  We can use this setup for an external 32kHz oscillator (i.e., connected to the EXTAL pin) by changing the REFS bit to 0 in order to select the external clock.  So ICGC2 = 0x18.  As shown in the example, leaving ICGC2 = 0x00 will result in a bus frequency of 4.19MHz.

If you want to run faster, you can get the bus speed up to 18.874368MHz (almost the 20MHz maximum) by changing N to 18 (i.e., MFD = 7 in ICGC2).  This translates to setting ICGC2 = 0x70.

Best Regards,

Derrick

View solution in original post

0 Kudos
Reply
2 Replies
563 Views
Smiffytech
Contributor III

Excellent, thanks Derrick! It's starting to make sense now. Now that I know it's do-able from a hardware standpoint, I'll have a play around with Processor Expert and see what it all looks like. (I'm finding it easier to let PE do the hard work, then try to make sense of what it's done.)

0 Kudos
Reply
564 Views
Derrick
NXP Employee
NXP Employee

Hi Mathew,

I'm happy to help remove the veil of mystery surrounding MCU clock generation. :smileyhappy:

In the MC9S08AC128 Reference Manual (Rev. 3, 09/2008), section 10.5.2 provides an example that uses an external 32kHz crystal.  We can use this setup for an external 32kHz oscillator (i.e., connected to the EXTAL pin) by changing the REFS bit to 0 in order to select the external clock.  So ICGC2 = 0x18.  As shown in the example, leaving ICGC2 = 0x00 will result in a bus frequency of 4.19MHz.

If you want to run faster, you can get the bus speed up to 18.874368MHz (almost the 20MHz maximum) by changing N to 18 (i.e., MFD = 7 in ICGC2).  This translates to setting ICGC2 = 0x70.

Best Regards,

Derrick

0 Kudos
Reply