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

Last modified by Microchip on 2023/11/09 09:09

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.

Connect the Extension

Figure 1

Back to Top

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.

Connect USB Ports

Figure 2

Back to Top

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

Verify Project Properties

Figure 3

Back to Top

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

Clean and Build Project button

Figure 4

Back to Top

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

Make and Program Device button

Figure 5

Back to Top

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

Open USB Serial Port using Tera Term

Figure 6

Back to Top

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

Verify the Output

Figure 7

Back to Top


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.

Back to Top


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 Code Configurator (MCC) 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).

Back to Top


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.

Back to Top