HCS08 External Clock Problem

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

HCS08 External Clock Problem

916 Views
sctang
Contributor I

Hello,

I am going to test HCS08QG with a 10MHz external oscillator (Murata CSTCE10M0G55 Resonator) .

However I found the bus frequency is 9.118MHz by measuring the pulse width of PTA0.

I also found that CLKST = 00 (Output of FLL is selected.)

I am wondering whether the code or the hardware has problem. I also tried to remove the resonator, but the bus frequency is the same.

The complete code of the external clock test is following:

******************************************************************************************

            INCLUDE 'derivative.inc'
            XDEF _Startup
            ABSENTRY _Startup
            ORG    RAMStart
            ORG    ROMStart
_Startup:
            LDHX   #RAMEnd+1        ; initialize the stack pointer
            TXS
            CLI                     ; enable interrupts
Initialization:
      LDA #%01000000                         ;disable COP and STOP
      STA SOPT1                                     ;disable COP and STOP
      MOV #%10000000,ICSC1            ;Select External Clock
      MOV #%00111100,ICSC2            ;Select External Clock
Port_Init:
      MOV #%11111111,PTADD           ;Set PTA Data Direction          
      MOV #%11111111,PTBDD           ;Set PTB Data Direction
mainLoop:
      MOV #%00000001,PTAD   ;Set PTA0=1
      MOV #%00000000,PTAD   ;Set PTA0=0
      MOV ICSSC,PTBD        ;Move ICSSC to PTBD
      MOV #%00000000,PTBD   ;Set PTB=$00
      BRA mainLoop       
spurious:                           ; placed here so that security value
            NOP                     ; does not change all the time.
            RTI

            ORG   $FFFA
            DC.W  spurious          ;
            DC.W  spurious          ; SWI
            DC.W  _Startup          ; Reset
******************************************************************************************

 

Please advise.

Thanks

sctang

Labels (1)
0 Kudos
2 Replies

338 Views
gaminn
Contributor IV

I initialize my SH4 with 40 MHz external oscillator (FBELP mode) by this code:


ICSC1 = 0b10000000;
ICSC2 = 0b00101010;

 

And it works. Does your oscillator have sufficiently high output voltage? I mean if the logic one of the oscillator is enough to be logic 1 for your MCU.

 

Martin

0 Kudos

338 Views
sctang
Contributor I

Hi Martin,

Thank you for you reply.

Actually, I use a 3-pin resonator (Murata CSTCE10M0G55 Resonator) rather than a square wave clock source.

sctang

0 Kudos