Lesson 11: System Clock Setting

Every microcontroller needs clock signals. Clock signals are connected to all the components inside of a microcontroller, such as CPU, memory systems, digital and analog peripherals. They govern the speed at which the processor executes instructions, the data transfer rate of serial communication signals, the speed of the timer, the synchronous signal for parallel communication protocols, and so much more.

The clock source comes in the form of an oscillator. Most microcontrollers have internal oscillators and optional connections for external crystal oscillators.

  • Internal Oscillators are typically R-C oscillators. R-C oscillators are easy to implement, but they are not precise and can be affected by temperature, noise, and voltage. Usually, the internal oscillators are used for producing lower frequencies.
  • External Oscillators provide a more accurate, stable, and fixed frequency at the output. If you need an external oscillator, you need to make sure that your oscillator can be supported by the microcontroller by checking the microcontroller's datasheet.

Most microcontrollers have Phase-Lock-Loop (PLL) circuits to provide different clock frequencies that can be adjusted by software.

EK-TM4C123GXL LaunchPad

MainClockTree 123G s

Clock System

There are multiple clock sources for use in the TI TM4C123GXL Tiva C LaunchPad. Some of these sources are external while most clock sources are internal.

  • Main Oscillator (MOSC)
    • Primary external source.
    • Can be used to drive the internal 400 MHz PLL.
    • TI TM4C123GXL Tiva C LaunchPad comes with a 16 MHz onboard crystal connected to MOSC.
    • Needed to clock the 480 MHz USB PLL unit.
  • Precision Internal Oscillator (PIOSC)
    • This oscillator is an on-chip 16 MHz with 1% accuracy and 3% accuracy over temperature that is the clock source the microcontroller uses during and following POR (Power-on Reset).
    • Can be used to drive the internal 400 MHz PLL.
    • Can clock internal peripherals like ADC blocks, ...
  • Low-Frequecncy Internal Oscillator (LFIOSC)
    • Typical clock frequency 30 KHz with 50% accuracy.
    • This oscillator is intended for use during Deep-Sleep power-saving modes.
    • Can be used when either or both MOSC and PIOSC are powered down.
    • Not suitable for accurate time-based operations.
  • Hibernation Module Clock Source
    • This oscillator is intended to provide the system with a real-time clock source and may also provide an accurate source of deep sleep or Hibernate mode power saving.
    • TI TM4C123GXL Tiva C LaunchPad comes with a 32.768 KHz onboard RTC crystal.
    • This oscillator can be used for the system clock.

All of the aforementioned sources can be system clock sources. PIOSC should never be disabled unless needed and that is because if MOSC is used and it fails for some reason, PIOSC will take over the role of providing a clock signal.

400 MHz Phase-Lock-Loop (PLL)

TM4C123 comes with an internal 400 MHz PLL that can generate clock frequencies from 3.12 MHz to 80 MHz. It can be driven by two sources only:

  • Precision Internet Oscillator (PIOSC)
  • Main Oscillator (MOSC)

After power-on-reset, the default system clock frequency is 16 MHz.

The 80 MHz is the top operating clock speed for the TM4C123x microcontroller.