Order to turn on the crystal oscillator and setup to run on PLL0

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

Order to turn on the crystal oscillator and setup to run on PLL0

807 Views
safiullah_hussa
Contributor III

Hi,

I wanted to know what are the correct order of setup to utilize the crystal oscillator and the PLL0 on LPC55S69.

My code looks like this

 //Declarations
 pll_setup_t pll0_setup;
 pll_config_t pll0_config;
 pll_error_t pll0_error;
   // Init board hardware.
    BOARD_InitBootPins();
    BOARD_InitBootClocks();
    BOARD_InitBootPeripherals();
   // Init FSL debug console.
    BOARD_InitDebugConsole();
    // Setting up the Clock to run from external oscillator and PLL0
 CLOCK_AttachClk(kFRO_HF_to_CTIMER0);
    CLOCK_AttachClk(kEXT_CLK_to_PLL0);
 pll0_config.desiredRate = 96000000;
 pll0_config.flags = PLL_CONFIGFLAG_FORCENOFRACT;
    pll0_error = CLOCK_SetupPLL0Data(&pll0_config, &pll0_setup);
    if (!pll0_error){
     while(1);
    }
    pll0_error = CLOCK_SetupPLL0Prec(&pll0_setup, PLL_SETUPFLAG_WAITLOCK);
    if (!pll0_error){
         while(1);
    }
    CLOCK_AttachClk(kPLL0_to_CTIMER0);
    CLOCK_AttachClk(kPLL0_to_MAIN_CLK);
    PRINTF("Configuring Timer 0...\n");

Is this correct?

Regards, 

Safi 

Labels (2)
0 Kudos
2 Replies

710 Views
soledad
NXP Employee
NXP Employee

Hi, 

I'd highly recommend you to use the MCUXpresso Config Tool to configure the clock, as the tool provides a graphical interaction interface to help the developer to do it.

MCUXpresso Config Tools|Software Development for NXP Microcontrollers (MCUs)|NXP

Have a great day,
Sol

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

710 Views
safiullah_hussa
Contributor III

Thanks soledad,

The tool is really helpful.

Regards,

Safi

0 Kudos