MSC Overview

Protocol

The MSC protocol is composed of three phases:

  • The Command Transport
  • The Data Transport
  • The Status Transport

Mass storage commands are sent by the host through a structure called the Command Block Wrapper (CBW). For commands requiring a data transport stage, the host will attempt to send or receive the exact number of bytes from the device as specified by the length and flag fields of the CBW. After the data transport stage, the host attempts to receive a Command Status Wrapper (CSW) from the device detailing the status of the command as well as any data residue (if any). For commands that do not include a data transport stage, the host attempts to receive the CSW directly after CBW is sent. The protocol is detailed in Figure - MSC Protocol.

Figure - MSC Protocol

MSC Protocol


Endpoints

On the device side, in compliance with the BOT specification, the MSC is composed of the following endpoints:

  • A pair of control IN and OUT endpoints called default endpoint.
  • A pair of bulk IN and OUT endpoints.

Table - MSC Endpoint Usage indicates the different usages of the endpoints.

Table - MSC Endpoint Usage
EndpointDirectionUsage
Control IN
Control OUT
Device to Host
Host to Device
Enumeration and MSC class-specific requests
Bulk IN
Bulk OUT
Device to Host
Host to Device
Send CSW and data
Receive CBW and data


Class Requests

There are two defined control requests for the MSC BOT protocol. These requests and their descriptions are detailed in Table - Mass Storage Class Requests.

Table - Mass Storage Class Requests
Class RequestsDescription
Bulk-Only Mass Storage ResetThis request is used to reset the mass storage device and its associated interface. This request readies the device to receive the next command block.
Get Max LUNThis request is used to return the highest logical unit number (LUN) supported by the device. For example, a device with LUN 0 and LUN 1 will return a value of 1. A device with a single logical unit will return 0 or stall the request. The maximum value that can be returned is 15.


Small Computer System Interface (SCSI)

SCSI is a set of standards for handling communication between computers and peripheral devices. These standards include commands, protocols, electrical interfaces and optical interfaces. Storage devices that use other hardware interfaces such as USB, use SCSI commands for obtaining device/host information and controlling the device’s operation and transferring blocks of data in the storage media.

SCSI commands cover a vast range of device types and functions and as such, devices need a subset of these commands. In general, the following commands are necessary for basic communication:

  • INQUIRY
  • READ CAPACITY(10)
  • READ(10)
  • REQUEST SENSE
  • TEST UNIT READY
  • WRITE(10)

Refer to Table - SCSI Commands to see the full list of implemented SCSI commands by µC/USB-Device.