LM3S1138 Getting Started 7, PLL (Phase-Locked Loop) Setting System Clock

Publisher:JoyfulSpirit5Latest update time:2016-11-01 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
After the program is running, first set the LDO voltage to 2.75V. The key point is: you must first set the LDO voltage to 2.75V, remember! Then configure the PLL output to 50MHz as the system clock.

After using PLL, the CPU running speed is greatly increased, but the power consumption will also increase significantly. Therefore, the use of PLL should be limited in low-power applications.

Main function:

#include  "LED.H"
#include 
#include 
#include 
#include 
#include 
#include 


// Define longer identifiers as shorter forms
#define SysCtlPeriEnable SysCtlPeripheralEnable
#define SysCtlPeriDisable SysCtlPeripheralDisable
#define GPIOPinTypeIn GPIOPinTypeGPIOInput
#define GPIOPinTypeOut GPIOPinTypeGPIOOutput


//  定义KEY
#define  KEY_PERIPH             SYSCTL_PERIPH_GPIOG
#define  KEY_PORT               GPIO_PORTG_BASE
#define  KEY_PIN                GPIO_PIN_5


// Prevent JTAG from failing
void JTAG_Wait(void)
{
    SysCtlPeriEnable(KEY_PERIPH); // Enable the GPIO port where KEY is located
    GPIOPinTypeIn(KEY_PORT, KEY_PIN); // Set the pin where KEY is located to input

    if ( GPIOPinRead(KEY_PORT , KEY_PIN) == 0x00 ) // If KEY is pressed during reset, enter
    {
        for (;;); // Infinite loop to wait for JTAG connection
    }

    SysCtlPeriDisable(KEY_PERIPH); // Disable the GPIO port where KEY is located
}


// Define the global system clock variable
unsigned long TheSysClock = 12000000UL;


//  延时
void  Delay(unsigned long  ulVal)
{
    while ( --ulVal  !=  0 );
}


// System initialization
void SystemInit(void)
{
    SysCtlLDOSet(SYSCTL_LDO_2_75V); // Set the LDO voltage to 2.75V before configuring PLL

    SysCtlClockSet(SYSCTL_USE_PLL | // System clock setting, using PLL
                   SYSCTL_OSC_MAIN | // Main oscillator
                   SYSCTL_XTAL_6MHZ | // External 6MHz crystal oscillator
                   SYSCTL_SYSDIV_4); // The frequency division result is 50MHz

    TheSysClock = SysCtlClockGet(); // Get the system clock, unit: Hz

    LED_Init(LED2 | LED3); //LED initialization
}


int main(void)
{
    JTAG_Wait(); // Prevent JTAG failure, important!

    SystemInit(); // System initialization

    LED_On(LED2); // Turn on LED2
    LED_Off(LED3); // Turn off LED3

    for (;;)
    {
        LED_Toggle(LED2 | LED3);
        Delay(150 * (TheSysClock / 4000)); // Delay about 150ms
    }
}

Reference address:LM3S1138 Getting Started 7, PLL (Phase-Locked Loop) Setting System Clock

Previous article:LM3S1138 Getting Started 8, Soft Reset
Next article:LM3S1138 Getting Started 6, System Clock Settings

Recommended ReadingLatest update time:2024-11-17 00:07

Power management design based on PLL technology
summary Phase-locked loops (PLLs) are the basic building blocks of modern communication systems. PLLs are commonly used in radio receivers or transmitters, primarily providing the "local oscillator" (LO) function; they can also be used for clock signal distribution and noise reduction, and are increasingly used
[Power Management]
Power management design based on PLL technology
Freescale S12x series PLL settings
pll :Phase Locking Loop  In the MC9S12XDP512 microcontroller I use Setting up the pll is very simple: CLKSEL = 0x00; //Set the current fBUS to use an external crystal PLLCTL = 0xe1; //Set to enter PLL setting mode //PLL calculation: //fPLL= 2*fOSC*(SYNDIV + 1)/(REFDIV + 1), // fBUS = fPLL/2 //where fOSC is th
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号