Jump to main content

##

# 1.14 MSD Multiple LUN Example (msd_multiple_luns)

This application demonstrates data transfer between two storage media - SD card and non-volatile memory (NVM) - and a computer through USB Mass Storage Device (MSD).

## Description

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.

## 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_multiple_luns.

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 Name | IDE | Target Device | Hardware / Configuration
--- | --- | --- | ---
pic32mx470_curiosity.X | MPLABX | PIC32MX470F512H | PIC32MX Curiosity Development Board
pic32mz_ef_curiosity_2_0.X | MPLABX | PIC32MZ2048EFM144 | Curiosity PIC32MZ EF 2.0 Development Board
pic32cz_ca80_curiosity_ultra.X | MPLABX | PIC32CZ8110CA80208 | PIC32CZ Curiosity Development Board
pic32cm_gc_curiosity_pro.X | MPLABX | PIC32CM5112GC00100 | PIC32CM GC Curiosity Pro Board
pic32ck_gc01_curiosity_ultra.X | MPLABX | PIC32CK2051GC01144 | PIC32CK GC Curiosity Ultra Development Board

## Configuring the Hardware

Curiosity PIC32MZ EF 2.0 Development Board

- To run the demo, the following additional hardware is required:
  - micro-sd Click board
  - micro-sd card
- Insert the micro-sd click board into the Mikro BUS 1 connector on the Curiosity PIC32MZ EF 2.0 Development Board.
- Insert the micro-SD card into the micro-SD Card slot of the micro-sd click 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

- To run the demo, the following additional hardware is required:
  - micro-sd Click board
  - micro-sd card
- Insert the micro-sd click board into the Mikro BUS 1 connector on the Curiosity PIC32MX470 Development Board.
- Insert the micro-SD card into the micro-SD Card slot of the micro-sd click board.
- Ensure that a jumper is placed at 4-3 on J8, to select supply from debug USB connector.
- 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).

PIC32CZ CA80 Curiosity Ultra development board

- To run the demo, the following additional hardware is required:
- Insert the micro-SD card into the micro-SD Card slot J600 of the PIC32CZ CA80 Curiosity Ultra development board.
- Use the USB micro-B port J102 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

- To run the demo, the following additional hardware is required:
- Insert the micro-SD card into the micro-SD Card slot J600 of the 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) 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).

PIC32CM GC Curiosity Pro Board

- To run the demo, the following additional hardware is required:
  - micro-sd Click board
  - micro-sd card
- Insert the micro-sd click board into the Mikro BUS connector on the Curiosity PIC32CM GC Curiosity Pro Board.
- Insert the micro-SD card into the micro-SD Card slot of the micro-sd click board.
- USB micro-B port J200 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).

## Running the Application

This demonstration uses SD card and NVM as drive storage media and shows them as two logical drives on the computer.

Connect the hardware platform to a computer through a USB cable. The device should appear as two new drives on the computer. The NVM media should appear as "Drive Name" and should have a sample “FILE.txt” file. The drive name for the SD card media depends on the micro SD card vendor. The drives can then be 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 that 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".