Skip to content

This project comes preloaded on the PIC32CM6408PL10048 Curiosity Nano board and launches when the user first plugs it in. It contains three scenarios which can be alternated using a command sent through serial communication.

License

Notifications You must be signed in to change notification settings

microchip-pic-avr-examples/pic32cm6408pl10048-cnano-out-of-box-firmware-vscode-harmony

Repository files navigation

Microchip Technologies Inc.

Curiosity Nano Out-of-the-Box Code Using the PIC32CM6408PL10048 Microcontroller With MCC Harmony

The PIC32CM PL10 Curiosity Nano Out-of-Box (OOB) code example is useful for evaluating the PIC32CM PL10 family of microcontrollers. It shows core device functionality — including GPIO control, capacitive touch, mechanical switch input, and UART communication — using intuitive demonstrations that run immediately when the board is powered, and has been generated and developed using both VS Code and MPLAB® X IDE.

The OOB firmware includes three selectable programs, each highlighting a key peripheral or feature set of the PIC32CM-PL10 device. The system boots into Program 1 by default, and users can switch between programs using simple character commands over UART.

  • Program 1: LED blink demonstration (1-second interval, default behavior)
  • Program 2: User-adjustable LED blink speed controlled via touch button or mechanical switch
  • Program 3: UART-based 8-bit incrementing counter transmission triggered by button presses

Program selection is performed through the UART terminal by sending the inputs 1, 2, or 3. The input ‘0’ displays the program selection menu and resets all peripherals and variables to their default states.

Related Documentation

Software Used

Hardware Used

Block Diagram


Figure 1: Block Diagram

Setup

All peripheral and clock configurations for this example are generated using MPLAB® Code Configurator (MCC) inside Visual Studio Code for the PIC32CM6408PL10 microcontroller. The peripheral configuration is as per the table below.

Sr. No. Peripheral Configuration Usage
1 Clock Control Clock Source - HFINTOSC
Frequency - 24 MHz
Divider - 1
Clock Tuning - Enabled
GCLK0 Channel 8 – Enabled (SERCOM1)
GCLK0 Channel 9 - Enabled (TC0/TC1)
APBCMASK - 0x0C8CU
System Clock
2 SERCOM1 Mode - USART with Internal Clock
Data Order - LSB First
IBON - Enabled
Frame Format - Standard USART
Sampling Rate - 16x
Baud Rate - 115200
Character Size - 8 bits
Stop Bits - 1
Parity - None
Used for sending and receiving data from terminal
3 SysTick Counter Enable - Disabled (during setup)
Current Value - 0
Reload Value - 23999
Interrupt Enable - Yes
Clock Source - CPU Clock
Tick Counter - 0
Callback Function - NULL
Used for calculating time for LED blinking
4 TC0 Module Reset - Yes
Counter Mode - 32-bit
Prescaler - 1 (no division)
Prescaler Sync - Prescaler clock
Timer Period - 1,199,999
Interrupt Enable - Overflow
Used for switch debouncing mechanism
5 Touch Library Acquisition Module Init - Yes
Signal Memory Assignment – Yes
Sensor Node Enable - For each node (0 to DEF_NUM_CHANNELS-1)
Sensor Node Calibration For each node (0 to DEF_NUM_CHANNELS-1)
Sensor Key Init - For each key (0 to DEF_NUM_SENSORS-1)
For Touch Sensing

Demo Overview

Program 1: Basic LED Blinking
Program 1 provides a simple LED blink at a 1‑second interval. This program executes automatically on power‑up. Users may explicitly reselect it by sending 1 over UART. On selection, the terminal displays:

"Program - 1 is Selected. Program - 1 is LED Blinking at 1 second...!!"


Figure 2: Program 1

Program 2: LED Speed Control via Switch and Touch Button
Program 2 allows real-time LED blink speed adjustments between 1 s (default speed), 500 ms (on-board switch) and 100 ms (on-board touch button) using either the on-board capacitive touch button or the mechanical switch. The program is activated by sending 2 via UART. The terminal displays:

"Program - 2 is Selected. Program - 2 is LED Blinking speed variation...!!"
“Monitoring mechanical switch & touch button. Press the switch/touch button to toggle blink rate...”


Figure 3: Program 2

Program 3: UART Counter Transmission
Program 3 transmits an 8-bit counter value over UART. The counter continuously increments as long as the mechanical switch remains pressed, and resets to zero when the switch is released. The program is activated by sending 3. The terminal displays:

"Program - 3 is Selected. Ramp graph will be displayed when the mechanical switch is pressed."

This data can be viewed in real time using MPLAB Data Visualizer.

NOTE: Make sure the Newline character selection is None and not CR+LF in Output setting on right side of Data Visualizer.


Figure 4: Newline Character

Operation

Follow the steps below to run the OOB firmware, switch between programs and interact with the device.

  1. Powering the Board
  • Connect the PIC32CM-PL10 Curiosity Nano to your PC using a USB type-C cable
  • The board automatically powers ON and executes Program 1
  1. Opening the UART Terminal
  • Launch MPLAB Data Visualizer
  • Locate the COM port corresponding to the Curiosity Nano
  • Set baud rate = 115200
  • Open the terminal
  • Below the window capture, it displays the default output


Figure 5: Default Window

  1. For selecting a Program, use the following inputs in the UART terminal:
  • Press 1 to Run LED blink (1s)


Figure 6: Option-1 Selection Window

  • Press 2 to Enable blink speed control via switch (0.5s)/touch button (0.1s)


Figure 7: Option-2 Selection Window

  • Press 3 to Enable UART counter transmission


Figure 8: Option-3 Selection Window

Close the terminal window to observe the ramp signal on the Time plot window, as it might print unknown characters on the terminal window, equivalent to the variable value.

  • Press 0 to reset everything and display the default message


Figure 9: Option-0 Selection Window

  • Any invalid key prints the menu again


Figure 10: Invalid Selection Window

  1. Interacting with Each Program

Program 1

  • Observe the on-board LED blinking every 1 second

Program 2

  • Tap the touch button or press the mechanical switch to cycle through speeds:
    1 second (default)
    500 ms (switch)
    100 ms (touch)

Program 3

  • Press the on-board mechanical switch to send counter values over UART
  • Press and hold to generate a ramp sequence
  • Use a Time Plot in Data Visualizer to view counter progression

Using MPLAB Data Visualizer

  1. Launch MPLAB Data Visualizer.


Figure 11: Data Visualizer Window

  1. Open the Variable Streamer (left sidebar) and click New.


Figure 12: Variable Streamer Tab

  1. Add a variable as shown in the example configuration.
  • Add Name for the variable
  • Select Framing mode as One’s Complement
  • Start of Frame as 0x03
  • Add a new variable (RAMP_VALUE)


Figure 13: Variable Configuration Window

  1. Select the PIC32CM6408PL10 Curiosity Nano COM Port as the data source.


Figure 14: COM Port Selection Window

  1. Set the baud rate to 115200.


Figure 15: Baud Rate Selection Window

  1. Click the Time Plot icon next to the variable to visualize real-time data.


Figure 16: Time Plot Window

Summary

The PIC32CM-PL10 Curiosity Nano Out-of-Box Example offers a quick, interactive introduction to the PIC32CM6408PL10 device and its peripherals. This demonstration enables users to explore fundamental capabilities such as GPIO control, touch sensing, UART communication, and user interaction through both mechanical and capacitive inputs. It serves as an ideal starting point for new developers, showcasing the versatility and simplicity of the Curiosity Nano platform.

About

This project comes preloaded on the PIC32CM6408PL10048 Curiosity Nano board and launches when the user first plugs it in. It contains three scenarios which can be alternated using a command sent through serial communication.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages