You are not logged in

Log in into our community

Log in so you acess some hidden content

* Fields are required.

Register into our community!

Sign up now for some good content

* Fields are required.

Lost something?

Enter your username or email to reset your password.

* Fields are required.

MCU Clock

Posted on : Fri , 02 2014 by : virusi

THEORY ON MCU CLOCK :


Clock is the heart of the microcontroller. It is impossible for the microcontroller to function without the clock. Depending on the Clock frequency that can be applied to the microcontroller depends how many instruction can be executed in a timeframe. So let’s take a look at different clock sources that can be applied to a microcontroller. Be aware that not to all microcontroller can be applied the featured described, if you to check if your microcontroller supports this type of clock source than you should check your microcontroller datasheet.

MCUClock_example
Fig. 1 Clock generation for LPC17xx

Fig 1 shows the block diagram of the clock generation for LPC17xx but this can be applied to almost all microcontrollers. As you can see from the Fig. 1 there are three independent oscillators. These are the Main Oscillator(osc_clk) , the Internal RC oscillator(rtc_clk) and the RTC(rtc_clk) oscillator. Each oscillator can be used for more than one purpose as required in a particular application. If you are interested in different oscillator configuration than click here.

Internal RC oscillator :

The Internal RC Oscillator (IRC) may be used as the clock source for the watchdog timer, and/or as the clock that drives PLL0( Phase Locked Loop 0 ) and subsequently the CPU. The precision of the IRC does not allow for use of the USB interface, which requires a much more precise time base in order to comply with the USB specification. Also, the IRC should not be used with the CAN1/2 block if the CAN baud rate is higher than 100 kbit/s. The nominal IRC frequency is 4 MHz.

Upon power-up or any chip reset, the LPC17xx uses the IRC as the clock source. This allows systems to operate without any external crystal, and allows the boot loader code to operate at a known frequency. Software may later switch to one of the other available clock sources.

Main oscillator :

The main oscillator can be used as the clock source for the CPU, with or without using PLL0. The main oscillator operates at frequencies of 1 MHz to 25 MHz. This frequency can be boosted to a higher frequency, up to the maximum CPU operating frequency, by the Main PLL (PLL0). The oscillator output is called OSC_CLK.

The on-board oscillator in the LPC17xx can operate in one of two modes: slave mode and oscillation mode.

In slave mode the input clock signal should be coupled by means of a capacitor of 100 pF, with amplitude between 200 mVrms and 1000 mVrms. This corresponds to a square wave signal with a signal swing of between 280 mV and 1.4 V. The XTAL2 pin in this configuration can be left unconnected.

IRC_slaveMode
Fig.2 IRC in slave mode

External components and models used in oscillation mode are shown in Fig. 3. Since the feedback resistance is integrated on chip, only a crystal and the capacitances CX1and CX2need to be connected externally in case of fundamental mode oscillation (the fundamental frequency is represented by L, CL and RS). Parameters FC, CL, RS and CP are supplied by the crystal manufacturer.

IRC_oscilationmode
Fig.3 IRC in oscillation mode

RTC oscillator :

The RTC oscillator provides a 1 Hz clock to the RTC and a 32 kHz clock output that can be used as the clock source for PLL0 and CPU and/or the watchdog timer. The RTC oscillator must not be used as a clock source when the PLL0 output is selected to drive the USB controller. In this case select the main oscillator as clock source for PLL0.

PLL0 Phase Locked Loop 0 :

The PLL input, in the range of 32 kHZ to 50 MHz, may initially be divided down by a value “N”, which may be in the range of 1 to 256. This input division provides a greater number of possibilities in providing a wide range of output frequencies from the same input frequency.

Following the PLL input divider is the PLL multiplier. This can multiply the input divider output through the use of a Current Controlled Oscillator (CCO) by a value “M”, in the range of 6 through 512. The resulting frequency must be in the range of 275 MHz to 550 MHz. The multiplier works by dividing the CCO output by the value of M, then using a phase-frequency detector to compare the divided CCO output to the multiplier input. The error value is used to adjust the CCO frequency.

There are additional dividers at the output of PLL0 to bring the frequency down to what is needed for the CPU, peripherals, and potentially the USB subsystem.

So depending on your application you should use different types of oscillators. Before you configure the oscillator you should check what microcontroller’s functions you will use because if you will use the usb you will have to use main oscillator with the PLL0 activated. Be aware that after reset the MCU uses IRC until it is switched by the application.

Last updated on Mon , 03 2014
SHARE THIS PAGE :

7 comments on "MCU Clock"

  1. Nikole says :

    Your style is very unique compared to other people I’ve read stuff from.
    Thank you for posting when you have the opportunity, Guess I will just
    book mark this page.

    Here is my homepage :: jquery google api

  2. Tommie Latini says :

    You have made some decent points there. I looked on the internet to find out more about the issue and found most individuals will go along with your views on this website.

  3. Niklas says :

    I am really impressed with your writing skills and also with the layout on your weblog.

    Is this a paid theme or did you modify it yourself? Either
    way keep up the nice quality writing, it is rare to see a nice blog like this one today.

    Here is my homepage :: web page (Fredrick)

  4. Stewart says :

    Thanks for sharing your thoughts about microcontroller clock.
    Regards

    Take a look at my web site; bangalore to mysore car rental

  5. Johanna says :

    This is really interesting, You are a very skilled blogger.

    I have joined your rss feed and look forward to seeking more of your fantastic post.
    Also, I have shared your web site in my social networks!

    my web-site; seo

  6. Harlan says :

    I needed to thank you for this wonderful read!! I definitely loved every little bit of it.
    I’ve got you bookmarked to look at new things you post…

    My homepage :: dvd ripper tools (Leandra)

  7. Merri says :

    Hey there would you mind letting me know which hosting company
    you’re utilizing? I’ve loaded your blog in 3 different web
    browsers and I must say this blog loads a lot quicker
    then most. Can you suggest a good hosting provider
    at a reasonable price? Cheers, I appreciate it!

    Visit my web-site – web page (Darrin)

Share and Leave a comment.

You must be logged in to post a comment.

Back to Top