MC9S08SH8 external clocksource

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MC9S08SH8 external clocksource

1,599件の閲覧回数
mnemonic
Contributor III

Hello!

 

I use a 12Mhz external crystal on MC9S08SH8 device. But it seems that the Busclock is devided by two. How can I use the full 12Mhz as busclock? Please look at my configuration for ICSC1 and ICSC2

 

ICSC1 is configured as CLKS 10, RDIV 000, IREFS 0, IRCLKEN 0, IREFSTEN 0

ICSC2 is configured as BDIV 00, RANGE 1, HGO 1, LP 0, EREFS 1, ERCLKEN 1, EREFSTEN 1

 

I wrote a small testroutine for SCI module. It only work correctly with BR Factor HEX 27. So Busclock must be ~6Mhz.

 

code:

 

_Startup:
            LDHX   #RAMEnd+1        ; initialize the stack pointer
            TXS
            CLI                     ; enable interrupts
            lda #%00000011          ; Watchdog off,Stopmode off, Resetpin enabled, BDM enabled
            sta SOPT1
            lda #%10000000          ; use external crystal
            sta ICSC1
            lda #%00110111
            sta ICSC2
            jsr delay1              ; external Clocksource needs some time.
            jsr SCI_init

 

Can anyone tell me how to use 12Mhz external crystal/12Mhz Buscklock(or more)?

 

Thanks!

 

 

ラベル(1)
0 件の賞賛
返信
5 返答(返信)

655件の閲覧回数
tonyp
Senior Contributor II

I don't know about the SH8 in particular, but if its ICS module behaves like most other members:

 

There is no RDIV setting to bring the 12MHz crystal down to within a 31.25-39.0625KHz range so that you use the FLL to multiply it again to some higher value.  You can only use it as is.  Which means, you cannot do better than crystal/2 for bus.  If you're stuck with this crystal, you're stuck with this bus.

 

But, if a bus clock of 12MHz is what you're interested in, you can also achieve this with a 24MHz crystal (without the FLL), or (with the FLL, CLKS=00), you'll need (for example) a 4MHz crystal divided down to 31.25KHz (RDIV=7 - divide by 128) and FLL=1536 (DRS=10, DMX32=0) and BDIV=01 (/2 - reset default).  Or, an 8MHz crystal with the RDIV setting for /256, or a 2MHz, or a 1MHz with similar adjustments.

 

PS. I just looked at the SH8 datasheet and the FLL seems to be fixed at 1024xReference.  So, my suggestions won't work for you.  The FLL output can only go between 32MHz and 40MHz which does not have a direct (2^n) division to get the 12MHz.

 

Message Edited by tonyp on 2009-12-20 07:16 PM
0 件の賞賛
返信

655件の閲覧回数
mnemonic
Contributor III

Thanks tonyp!

 

I understand what you writing. I am working on an RS485 Bus system and need a very stable and precise Busclock for my nodes. At this moment I do not know 6Mhz is enouch for Busclock. But I will see this at development. If I will get problems I will find another way. Crystals on SH8 Controllers should not bigger than 16Mhz. If I will use an Oscillator I think I can choose this up to 40Mhz.

 

I am not shure what I should use for such an application. I think an external source would be the best solution. What do you think about?

 

Thanks a lot!

 

  

0 件の賞賛
返信

655件の閲覧回数
tonyp
Senior Contributor II

I think for a typical RS485 system you can get by with the internal oscillator's stability (when trimmed).  Unless your specific application has special timing requirements.

 

Also, if you must use a crystal, you can use a 1, 2, 4, or 8 MHz crystal and the FLL to get 32MHz (16MHz bus).

 

Or, use the internal reference (trimmed for 39.0625KHz) to get 40MHz (20MHz bus).

 

0 件の賞賛
返信

655件の閲覧回数
peg
Senior Contributor IV

Hello,

 

Indeed, I have thousands of '485 networks based on Freescale processors running on their internal oscillators without problem. You must have some special timing requirements for them to be insufficient.

 

0 件の賞賛
返信

655件の閲覧回数
mnemonic
Contributor III

Hello Peg!

 

I have no special timing requirement. But I think its better to use an erternal. Then I can be sure to get no problems between the nodes. All of the nodes will then have same busclock and its very easy to use an crystal.

 

 

Thank you!

 

 

0 件の賞賛
返信