MC9S12DT128 CRG problem

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

MC9S12DT128 CRG problem

888 Views
BMSwei
Contributor I

void INIT_PLL(void)

{

    CRGINT = 0;         

    CLKSEL_PLLSEL = 0;       

      PLLCTL_PLLON = 0;          

    SYNR = 0x03;

    REFDV = 0xc2;                 

    PLLCTL_PLLON = 1;     

    PLLCTL_AUTO = 1;           

    while (CRGFLG_LOCK == 0);   

    CLKSEL_PLLSEL = 1;        

}

 

this is the code of the Initialization of PLL in MC9s12DT128 ,but the program is not working.Please help...

 

Labels (1)
Tags (3)
0 Kudos
3 Replies

609 Views
kef
Specialist I

You should first explain what is relation between "program is not working" and "CRG problem". Does your INIT_PLL() hang waiting forever for LOCK==1? If so, then probably something is wrong with PLL filter circuit. It could be no PLL components installed, soldering problems or bad PLL filter components.

609 Views
BMSwei
Contributor I

yeah   yeah ,the problem is the INIT_PLL() hang waiting forever for LOCK==1,program can not continue to run ,and if CLKSEL_PLLSEL = 0,not use the PLL ,the program can run normally. 

0 Kudos

609 Views
RadekS
NXP Employee
NXP Employee

Your INIT_PLL function looks more-less correct, however:

Your value of REFDV is strange. REFDV register contains bits in lower half of byte.

Could you please specify oscillator/crystal frequency, expected bus clock, Oscillator connection (page 66 in RM), XCLKS (PE7) pin level and XFC loop filter connection (page 64 in RM)?

  In attachment you can find PLL calculator and PLL filter calculator for S12 MCUs (with CRG module).

0 Kudos