Getting Started with USB on SAM MCUs Using MPLAB® Harmony v3: Step 6

Build, Program, and Observe the Output


Verify that the I/O1 Xplained Pro Extension Kit is connected to the extension header EXT1 on the SAM E70 Xplained Evaluation Kit.

Figure 1: Connect the Extension


The SAM E70 Xplained Evaluation Kit includes an on-board Embedded Debugger (EDBG) chip for programming and debugging the ATSAME70Q21B device. Connect the Type-A Male to Micro-B USB cable to the Micro-B DEBUG USB port to power and debug the kit. Also, connect another cable to the TARGET USB port for the USB CDC Serial Port.

Figure 2: Connect USB Ports


Go to File > Project Properties and verify the connected hardware tool and compiler toolchain version.

Figure 3: Verify Project Properties


Clean and build your application by clicking on the Main_Rebuild_Project.png Clean and Build Project button.


Program your device with the built application binary by clicking on the Main_Program_Target_Project.pngMake and Program Device button.


Now open your favourite serial terminal application on your computer and connect to the serial port as shown in Figure 4 (Tera Term is used here for reference).

Figure 4: Open USB Serial Port using Tera Term


Enter the character h to bring up the help menu. Try the different options available to verify the output.

Figure 5: Verify the Output


Congratulations! You have now completed this training module and have successfully created a USB device exposing various functionality through a terminal-based menu. You observed that the application measures temperature by reading the AT30TSE758A temperature sensor chip on the I/O1 Xplained Pro every second using I2C and stores these values into the sensor chip's own integrated EEPROM. Further, you observed that the application also uses an ADC channel to read the output voltage of the TEMT6000 ambient light sensor on the I/O1 Xplained Pro. Finally, we controlled the state of the SAM E70 Xplained User LED via a terminal-based menu made available through the SAM E70 Xplained target USB port by configuring it as a USB CDC class device and also made the light and temperature sensor data available through it.


You should now be well equipped to create an application using MPLAB® Harmony v3 on the SAM E70 microcontroller. Your application used all the fundamental elements that go into building a USB device. You used the MPLAB Harmony Configurator (MHC) to configure and generate drivers for the SAM E70 using the MPLAB Harmony v3 Framework. You used the clock configurator to set up the CPU clock and peripheral clocks. You configured and generated drivers for I²C and USB High-Speed. You configured TWIHS, AFEC, and TC PLIBs. You configured System Services and Middleware libraries like TIME System Service and USB Device Stack (i.e. the CDC Function Driver). You also used the Pin Configurator to set up the pins for LEDs and peripherals (I²C).


This training module covered all the fundamental components needed to build a USB device using MPLAB Harmony v3 Framework on the SAM E70 microcontroller. As a next step, you may customize this application and reconfigure some of the components used in this lab. You may also add new components (drivers, etc.) to extend this basic USB device and ultimately prototype your end application.

© 2021 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.