9 years, 10 months ago.

pll configuration pls any one suggest me a solution

#include "mbed.h"
//#define SYSCLK 96000000
#define EXTCLK 12000000
#define PLLCLK 288000000
#define PLLMULT (PLLCLK/2/EXTCLK)-1
Serial pc(USBTX,USBRX);
void initclock()
{
      pc.printf("in main\n");
      //LPC_SC->CLKSRCSEL =(1<<0); // initize main oscillator
                               
      pc.printf("BREAK 1\n");
      LPC_SC->PLL0CON&=~(1<<1);// /////////////DISCONNECT///////////////
      
      //FED SEQ
      LPC_SC->PLL0FEED =0xAA;
      LPC_SC->PLL0FEED =0x55;
     // while ((LPC_SC->PLL0STAT & (1<<25)) != 0x00);
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////    
      pc.printf("BREAK 2\n");                  /////////////disable previous pll///////////////
      LPC_SC->PLL0CON&=~(1<<0);              /////////DISABLE PLL0///////////////
      //FED SEQ
      LPC_SC->PLL0FEED =0xAA;
      LPC_SC->PLL0FEED =0x55;
      //while((LPC_SC->PLL0STAT &(1<<24))!=0x00);
      ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
       LPC_SC->CCLKCFG|=0;
       ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
       LPC_SC->CLKSRCSEL|=(1<<0); // initize main oscillator
       ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        
      pc.printf("BREAK 3\n");             
      LPC_SC->PLL0CFG = PLLMULT;        //CCLKCFG VALUE ARE SUBSTITUTED//
      //FED SEQ
      LPC_SC->PLL0FEED =0xAA;
      LPC_SC->PLL0FEED =0x55;
                                 //////////////set enable/////////////
    pc.printf("BREAK4\n");
    LPC_SC->PLL0CON|=(1<<0);
    LPC_SC->PLL0FEED =0xAA;
    LPC_SC->PLL0FEED =0x55;
    //while((LPC_SC->PLL0STAT &(1<<24))==0x00);
  
     pc.printf("BREAK 5\n");
     LPC_SC->CCLKCFG |= (2<<0); /// 96Mhz setting divided by 3 (288/3);
      LPC_SC->PLL0FEED =0xAA;
      LPC_SC->PLL0FEED =0x55; ///setting dsiv value and checking if its locked to desired frequency;
     while(LPC_SC->PLL0STAT &(1<<26)==0x00);
   
                              /////////////////////////CONNECT PLL0/////////////////////////
         pc.printf("BREAK6\n");
         LPC_SC->PLL0CON|=(1<<1);
         LPC_SC->PLL0FEED =0xAA;
         LPC_SC->PLL0FEED =0x55;
        while(LPC_SC->PLL0STAT &(1<<25)==0x00);
      ///  SystemCoreClockUpdate();
                 
               }
               
                 ///////////PRINTING D VALUE////////////////////////
         int main()
         {
             initclock();
            // wait(1);
         pc.printf("HI\n");
         pc.printf("PLL0CON =0x%08X\n",LPC_SC->PLL0CON);
         pc.printf("PLL0STAT=0x%08X\n",LPC_SC->PLL0STAT);
         pc.printf("PLLCLK =0x%08X\n",LPC_SC->CCLKCFG);
         int value=LPC_SC->PLL0STAT&0x7FFF;
         pc.printf("value %d\n",value);
         ////SystemCoreClockUpdate();
         pc.printf("%d",SystemCoreClock);
  }

i have two challenges here hi i am trying to print the message in the initclock(); but the messages areNOT gettin printed but in the mainloop i get the values printed, and systemcoreclock at 96000000Mhz but if i change CCLKDIV (ie CCLKCFG to 3 and other values ill get junk values ,) can any one suggest me what could be done...

Be the first to answer this question.

Assigned to Ashok K 9 years, 10 months ago.

This means that the question has been accepted and is being worked on.