1.13 MSD Basic Example (msd_basic)

This application demonstrates the ability of the MPLAB Harmony USB Device Stack to support USB Mass Storage Device. The application uses MCU's NVM region as storage media.

Description

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

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/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
pic32cm_le00_curiosity_pro.XMPLABXPIC32CM5164LE00100PIC32CM Lx Curiosity Pro Board
pic32mz_ef_sk.XMPLABXPIC32MZ2048EFH144PIC32MZ Embedded Connectivity with FPU (EF) Starter Kit
pic32mz_ef_sk_freertos.XMPLABXPIC32MZ2048EFH144PIC32MZ Embedded Connectivity with FPU (EF) Starter Kit
sam_d21_xpro.XMPLABXATSAMD21J18ASAMD21 Xplained Pro Board
sam_e54_xpro.XMPLABXATSAME54P20ASAME54 Xplained Pro Board
pic32mz_ef_curiosity_2_0.XMPLABXPIC32MZ2048EFM144Curiosity PIC32MZ EF 2.0 Development Board
pic32mx470_curiosity.XMPLABXPIC32MX470F512HPIC32MX Curiosity Development Board
pic32mm_usb_curiosity.XMPLABXPIC32MM0256GPM064PIC32MM USB Curiosity Development Board
pic32ck_gc01_curiosity_ultra.XMPLABXpic32ck_gc01_curiosity_ultraPIC32CK GC Curiosity Ultra Development 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

SAMD21 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).
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).
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).
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).
PIC32MZ Embedded Connectivity with FPU (EF) Starter Kit
  • Use the micro-A/B port J4 (which is located on the bottom side of 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).
PIC32MM USB Curiosity Development Board
  • Use the micro-B USB connector USB2 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).
PIC32CK GC Curiosity Ultra Development Board
  • Use the Barrel jack connector(J200) to connect an external power supply to the board.
  • Use the USB Type-C connector J202 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).
PIC32CX SG41 Curiosity Ultra Evaluation Board
  • Use the micro-B USB connector Target USB( 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).
Curiosity Pro PIC32CM LE00 Development Board
  • Use the USB micro-B "TARGET USB" (J200) 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)
PIC32CZ CA80 Curiosity Ultra development board
  • Use the USB micro-B "USB DEVICE" connector (J102) 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).
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).

Running the Application

This demonstration uses the selected hardware platform as a logical drive on the computer using the internal Flash of the device as the drive storage media.

Connect the hardware platform to a computer through a USB cable. The device should appear as a new drive on the computer named "Drive Name". The drive can used to store files. The LEDs on the demonstration board will indicate the USB state of the device. Refer to the Configuring the Hardware section for the selected target hardware.

Note:

  1. The user should ensure that the Host is not currently writing data to the media before detaching the device. On a Windows computer before removing the device click on "Safely Remove Hardware" and click on "Eject Media".
  2. Reprogramming the development board will cause any stored files to be erased.