MPLAB® Harmony v3 Peripheral Libraries on PIC32CM GV-VL (Arm® Cortex®-M0+) MCUs: Step 6

Last modified by Microchip on 2025/09/29 12:51

Note: This video demonstrates how to compile the project, program the PIC32CM GV-VL Curiosity Nano board, and view the results in the terminal.

The PIC32CM GV VL Curiosity Nano+ Touch Evaluation Kit allows the Embedded Debugger (nEDBG) to be used for debugging. Connect the Type-A male to USB Type-C® cable to the debug USB port to power and debug the PIC32CM GV VL Curiosity Nano+ Touch Evaluation Kit.

PIC32CM GV VL Curiosity Nano+ Touch Evaluation Kit


In MPLAB® X IDE, navigate to File > Project Properties, and ensure that PIC32CM GV-VL Curiosity Nano EDBG is chosen as the debugger under Connected Hardware Tools, and XC32 (v4.60) is selected as the Compiler Toolchain for XC32.

Project Properties

 


Program your application to the device by clicking on the Make and Program button as shown in the accompanying image.

Make and Program button

Check whether the lab builds and programs successfully, and verify the build results in the output dialog box.


Now, open the Tera Term terminal application on your PC (from the Windows® Start menu by pressing the Start button). Select the Serial Port as shown in the accompanying image.

Tera Term terminal application

Note: If more than one COM port is connected, identify the correct COM port for the PIC32CM GV-VL Curiosity Nano+ Touch Evaluation Kit and use it for the serial terminal.


Once the COM port is connected, click on Setup > Serial port. In the Tera Term: Additional settings window that appears, change the baud rate to 115200, as shown in the accompanying image.

Setup > Serial port


You should see the LED toggling rate displayed on the terminal every 500 milliseconds.

LED toggling rate

Additionally, observe the LED toggling at a 500-millisecond interval on the PIC32CM GV-VL CNANO Board.

PIC32CM GV-VL CNANO Board


Press the SW200 switch on the PIC32CM GV-VL Curiosity Nano to change the default sampling rate to 1 second. You will also notice that the LED toggling interval has changed to 1 second.

PIC32CM GV-VL CNANO Board

Toggling Rate


Every subsequent pressing of the SW200 switch on the PIC32CM GV-VL CNANO Kit changes the default sampling rate to 2 seconds, 4 seconds, 500 milliseconds, and back to 1 second in cyclic order as shown in the accompanying image.

Toggling Rate

Back to Top

Results

You observed that the application toggled an LED on the development board every 500 milliseconds using the Real-Time Clock (RTC). A message indicating the current LED toggling rate was printed on the serial terminal through a Universal Synchronous Asynchronous Receiver Transmitter (USART) interface using STDIO. On pressing the user switch (SW200), the LED toggling rate dynamically changed in sequence to 1 second, 2 seconds, and 4 seconds, and then cycled back to 500 milliseconds. Every time the user switch was pressed, a corresponding message was displayed on the serial terminal reflecting the updated toggling rate. The LED toggled each time the RTC period elapsed, and the message was printed to the serial terminal using Standard Input/Output (STDIO).

Back to Top

Analysis

You have successfully created your first application using MPLAB Harmony v3 on a PIC32CM GV-VL CNANO microcontroller. Your application used all the fundamental elements that go into building a real-time application. Your application successfully toggled the LED periodically and displayed it periodically over a serial terminal on a PC. The application also took user input by pressing a switch on the development board.

In this application, you used MPLAB Code Configurator (MCC) to configure the PIC32CM GV-VL CNANO and also used the MPLAB Harmony v3 framework. You used the clock configurator to set up the CPU clock and timer (RTC) clock. You configured SERCOM 2 as USART, RTC, and External Interrupt Controller (EIC) Peripheral Libraries (PLIBs). You also configured the STDIO using the SERCOM 2 USART peripheral. You used the pin configurator to set up the pins for LED and switch functions.

Back to Top

Conclusions

This tutorial has equipped you with the necessary training to configure and utilize the essential components needed to build a real-time application on a PIC32CM GV-VL CNANO microcontroller with the MPLAB Harmony v3 framework. As your next step, you can customize this application and reconfigure some of the components used in this tutorial. Additionally, you have the option to add new components (PLIBs, etc.) to enhance this application to realize your end application.

Back to Top