Beginner Lab 4: Clock System Configuration

Last modified by Microchip on 2026/06/26 07:35

Objective

  1. The objective of this laboratory exercise is to understand the microcontroller clock system, including oscillators, the Phase-Locked Loop (PLL), Generic Clock Controller (GCLK), Digital Frequency Locked Loop (DFLL), main clock and peripheral clock distribution.
  2. This lab will demonstrate how different clock sources impact system timing and peripheral performance.
  3. Perform this exercise using MPLAB® X IDE as the development environment and the PIC32CM LS00 Curiosity Nano+ Touch Evaluation Kit as the hardware platform.

Overview

This lab introduces the clock system architecture of a microcontroller, emphasizing the roles of the oscillator, PLL, GCLK, DFLL, main clock and peripheral clock distribution. The exercise starts by exploring various clock sources, specifically comparing the internal oscillator with an external crystal. It examines how each source influences system stability and accuracy, using MPLAB X IDE on the PIC32CM LS00 Curiosity Nano+ Touch Evaluation Kit.

Lab Activities

  • Configure the SysTick timer using the configuration options and configure an LED using the pin configuration in MPLAB X IDE.
  • Configure the clock system to use the internal oscillator and verify the system clock settings.
  • Reconfigure the clock system to use an external crystal oscillator to generate the clock frequency.
  • Add the application code to the generated project to toggle the LED using a SysTick timer-based delay.
  • Observe and compare the effect of internal and external clock sources on SysTick timing accuracy by connecting Logic Analyzer Channel 0 to the LED output pin.

Expected Outcomes

Upon completion of this lab, you will be able to:

  • Configure the SysTick timer and General Purpose Input/Output (GPIO) pins using the available configuration options in MPLAB X IDE.
  • Set up and verify the system clock operation using both the internal oscillator and an external crystal oscillator as clock sources.
  • Implement delays based on the SysTick timer to control LED toggling through application code.
  • Measure and analyze the timing accuracy of the SysTick timer on the PIC32CM LS00 Curiosity Nano+ Touch Evaluation Kit using a logic analyzer with both internal and external clock sources.
  • Compare the performance and accuracy of internal and external clock sources, and evaluate their impact on overall system timing behavior.

Lab Source Files and Solutions

This ZIP file contains the completed solution project for this lab. It also contains the source files needed to perform the lab as per the following step-by-step instructions (see the "Lab Index" section on this page).

Download the ZIP file for this lab.

Information

The contents of this ZIP file need to be placed in the following folder:

<Any directory of user's choice>/
(example Directory = C:/microchip/harmony/v3)
Note:

  1. The project location of an MPLAB Harmony v3 project is independent of the location of the MPLAB Harmony Framework path (in other words, there is no requirement to create or place an MPLAB Harmony v3 project in a relative path under the Harmony v3 framework folder). The project can be created or placed in any directory of your choice.
  2. The point above is true because when created, an MPLAB Harmony v3 project generates all the referenced source and header files and libraries (if any) under the project folder.

Back to Top

Lab Index

Back to Top

Back to Top