Jump to main content

##

# 1 Harmony 3 USB Device application examples

MPLAB® Harmony 3 is an extension of the MPLAB® ecosystem for creating embedded firmware solutions for Microchip 32-bit SAM and PIC® microcontroller and microprocessor devices. Refer to the following links for more information.

- Microchip 32-bit MCUs
- Microchip 32-bit MPUs
- Microchip MPLAB X IDE
- Microchip MPLAB® Harmony
- Microchip MPLAB® Harmony Pages

This repository contains the MPLAB® Harmony 3 USB Device application examples.

- Release Notes
- MPLAB® Harmony License

To clone or download these applications from Github, go to the main page of this repository and then click Clone button to clone this repository or download as zip file. This content can also be downloaded using content manager by following these instructions.

## Contents Summary

Folder | Description
--- | ---
apps | Contains Harmony 3 USB Device application examples
docs | Contains documentation in html format for offline viewing (to be used only after cloning this repository onto a local machine). Use github pages of this repository for viewing it online.

## Code Examples

The following applications are provided to demonstrate the typical or interesting usage models of USB Device capabilities.

Name | Description
--- | ---
CDC COM Port Dual | The application is example of a USB CDC Device that enumerates as a dual COM port on the USB host PC. The COM port can be opened using any of the terminal applications. To demonstrate communication between the two COM ports, a character typed in one of the COM port is displayed on the other and vice versa.
CDC COM Port Single | The application creates a USB CDC Device that enumerates as a single COM port on the USB host PC. The COM port can be opened using any of the terminal applications. To demonstrate two-way communication, when a character is typed on the terminal window, it is echoed back by the USB device.
CDC MSD Basic | The application creates a USB CDC Device that enumerates as a COM port and Flash Drive simultaneously. The COM port can be opened using any of the terminal applications and to demonstrate two-way communication, a character typed on the terminal window is echoed back by the USB device. Flash drive acts similar to any Mass Storage Class device where the NVM is used as storage media.
CDC MSD SD Card | The application creates a USB CDC Device that enumerates as a COM port and Flash Drive simultaneously. The COM port can be opened using any of the terminal applications and to demonstrate two-way communication, a character typed on the terminal window is echoed back by the USB device. Flash drive acts similar to any Mass Storage Class device where the SD Card is used as storage media.
CDC Serial Emulator | The application demonstrates the use of the CDC device class to implement a USB-to-Serial Converter. The application enumerates a COM port on the personal computer. Data received through the CDC USB interface is forwarded to a UART. Data received on the UART is forwarded to the CDC USB interface on the target board. The interface between the UART and the CDC USB Interface on the board demonstrates the USB to UART capability.
CDC Serial Emulator MSD Example | This application demonstrates a USB composite device with CDC and MSD functions. The CDC function implements a USB-to-Serial Converter. The MSD function driver implements a USB Mass Storage Device with NVM as storage media.
HID Basic | The application creates a USB HID Device that enumerates as a custom USB HID device on the USB host PC. The device allows the USB Host utility to control the LEDs on the board and query the status of a switch.
HID Basic Remote Wakeup | This application demonstrates the ability of the MPLAB® Harmony USB Device Stack to support the Remote Wakeup feature using a custom HID device class example.
HID Joystick | The application creates a custom HID joystick. The application is only intended to demonstrate creation of Joystick HID Report descriptors and may not be a definite end solution. The end application requirements may need the report descriptor to be modified.
HID Keyboard | The application creates a Generic HID keyboard. Pressing a switch on the target board emulates a keyboard key press.
HID Mouse | The application creates a USB HID based two-button mouse device. When connected, the device emulates mouse operation by moving the cursor in a circular pattern. When the button in USB device is pressed the movement of cursor is Stopped/Started again.
HID MSD Basic | The application creates a USB Device that combines the functionality of the hid_basic and msd_basic demonstration applications. To demonstrate HID functionality, the device allows USB Host utility to control the LEDs on the board and query the status of a switch. To demonstrate MSD functionality, application allows read / write / modify / delete data from a PC host like any normal Flash drive.
MSD Basic | The application creates a USB MSD Device that enumerates as a Flash Drive on the USB host PC. The application allows read / write / modify / delete data from a PC host like any normal Flash drive.
MSD Multiple LUN | This application demonstrates the creation of a USB device with multiple logical units. The storage media, SD Card, acts as one logical unit, and the NVM acts as the second logical unit. Data transfer between a computer and the logical units (SD Card / NVM) takes place through USB MSD.
MSD SD Card | The application creates a USB MSD Device that enumerates as a Flash Drive on the USB host PC. The application allows read / write / modify / delete data from a PC host like any normal Flash drive.
Printer | This demo uses PC running Windows 7 as a USB Host. The demo board programmed with the demo application, enumerates as "USB Printing Support" device when connected to the USB Host. This demo allows the user to print the text from Notepad or similar application in Windows using built in Generic/Text Only print driver.
USB UART Bridge Dual | The application demonstrates the use of the CDC device class to implement a dual USB-UART bridge. The application enumerates two COM ports on the personal computer. Any data sent through the virtual COM ports will be seen at the respective UART port Tx pin and data sent through the UART Rx pin of the MCU will be seen at the virtual COM port.
USB UART Bridge Single | The application demonstrates the use of the CDC device class to implement a USB-UART bridge. The application enumerates a COM port on the personal computer. Any data sent through the virtual COM port will be seen at the respective UART port Tx pin and data sent through the UART Rx pin of the MCU will be seen at the virtual COM port.
Vendor | The application creates a USB CDC Device that enumerates as a custom vendor USB device on the USB host PC. The device uses USB Device Layer Endpoint functions and demonstrates the PC host's ability to control the LEDs on the board and query the status of a switch through PC utility.