Getting Started Training Module Using MPLAB® Code Configurator (MCC): Step 6
Build, Program, and Observe the Outputs
The SAM E51 Curiosity Nano Evaluation Kit allows using the onboard debugger for debugging. Connect the Type-A male to Micro-B USB cable to the Micro-B DEBUG USB port to power and debug the SAM E51 Curiosity Nano Evaluation Kit.
Go to File > Project Properties and make sure that the SAM E51 Curiosity Nano is selected as the debugger under Connected Hardware Tool. Check that XC32 (v4.30) is selected as the Compiler Toolchain for XC32.
Clean and build your application by clicking on the Clean and Build icon.
Program your application to the device, by clicking on the Make and Program button.
The Lab will build and program successfully.
Now, open the Tera Term terminal application on your PC (from the Windows® Start menu by pressing the Start button). Select the Serial Port.
Select Setup > Serial port and change the Baud rate to 115200.
You will see an LED (LED0) on the SAM E51 Curiosity Nano Evaluation Kit toggles on every timeout basis and the default periodicity of the timeout is 500 milliseconds.
Also, notice the LED0 blinking at a 500 milliseconds rate.
Press the switch SW0 on SAM E51 Curiosity Nano Evaluation Kit to change the default sampling rate to 1 second.
Every subsequent pressing of switch SW0 on the SAM E51 Curiosity Nano Evaluation Kit changes the default sampling rate to 2 seconds, 4 seconds, 500 milliseconds, and back to 1 second in cyclic order.
While the temperature sampling rate changes on every switch SW0 press, notice the LED0 toggling at the same sampling rate.
Results
You observed that the application displayed the LED toggling rate on the serial terminal every 500 milliseconds. You could change the LED toggling rate dynamically by pressing a user switch on the development kit. You could exercise sampling changes to 1 second, 2 seconds, 4 seconds, and cycle back to 500 milliseconds every time you press the user switch.
Analysis
You have successfully created your first application using MPLAB® Code Configurator (MCC) on MPLAB Harmony v3 on SAM D5x/E5x microcontroller. Your application used all the fundamental elements that go into building a real-time application. Your application successfully toggled the LED and displayed the LED toggling rate 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 MCC to configure SAM D5x/E5x and use the MPLAB Harmony v3 Framework. You used the clock configurator to set up the CPU clock and timer (RTC) clock. You configured SERCOM 5 (as USART), RTC, and EIC peripheral libraries. You also configured DMA using the DMA configurator. Finally, you used Pin Configurator to set up the pins for LED and switch functions.
Conclusions
This tutorial provided you with training for configuring and using all the fundamental components needed to build a real-time application on a SAM D5x/E5x microcontroller using MCC with MPLAB Harmony v3 Framework. As a next step, you may customize this application and reconfigure some of the components used in this tutorial. You could also add new features (PLIBs, etc.) to enhance this application to realize your end application.