1.3 CDC MSD Basic Example (cdc_msd_basic)

This application demonstrates the ability of the MPLAB Harmony USB Device Stack to support Composite USB Device

Description

This 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.

Downloading and building the application

To clone or download this application 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.

Path of the application within the repository is usb_apps_device/apps/cdc_msd_basic.

Following table gives the details of project configurations, target device used, hardware and its IDE. Open the project using the respective IDE and build it.

Project NameIDETarget DeviceHardware / Configuration
sam_e70_xult.XMPLABXATSAME70Q21BSAME70 Xplained Ultra Board
pic32mx470_curiosity.XMPLABXPIC32MX470F512HPIC32MX Curiosity Development Board
pic32mz_ef_curiosity_2_0.XMPLABXPIC32MZ2048EFM144Curiosity PIC32MZ EF 2.0 Development Board
sam_e54_xpro.XMPLABXATSAME54P20ASAME54 Xplained Pro Board
pic32cz_ca80_curiosity_ultra.XMPLABXPIC32CZ8110CA80208PIC32CZ CA80 Curiosity Ultra development board
pic32cx_sg41_curiosity_ultra.XMPLABXPIC32CX1025SG41128 PIC32CX SG41 Curiosity Ultra Evaluation Board
wbz653_curiosity.XMPLABXWBZ653WBZ653 Curiosity Board

Configuring the Hardware

SAME70 Xplained Ultra Board
  • Jumper J203 must be shorted between PB08 and VBUS (positions 2 and 3).
  • Use TARGET USB J200 connector on the board to connect the USB Device to the USB Host PC.
  • LED3 indicates USB Device Configuration Set Complete event (the USB device functionality has been activated by the USB Host).
  • Press the switch SW400 to trigger communication from the USB Device to the USB Host.
Curiosity PIC32MX470 Development Board
  • Use the USB micro-B port J12 to connect the USB Device to the USB Host PC.
  • LED1 indicates USB Device Configuration Set Complete event (the USB device functionality has been activated by the USB Host).
  • Press the switch S1 to trigger communication from the USB Device to the USB Host.
Curiosity PIC32MZ EF 2.0 Development Board
  • Use the USB micro-B port J201 to connect the USB Device to the USB Host PC.
  • LED1 indicates USB Device Configuration Set Complete event (the USB device functionality has been activated by the USB Host).
  • Press the switch SW1 to trigger communication from the USB Device to the USB Host.
SAME54 Xplained Pro Board
  • Use TARGET USB connector on the board to connect the USB Device to the USB Host PC.
  • LED0 indicates USB Device Configuration Set Complete event (the USB device functionality has been activated by the USB Host).
  • Press the switch SW0 to trigger communication from the USB Device to the USB Host.
PIC32CZ CA80 Curiosity Ultra development board
  • Use TARGET USB connector ( J102 ) on the board to connect the USB Device to the USB Host PC.
  • LED0 indicates USB Device Configuration Set Complete event (the USB device functionality has been activated by the USB Host).
  • Press the switch SW0 to trigger communication from the USB Device to the USB Host.
PIC32CX SG41 Curiosity Ultra Evaluation Board
  • Use TARGET USB connector ( J200 ) on the board to connect the USB Device to the USB Host PC.
  • LED1 indicates USB Device Configuration Set Complete event (the USB device functionality has been activated by the USB Host).
  • Press the switch SW1 to trigger communication from the USB Device to the USB Host.
WBZ653 Curiosity Board
  • Connect a Type-C cable between the DBG USB (J100) port on the board and the PC to power up the board.
  • The jumper (J102) must be open for USB device applications.
  • Use the TARGET USB (J103) connector on the board to connect the USB Device to the USB Host PC.
  • RGB_LED (D800) turning Green indicates USB Device Configuration Set Complete event (the USB device functionality has been activated by the USB Host).
  • Press the USR_BTN1 (SW_801) switch to trigger communication from the USB device to the USB host.

Running the Application

This demonstration application creates a composite USB Device that works simultaneously as a CDC and as a MSD device. This application combines the functionality of the cdc_com_port_single and msd_basic demonstration applications into one device.

Open the project with appropriate IDE. Compile the project and program the target device.

Running the CDC Device

The CDC Device application is same as cdc_com_port_single demo. Refer to local documentation from usb_apps_device/apps/cdc_com_port_single. The documentation is also available in the github path usb_apps_device/apps/cdc_com_port_single.

Running the MSD Basic Device

The MSD Basic Device application is same as msd_basic demo. Refer to local documentation from usb_apps_device/apps/msd_basic. The documentation is also available in the github path usb_apps_device/apps/msd_basic.