USB Component  Version 6.17.0
MDK Middleware for USB Device and Host Communication
MSC: Mass Storage Class

The Mass Storage Class (MSC) is mainly used for devices that allow access to their internal data storage. Typical examples for MSC class devices are:

  • External hard drives (HDD)
  • External optical drives (such as CD or DVD drives)
  • Portable Flash memory devices
  • Solid-state drives (SSD)
  • Digital cameras
  • Card readers
  • Mobile phones

A detailed description about MSC is provided by the USB Implementers Forum (USB-IF).

MSC Class Features

Not only hard disks use the MSC class. Any device that allows access to its internal data storage using MSC can be connected to the USB Bus as a mass storage device. The MSC class implementation in the USB Component has the following features:

  • It supports the bulk-only transport (BOT) protocol. The BOT protocol specifies that not only data is transferred using bulk transfer, but also command and status data.
  • The maximum number of bulk IN and OUT endpoints is fixed to 1.
  • USB Device supports multiple logical units (LUNs) which can operate separately, for example one unit could have an SD card as media and another one could have a RAM disk as media.
  • The USB Component supports the MSC Class for USB Device and USB Host (MDK-Professional only) applications.

Control Transfers

The MSC specification defines five class-specific requests to be transmitted over the default (control) pipe. Only two of them are supported by the bulk-only protocol:

  • The Bulk Only Mass Storage Reset request enables the USB Host to reset the MSC device and its associated interface.
  • The Get Max LUN request allows the USB Host determine the number of Logical Units (LUNs) that are supported by the device. LUNs are numbered starting from LUN 0 to LUN 15 (maximum).

Bulk Transfers

The bulk-only protocol divides a successful data transfer into three stages:

  1. Command transport: the USB Host sends a command in the Command Block Wrapper (CBW) structure
  2. Data transport: the data is sent to or from the USB Host
  3. Status transport: the USB Device sends status information in the Command Status Wrapper (CSW) structure

USB Descriptors

The following descriptors are required in an USB MSC Device:

  • Standard Device Descriptor
  • Standard Configuration Descriptor
  • Standard Interface Descriptor for the MSC Class
  • Standard Endpoint Descriptors for Bulk IN and Bulk OUT endpoints
  • Standard String Descriptor

The necessary descriptors are automatically generated by the USB Middleware Component. The page USB Descriptors provides more information on the topic.

Further information on how to use MSC is given in the Reference section: