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.
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.
Go to File > Project Properties and verify the connected hardware tool and compiler toolchain version.
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).
Enter the character h to bring up the help menu. Try the different options available to verify the output.
Results
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.
Analysis
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).
Conclusion
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.