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...
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.
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.
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).