USB Component  Version 6.15.0
MDK Middleware for USB Device and Host Communication
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
USB Device Mass Storage

A mass storage USB Device implements an USB memory stick. Together with the File System you can connect various drives using MSC to an USB Host: SD cards, internal or external Flash memory and even a simple RAM disk. The examples accesses either on-chip RAM or a SD card where available. The USB Host can then access the new drives using standard file access methods. The following picture shows an exemplary connection of the development board and the USB Host Computer.


The Abstract.txt file contained in the Documentation group of the Project window gives you more information on the general setup and the available storage device on the development board.

Build the "USB Device Mass Storage" Project

Open the example project in MDK. The ┬ÁVision Project window should display a similar project structure:

Typical Project Structure of an USB MSC Example

Source Files

  • MassStorage.c contains the main C function that initializes the board hardware and the USB Device Component.
  • The USBD_User_MSC_0.c is an adapted code template that implements all necessary file access functions. Refer to MSC: Mass Storage Class for details about these template functions.

If you are using RTOS other than CMSIS-RTOS2 RTX5 for your project please make sure to satisfy USB Device Resource Requirements.

You may now build and download the example project to the evaluation board using the ┬ÁVision commands:

  • Project –> Build target (F7)
  • Flash   –> Download (F8)

After these steps, the project should start executing on your evaluation kit. In case of errors, refer to the Evaluation Board User's Guide for configuration information.

Using the "USB Device Mass Storage" Project

Hardware Setup

The setup of the Evaluation Board hardware is described in the Abstract.txt file.

  • Verify all jumper settings on the target hardware.
  • Insert a SD card into the socket (if available).
  • Use an USB cable to connect your development board to the Host PC and power up your board.
  • Wait for the driver installation on the PC to complete. First you will see "Installing device driver software" and after a successful installation "Keil Disk 0 USB Device":

PC Software

The USB Device Mass Storage example can be tested on a Windows PC using the Windows Explorer. After a successful driver installation, the AutoPlay window appears:


If you click on Open folder to view files Windows Explorer automatically starts with the drive opened.