donw

jm60: 4mhz clock initilise code for USB

Discussion created by donw on Aug 25, 2009
Latest reply on Sep 11, 2009 by William Lewis

I am trying to get a JM60 running with its USB port.bus must be 24mhz, MCGOUT = 48mhz.

my external xtal is 4.00mhz.

Is this initilise code correct?

(Especially Not sure about RDIV = 1 )


            MOV   #$36,MCGC2               
            MOV   #$08A,MCGC1     
_EntryPoint_L1E:   
            BRCLR 1,MCGSC,_EntryPoint_L1E      ; Wait until external reference is stable
_EntryPoint_L21:   
            BRSET 4,MCGSC,_EntryPoint_L21  ; Wait until external reference is selected
_EntryPoint_L24:                         ;Wait until external clock is selected as a bus clock reference
            LDA   MCGSC
            AND   #$0C
            CMP   #8
            BNE   _EntryPoint_L24 ;abs = 0024
 ; 
            MOV   #$3E,MCGC2                  

            MOV   #$08A,MCGC1        
            MOV   #$46,MCGC3 
            BCLR  3,MCGC2       
_EntryPoint_L37:   
            BRCLR 5,MCGSC,_EntryPoint_L37  ; while(!MCGSC_PLLST) Wait until PLL is selected
_EntryPoint_L3A:   
           BRCLR 6,MCGSC,_EntryPoint_L3A ; ;   while(!MCGSC_LOCK) Wait until PLL is locked
                                            
           MOV   #$0A,MCGC1                ; Set MCGC1 register
_EntryPoint_L40:   
           LDA   MCGSC            ;while((MCGSC & 0x0C) != 0x0C) Wait until PLL clock is selected as a bus clock reference
           AND   #$0C
           CMP   #$0C
           BNE   _EntryPoint_L40
                                          ; End of initialization code after reset
           RTS
 

Outcomes