Universal Serial Bus Mass Storage Class. Bulk-Only Transport

Similar documents
Universal Serial Bus Mass Storage Class Specification Overview

Universal Serial Bus Mass Storage Class Specification Overview

AN2554. Creating a Multi-LUN USB Mass Storage Class Device Using the MPLAB Harmony USB Device Stack INTRODUCTION CONTROL TRANSFERS

Universal Serial Bus Device Class Definition for Mass Storage Devices

Universal Serial Bus Device Class Definition for Printing Devices

Universal Serial Bus Device Class Definition For Content Security Devices

Universal Serial Bus Mass Storage Class. UFI Command Specification

Device Wire Adapter (DWA) Test Specification. Designed using the Certified Wireless USB Base Specification, Revision 1.0

PL-2507 Hi-Speed USB 2.0 to IDE Bridge Controller Preliminary Datasheet

USB Feature Specification: Shared Endpoints

RINGDALE USB (UNIVERSAL SERIAL BUS) HID RELAY CONTROLLER (1543)

Universal Serial Bus Mass Storage Class. Specification Overview

UC20 WinCE USB Driver

Universal Serial Bus Mass Storage Class. Compliance Test Specification

Universal Serial Bus Device Class Definition Billboard Devices

Understand USB (in Linux)

PL-2507C Hi-Speed USB 2.0 to IDE Bridge Controller Product Datasheet

S1R72U06 Technical Manual

USB2 Debug Device A Functional Device Specification

Future Technology Devices International Ltd. Application Note AN_168. Vinculum-II USB Slave. Customizing an FT232 Device

SH7286 Group APPLICATION NOTE. USB Function Module: USB Mass Storage Class Oct. 22, Summary. Target Device. Contents. R01AN0063EJ0100 Rev. 1.

Universal Serial Bus Content Security Method 4 Elliptic Curve Content Protection Protocols

Embedded USB Drive. Preliminary Release. Revision History. July 14, 2006

Revision History. Rev Date Details A October 14, 2008 New release of Short and Legacy eusb Spec with SM325AC controller

USS-720 Instant USB USB-to-IEEE* 1284 Bridge

USB INTERFACE SPECIFICATION

Serial Communications

Application Note AN_164. Vinculum-II USB Slave. Writing a Function Driver

Application Note. 32-bit Cortex -M0 MCU NuMicro Family. Application Note of NUVOTON 32-bit NuMicro Family

SMART MODULAR eusb Drive

PL-2305 USB to Printer Bridge Controller (Chip Rev I) Product Datasheet

Serial Communications

PL-25A1 Hi-Speed USB Host-to-Host Bridge Controller (Chip Revision B) Product Datasheet

EZ-USB AT2LP USB 2.0 to ATA/ATAPI Bridge

APPLICATION NOTE 9.15

Application Note: AN00136 USB Vendor Specific Device

TP-Link USB Port Hub Model UH700 Power 12V==2A

Revealing Embedded Fingerprints: Deriving Intelligence from USB Stack Interactions

PL-2303X Edition (Chip Rev A) USB to Serial Bridge Controller Product Datasheet

CY4611B FX2LP USB to ATA/CF Reference Design Notes

PL-2533 Hi-Speed USB MS PRO / MS / SD / MMC Card Reader Controller IC Product Datasheet

EZ-USB AT2 USB 2.0 To ATA/ATAPI Bridge

ARM Cortex core microcontrollers

Hacking the Kinect. Created by lady ada. Last updated on :21:33 AM UTC

CM6327A USB Single-Chip Audio Solution for Mono Microphone

32-bit. Application Note. Microcontrollers. AVR32760: AVR32 UC3 USB DFU Bootloader Protocol. 1. Introduction. 1.1 Intended Audience. 1.

Universal Serial Bus Device Class Definition for Video Devices: Video Device Examples. Revision 1.0

CM6327A USB Audio Single Chip Solution for Mono Microphone

Part 1 - Introduction to USB

Test Plan for MultiRead Devices

JSR80 API Specification

T24 Technical Manual Programming guide & advanced documentation. User Manual mantracourt.com

Using the HT66FB5x0 for 2D Joystick Applications C Language Example

TCG Storage Interface Interactions Specification (SIIS) Specification Version 1.02 Revision December, 2011 TCG

IMPORTANT NOTICE. As a result, the following changes are applicable to the attached document.

AN USB HID Intermediate with PSoC 3 and PSoC 5LP. Contents. 1 Introduction

Enhanced Serial Peripheral Interface (espi) ECN

Human Interface Devices: Using Control and Interrupt Transfers

Direct IP. Direct IP Integration Guide Rev 1.0 Distribution under NDA only

Enhanced Serial Peripheral Interface (espi)

CM6307A USB Audio Single Chip with Array Microphone

USB Device Development Kit for HT32 Series Microcontrollers

Common Flash Interface (CFI) and Command Sets

CM6120-S Best USB Audio Single Chip for PC Speakers Solution

Open Universal Serial Bus Driver Interface (OpenUSBDI) Specification

S1R72U06 Application Note

RapidIO Interconnect Specification Part 3: Common Transport Specification

ETSI TS V7.5.0 ( ) Technical Specification. Smart Cards; UICC-Terminal interface; Characteristics of the USB interface (Release 7)

BIOS Enhanced Disk Drive Specification. June 24, 1999

Software Developer's Manual

S1R72U01 Technical Manual

HS-100 USB Audio Single Chip

Creating a USB Audio Device on a PIC32 MCU Using MPLAB Harmony

Renesas USB MCU and USB ASSP

Interoperability Specification for ICCs and Personal Computer Systems

ETSI TS V ( ) Technical Specification. Smart Cards; UICC-Terminal interface; Characteristics of the USB interface (Release 10)

Read section 8 of this document for detailed instructions on how to use this interface spec with LibUSB For OSX

Software Developer's Manual

Software Developer's Manual

Document Revision 1.0 September 16, 1998 Intel Hewlett-Packard NEC Dell

LZ85202 IrDA Control Host Controller with USB Interface User s Guide

QNX Momentics DDK. Universal Serial Bus (USB) Devices. For QNX Neutrino or QNX , QNX Software Systems Ltd.

IMPORTANT NOTICE. As a result, the following changes are applicable to the attached document.

Technical Note: NVMe Simple Management Interface

MCCI Universal Serial Bus Windows Kernel Bus Interface for USB 3.0 Streams Device Drivers

Free (GPL) USB Firmware for Atmels AT90USB 8-bit microprocessor README 1

MCCI Universal Serial Bus Windows Kernel Bus Interface for USB 3.0 Streams Device Drivers

Universal Serial Bus - USB 2.0

Designing A Low Cost USB-PS/2 Combination Interface Mouse with the Cypress Semiconductor CY7C63723 encore USB Microcontroller

TOUCH PANEL CONTROLLER. Delivery Specifications. Model Name: AHL-120N5

Mode/ Log/ VPD Pages For Describing Solid State Storage (Revision 3.0 Draft 4)

CM108B USB Audio Single Chip

WUSB Command Verifier (WUSBCV) Compliance Test Specification. Based on the Certified Wireless Universal Serial Bus Specification, Revision 1.

ECMA-405. Data Interchange on Parallel Write/Read Disk Format for 5 Optical Disks. 1 st Edition / December Reference number ECMA-123:2009

Management Component Transport Protocol (MCTP) IDs and Codes

IVI-6.2: VISA Interoperability Requirements for USBTMC Specification

THIS SPEC IS OBSOLETE

Intel Storage System JBOD 2000S3 Product Family

MCS7820. USB-2.0 to Two Serial Ports

How to fix Usually Slightly Broken devices and drivers?

Transcription:

Universal Serial Bus Mass Storage Class Bulk-Only Transport Revision 1.0[RC3RC4]

Revision 1.0[RC3] March 29, 1999 Change History Revision Issue Date Comments 0.7 September 23, 1998 Initial draft, pre-release 0.8 October 6, 1998 Revisions made at the Mass Storage DWG review Irvine, CA 0.9 October 21, 1998 Revisions made at the Mass Storage DWG review Plano, TX 0.9a January 5, 1999 Revisions made at the Mass Storage DWG review Tigard, OR 0.9b February 1, 1999 Additions of LUN support - Milpitas, CA 1.0[RC1] March 5, 1999 RR review - Midway, UT 1.0[RC2] March 23, 1999 Revisions from reflector review comments 1.0[RC3] March 29, 1999 Specification line by line review Milpitas, CA 1.0[RC4] June 21, 1999 Specification line by line review RR21 Milpitas, CA USB Device Class Definition for Mass Storage Devices Copyright 1998, 1999, USB Implementers Forum. All rights reserved. INTELLECTUAL PROPERTY DISCLAIMER THIS SPECIFICATION IS PROVIDED AS IS WITH NO WARRANTIES WHATSOEVER INCLUDING ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR ANY PARTICULAR PURPOSE, OR ANY WARRANTY OTHERWISE ARISING OUT OF ANY PROPOSAL, SPECIFICATION, OR SAMPLE. A LICENSE IS HEREBY GRANTED TO REPRODUCE AND DISTRIBUTE THIS SPECIFICATION FOR INTERNAL USE ONLY. NO OTHER LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY OTHER INTELLECTUAL PROPERTY RIGHTS IS GRANTED OR INTENDED HEREBY. AUTHORS OF THIS SPECIFICATION DISCLAIM ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF PROPRIETARY RIGHTS, RELATING TO IMPLEMENTATION OF INFORMATION IN THIS SPECIFICATION. AUTHORS OF THIS SPECIFICATION ALSO DO NOT WARRANT OR REPRESENT THAT SUCH IMPLEMENTATION(S) WILL NOT INFRINGE SUCH RIGHTS. Contributors Al Rickey, Phoenix Technologies Alan Haffner, Lexar Media Bill Stanley, Adaptec Calaimany Bhoopathi, Shuttle Technology Curtis E. Stevens, Phoenix Technologies Darrell Redford, Iomega Corporation Dave Gilbert, In-System Design David G. Lawrence, Global Technology Development David L. Jolley, Iomega Corporation David Luke, In-System Design Eric Luttman, In-System Design Glen Slick, Microsoft Corporation Hiromichi Oribe, HagiwaraSys-ComCo Jan Matejica, PIMC/Philips Jim Blackson, Y-E Data, Inc Jim Quigley, Iomega Corporation Johan Craeybeckk, PIMC/Philips Jordan Brown, Sun Microsystems Kenichi Hamada, Y-E Data, Inc Mark Williams, Microsoft Corporation Masayuki Kitagawa, Mitsumi Mike Chen, CMD Technology Mike Glass, Microsoft Corporation Mike Liebow, etek Labs Mike Nguyen, TEAC Mike Poulsen, Iomega Corporation Moto Watanabe, Hagiwara N.R. Devanathan, Shuttle Technology Paramita Das, Sun Microsystems Pat LaVarre, Iomega Corporation Peter S'Heeren, PIMC/Philips Ryota Okazaki, NEC Corporation Sadao Yabuki, TEAC Shigeyoshi Hashi, NEC Corporation Shing F. Lin, Adaptec Steve Bayless, Hewlett-Packard Steve Kolokowsky, Anchor Chips Steven Smith, etek Labs Terry Moore, MCCI Tim Bradshaw, Iomega Corp Toyoko Shimizu, Y-E Data, Inc Trenton Henry, SMSC Troy Davidson, Iomega Corporation Tsuyoshi Osawa, TEAC Yuji Oishi, Hagiwara Sys-Com Co Ltd Curtis E. Stevens, Phoenix Technologies Dave Gilbert, In-System Design Darrell Redford, Iomega Corporation USB Mass Storage Class Bulk Only Transport Page 2 of 31

Revision 1.0[RC3] March 29, 1999 David Jolley, Iomega Corporation David Luke, In-System Design Glen Slick, Microsoft Corporation Hiromichi Oribe, HagiwaraSys-ComCo Jim Blackson, Y-E Data, Inc Jim Quigley, Iomega Corporation Mark Williams, Microsoft Corporation Mike Glass, Microsoft Corporation Mike Poulsen, Iomega Corporation Mike Nguyen, TEAC N.R. Devanathan, Shuttle Technology Pat LaVarre, Iomega Corporation Ryota Okazaki, NEC Corporation Shing F. Lin, Adaptec Toyoko Shimizu, Y-E Data, Inc Trenton Henry, SMSC Troy Davidson, Iomega Corporation Tsuyoshi Osawa, TEAC Yuji Oishi, Hagiwara Sys-Com Co Ltd Bill Stanley, Adaptec Al Rickey, Phoenix Technologies Calaimany Bhoopathi, Shuttle Technology David G. Lawrence, Global Technology Development Eric Luttman, In-System Design Jordan Brown, Sun Microsystems Kenichi Hamada, Y-E Data, Inc Mike Chen, CMD Technology Mike Liebow, etek Labs Moto Watanabe, Hagiwara Paramita Das, Sun Microsystems Sadao Yabuki, TEAC Shigeyoshi Hashi, NEC Corporation Steven Smith, etek Labs Steve Bayless, Hewlett-Packard Tim Bradshaw, Iomega Corp Terry Moore, MCCI Masayuki Kitagawa, Mitsumi Steve Kolokowsky, Anchor Chips Alan Haffner, Lexar Media Jan matejica, PIMC/Philips Johan Craeybeckk, PIMC/Philips Peter S'Heeren, PIMC/Philips USB Mass Storage Class Bulk Only Transport Page 3 of 31

Table of Contents 1 Specification Overview and Scope...6 1.1 Scope... 6 2 Terms and Abbreviations...7 2.1 Conventions... 7 2.2 Definitions... 7 3 Functional Characteristics...8 3.1 Bulk-Only Mass Storage Reset (class-specific request)... 8 3.2 Get Max LUN (class-specific request)... 8 3.3 Host/Device Packet Transfer Order... 9 3.4 Command Queuing... 9 3.5 Bi-Directional Command Protocol... 9 4 Standard Descriptors...10 4.1 Device Descriptor... 10 4.1.1 Serial Number... 10 4.1.2 Valid Serial Number Characters... 11 4.2 Configuration Descriptor... 12 4.3 Interface Descriptors... 13 4.4 Endpoint Descriptors... 13 4.4.1 Bulk-In Endpoint... 14 4.4.2 Bulk-Out Endpoint... 14 Command/Data/Status Protocol...15 5.1 Command Block Wrapper (CBW)... 15 5.2 Command Status Wrapper (CSW)... 16 5.3 Data Transfer Conditions... 18 5.3.1 Command Transport... 18 5.3.2 Data Transport... 18 5.3.3 Status Transport... 18 5.3.4 Reset Recovery... 19 6 Host/Device Data Transfers...20 6.1 Overview... 25 6.1.1 Invalid CBW... 25 6.1.2 Internal Errors... 25 6.1.3 Overview of The Thirteen Cases... 25 6.1.4 Command Failure... 26 6.2 The Thirteen Cases... 26 6.2.1 Non-Error Cases - Host and Device are in Agreement ('the thin diagonal')... 26 6.2.2 Non-Error Cases - Host and Device are NOT in Agreement... 26 6.2.3 Phase Error Cases... 27 USB Mass Storage Class Bulk Only Transport Page 4 of 31

List of Tables Table 3.1 Bulk-Only Mass Storage Reset...8 Table 3.2 Get Max LUN...8 Table 4.1 - Device Descriptor...10 Table 4.2 - Example Serial Number Format...11 Table 4.3 - Valid Serial Number Characters...11 Table 4.4 - Configuration Descriptor...12 Table 4.5 Bulk-Only Data Interface Descriptor...13 Table 4.6 - Bulk-In Endpoint Descriptor...14 Table 4.7 Bulk-Out Endpoint Descriptor...14 Table 5.1 - Command Block Wrapper...15 Table 5.2 - Command Status Wrapper...17 Table 5.3 - Command Block Status Values...17 Table 6.1 - Host/Device Data Transfer Matrix...26 List of Figures Figure 1 - Command/Data/Status Flow... 14 Figure 2 - Status Transport Flow... 17 USB Mass Storage Class Bulk Only Transport Page 5 of 31

1 Specification Overview and Scope 1.1 Scope A familiarity with the USB 1.0 and 1.1 Specifications and the USB Mass Storage Class Specification Overview is assumed. This specification addresses Bulk-Only Transport, or in other words, transport of command, data, and status occurring solely via Bulk endpoints (not via Interrupt or Control endpoints). This specification only uses the default pipe to clear a STALL condition on the Bulk endpoints and to issue class-specific requests as defined below. This specification does not require the use of an Interrupt endpoint. This specification defines support for logical units that share common device characteristics. Although this feature provides the support necessary to allow like mass storage devices to share a common USB interface descriptor, it is not intended to be used to implement interface bridge devices. USB Mass Storage Class Bulk Only Transport Page 6 of 31

2 Terms and Abbreviations 2.1 Conventions Numbers without annotation are decimal --------------------------------------------- 1, 17, 23 Hexadecimal numbers are followed by an h ----------------------------------------- 1Fh, FCh, 38h Binary numbers are followed by a b --------------------------------------------------- 011b, 101b, 01110010b Words in italics indicate terms defined by USB or by this specification ---------- brequest, dcswtag 2.2 Definitions Command Block Wrapper (CBW) A packet containing a command block and associated information. Command Status Wrapper (CSW) A packet containing the status of a command block. Data-In Indicates a transfer of data IN from the device to the host. Data-Out Indicates a transfer of data OUT from the host to the device. Device Request Requests from the host to the device using the default pipe. Phase Error An error returned by the device indicating that the results of processing further CBWs will be indeterminate until the device is reset. Processed Data received and controlled internally by the device to the point that the host need no longer be concerned about it. Relevant The amount of the data sent to the host by the device that is significant. Reset Recovery An error recovery procedure by which the host prepares the device for further CBWs. Thin Diagonal Cases where the host and device are in complete agreement about the data transfer. See Chapter 6 - Host/Device Data Transfers, for additional information regarding error cases and the "thin diagonal." USB Mass Storage Class Bulk Only Transport Page 7 of 31

3 Functional Characteristics 3.1 Bulk-Only Mass Storage Reset (class-specific request) This request is used to reset the mass storage device and its associated interface. This class-specific request shall ready the device for the next CBW from the host. The host shall send this request via the default pipe to the device. The device shall preserve the value of its bulk data toggle bits and endpoint STALL conditions despite the Bulk-Only Mass Storage Reset. The device shall NAK the status stage of the device request until the Bulk-Only Mass Storage Reset is complete. To issue the Bulk-Only Mass Storage Reset the host shall issue a device request on the default pipe of:?? bmrequesttype: Class, Interface, host to device?? brequest field set to 255 (FFh)?? wvalue field set to 0?? windex field set to the interface number?? wlength field set to 0 Table 3.1 Bulk-Only Mass Storage Reset bmrequesttype brequest wvalue windex wlength Data 00100001b 11111111b 0000h Interface 0000h none 3.2 Get Max LUN (class-specific request) The device may implement several logical units that share common device characteristics. The host uses bcbwlun (see 5.1 Command Block Wrapper (CBW)) to designate which logical unit of the device is the destination of the CBW. The Get Max LUN device request is used to determine the number of logical unitssupported by the device. Logical Unit Numbers on the device shall be numbered contiguously starting from LUN 0 to a maximum LUN of 15 (Fh). To issue a Get Max LUN device request, the host shall issue a device request on the default pipe of:?? bmrequesttype: Class, Interface, device to host?? brequest field set to 254 (FEh)?? wvalue field set to 0?? windex field set to the interface number?? wlength field set to 1 Table 3.2 Get Max LUN bmrequesttype brequest wvalue windex wlength Data 10100001b 11111110b 0000h Interface 0001h 1 byte The device shall return one byte of data that contains the maximum LUN supported by the device. For example, if the device supports four LUNs then the LUNs would be numbered from 0 to 3 and the return value would be 3. If no LUN is associated with the device, the value returned shall be 0. The host shall not send a command block wrapper (CBW) to a non-existing LUN. Devices that do not support multiple LUNs may STALL this command. USB Mass Storage Class Bulk Only Transport Page 8 of 31

3.3 Host/Device Packet Transfer Order Revision 1.0[RC3RC4] The host shall send the CBW before the associated Data-Out, and the device shall send Data-In after the associated CBW and before the associated CSW. The host may request Data-In or CSW before sending the associated CBW. If the dcbwdatatransferlength is zero, the device and the host shall transfer no data between the CBW and the associated CSW. 3.4 Command Queuing The host shall not transfer a CBW to the device until the host has received the CSW for any outstanding CBW. If the host issues two consecutive CBWs without an intervening CSW or reset, the device response to the second CBW is indeterminate. 3.5 Bi-Directional Command Protocol This specification does not provide for bi-directional data transfer in a single command. USB Mass Storage Class Bulk Only Transport Page 9 of 31

4 Standard Descriptors The device shall support the following standard USB descriptors:?? Device. Each USB device has one device descriptor (per USB Specification).?? Configuration. Each USB device has one default configuration descriptor, which supports at least one interface.?? Interface. The device shall support at least one interface, known herein as the Bulk-Only Data Interface. Some devices may support additional interfaces, to provide other capabilities.?? Endpoint. The device shall support the following endpoints, in addition to the default pipe that is required of all USB devices: (a) Bulk-In endpoint (b) Bulk-Out endpoint Some devices may support additional endpoints, to provide other capabilities. The host shall use the first reported Bulk-In and Bulk-Out endpoints for the selected interface.?? String. The device shall supply a unique serial number as detailed in 4.1.1 - Serial Number. This specification defines no class-specific descriptors. The rest of this section describes the standard USB device, configuration, interface, endpoint, and string descriptors for the device. For superseding information about these and other standard descriptors, see Chapter 9, USB Device Framework, of the USB Specification. 4.1 Device Descriptor Each USB device has one device descriptor (per USB Specification). The device shall specify the device class and subclass codes in the interface descriptor, and not in the device descriptor. Table 4.1 - Device Descriptor Offset Field Size Value Description 0 blength Byte 12h Size of this descriptor in bytes. 1 bdescriptortype Byte 01h DEVICE descriptor type. 2 bcdusb Word????h USB Specification Release Number in Binary-Coded Decimal (i.e. 2.10 = 210h). This field identifies the release of the USB Specification with which the device and is descriptors are compliant. 4 bdeviceclass Byte 00h Class code (assigned by the USB-IF). 5 bdevicesubclass Byte 00h Subclass code (assigned by the USB-IF). 6 bdeviceprotocol Byte 00h Protocol code (assigned by the USB-IF). 7 bmaxpacketsize0 Byte??h Maximum packet size for endpoint zero. (only 8, 16, 32, or 64 are valid (08h, 10h, 20h, 40h)). 8 idvendor Word????h Vendor ID (assigned by the USB-IF). 10 idproduct Word????h Product ID (assigned by the manufacturer). 12 bcddevice Word????h Device release number in binary-coded decimal. 14 imanufacturer Byte??h Index of string descriptor describing the manufacturer. 15 iproduct Byte??h Index of string descriptor describing this product. 16 iserialnumber Byte??h Index of string descriptor describing the device s serial number. (Details in 4.1.1 below) 17 bnumconfigurations Byte??h Number of possible configurations. NOTE: Information in this table is from the USB Specification version 1.1 table 9-7. Bold text has been added for clarifications when using these descriptors with this specification. 4.1.1 Serial Number The iserialnumber field shall be set to the index of the string descriptor that contains the serial number. The serial number shall contain at least 12 valid digits, represented as a UNICODE string. The last 12 digits of the serial number shall be unique to each USB idvendor and idproduct pair. USB Mass Storage Class Bulk Only Transport Page 10 of 31

The host may generate a globally unique identifier by concatenating the 16 bit idvendor, the 16 bit idproduct and the value represented by the last 12 characters of the string descriptor indexed by iserialnumber. The field iserialnumber is an index to a string descriptor and does not contain the string itself. An example format for the String descriptor is shown below. Table 4.2 - Example Serial Number Format Offset Field Size Value Description 0 blength Byte??h Size of this descriptor in bytes - Minimum of 26 (1Ah) 1 bdescriptortype Byte 03h STRING descriptor type 2 wstring1 Word 00??h Serial number character 1 4 wstring2 Word 00??h Serial number character 2 6 wstring3 Word 00??h Serial number character 3 : : Word : : : : Word : : : : Word : : n x 2 wstringn Word 00??h Serial number character n Shall be at least 12 characters long 4.1.2 Valid Serial Number Characters The following table defines the valid characters that the device shall use for the serial number. Table 4.3 - Valid Serial Number Characters Numeric ASCII 0030h through 0039h "0" through "9" 0041h through 0046h "A" through "F" USB Mass Storage Class Bulk Only Transport Page 11 of 31

4.2 Configuration Descriptor Table 4.4 - Configuration Descriptor Offset Field Size Value Description 0 blength Byte 09h Size of this descriptor in bytes. 1 bdescriptortype Byte 02h CONFIGURATION Descriptor Type. 2 wtotallength Word????h Total length of data returned for this configuration. Includes the combined length of all descriptors (configuration, interface, endpoint, and class- or vendor-specific) returned for this configuration. 4 bnuminterfaces Byte??h Number of interfaces supported by this configuration. The device shall support at least the Bulk-Only Data Interface. 5 bconfigurationvalue Byte??h Value to use as an argument to the SetConfiguration() request to select this configuration. 6 iconfiguration Byte??h Index of string descriptor describing this configuration. 7 bmattributes Byte?0h Configuration characteristics: Bit Description 7 Reserved (set to one) 6 Self-powered 5 Remote Wakeup 4..0 Reserved (reset to zero) Bit 7 is reserved and must be set to one for historical reasons. For a full description of this bmattributes bitmap, see the USB 1.1 Specification. 8 MaxPower Byte??h Maximum power consumption of the USB device from the bus in this specific configuration when the device is fully operational. Expressed in 2mA units (i.e. 50 = 100mA) NOTE: Information in this table is from the USB Specification version 1.1 table 9-8. Bold text has been added for clarifications when using these descriptors with this specification. USB Mass Storage Class Bulk Only Transport Page 12 of 31

4.3 Interface Descriptors The device shall support at least one interface, known herein as the Bulk-Only Data Interface. The Bulk-Only Data Interface uses three endpoints. Composite mass storage devices may support additional interfaces, to provide other features such as audio or video capabilities. This specification does not define such interfaces. The interface may have multiple alternate settings. The host shall examine each of the alternate settings to look for the binterfaceprotocol and binterfacesubclass it supports optimally. Table 4.5 Bulk-Only Data Interface Descriptor Offset Field Size Value Description 0 blength Byte 09h Size of this descriptor in bytes. 1 bdescriptortype Byte 04h INTERFACE Descriptor Type. 2 binterfacenumber Byte 0?h Number of interface. Zero-based value identifying the index in the array of concurrent interfaces supported by this configuration. 3 balternatesetting Byte??h Value used to select alternate setting for the interface identified in the prior field. 4 bnumendpoints Byte??h Number of endpoints used by this interface (excluding endpoint zero). This value shall be at least 2. 5 binterfaceclass Byte 08h MASS STORAGE Class. 6 binterfacesubclass Byte 0?h Subclass code (assigned by the USB-IF). Indicates which industry standard command block definition to use. Does not specify a type of storage device such as a floppy disk or CD-ROM drive. (See USB Mass Storage Overview Specification) 7 binterfaceprotocol Byte??h BULK-ONLY TRANSPORT. (See USB Mass Storage Overview Specification) 8 iinterface Byte??h Index to string descriptor describing this interface. NOTE: Information in this table is from the USB Specification version 1.1 table 9-9. Bold text has been added for clarifications when using these descriptors with this specification. 4.4 Endpoint Descriptors The device shall support at least three endpoints: Control, Bulk-In and Bulk-Out. Each USB device defines a Control endpoint (Endpoint 0). This is the default endpoint and does not require a descriptor. USB Mass Storage Class Bulk Only Transport Page 13 of 31

4.4.1 Bulk-In Endpoint The Bulk-In endpoint is used for transferring data and status from the device to the host. Table 4.6 - Bulk-In Endpoint Descriptor Offset Field Size Value Description 0 blength Byte 07h Size of this descriptor in bytes. 1 bdescriptortype Byte 05h ENDPOINT Descriptor Type. 2 bendpointaddress Byte 8?h The address of this endpoint on the USB device. The address is encoded as follows. Bit Description 3..0 The endpoint number 6..4 Reserved, set to 0 7 1 = In 3 bmattributes Byte 02h This is a Bulk endpoint. 4 wmaxpacketsize Word 00??h Maximum packet size. Shall be 8, 16, 32 or 64 bytes (08h, 10h, 20h, 40h). 6 binterval Byte 00h Does not apply to Bulk endpoints. 4.4.2 Bulk-Out Endpoint The Bulk-Out endpoint is used for transferring command and data from the host to the device. Table 4.7 Bulk-Out Endpoint Descriptor Offset Field Size Value Description 0 blength Byte 07h Size of this descriptor in bytes. 1 bdescriptortype Byte 05h ENDPOINT descriptor type. 2 bendpointaddress Byte 0?h The address of this endpoint on the USB device. This address is encoded as follows: Bit Description 0..33..0 Endpoint number 4..66..4 Reserved, set to 0 7 0 = Out 3 bmattributes Byte 02h This is a Bulk endpoint. 4 wmaxpacketsize Word 00??h Maximum packet size. Shall be 8, 16, 32 or 64 bytes (08h, 10h, 20h, or 40h). 6 binterval Byte 00h Does not apply to Bulk endpoints. USB Mass Storage Class Bulk Only Transport Page 14 of 31

5 Command/Data/Status Protocol Figure 1 - Command/Data/Status Flow shows the flow for Command Transport, Data-In, Data-Out and Status Transport. The following sections define Command and Status Transport. Figure 2 - Status Transport Flow shows a detailed diagram of Status Transport. The following sections outline the various conditions for host/device communication, possible errors, and recovery procedures. 5.1 Command Block Wrapper (CBW) The CBW shall start on a packet boundary and shall end as a short packet with exactly 31 (1Fh) bytes transferred. Fields appear aligned to byte offsets equal to a multiple of their byte size. All subsequent data and the CSW shall start at a new packet boundary. All CBW transfers shall be ordered with the LSB (byte 0) first (little endian). Refer to the USB Specification Terms and Abbreviations for clarification. Data - Out (from host) Ready Command Transport (CBW) Status Transport (CSW) Data - In (to host) Figure 1 - Command/Data/Status Flow Table 5.1 - Command Block Wrapper bit Byte 7 6 5 4 3 2 1 0 0-3 dcbwsignature 4-7 dcbwtag 8-11 (08h-0Bh) 12 (0Ch) 13 (0Dh) 14 (0Eh) 15-30 (0Fh-1Eh) dcbwsignature: Reserved (0) Reserved (0) dcbwdatatransferlength bmcbwflags CBWCB bcbwlun bcbwcblength Signature that helps identify this data packet as a CBW. The signature field shall contain the value 43425355h (little endian), indicating a CBW. dcbwtag: A Command Block Tag sent by the host. The device shall echo the contents of this field back to the host in the dcswtag field of the associated CSW. The dcswtag positively associates a CSW with the corresponding CBW. dcbwdatatransferlength: The number of bytes of data that the host expects to transfer on the Bulk-In or Bulk-Out endpoint (as indicated by the Direction bit) during the execution of this command. If this field is zero, the device and the host shall transfer no data between the CBW and the associated CSW, and the device shall ignore the value of the Direction bit in bmcbwflags. USB Mass Storage Class Bulk Only Transport Page 15 of 31

bmcbwflags: The bits of this field are defined as follows: Bit 7 Direction - the device shall ignore this bit if the dcbwdatatransferlength field is zero, otherwise: 0 = Data-Out from host to the device, 1 = Data-In from the device to the host. Bit 6 Obsolete. The host shall set this bit to zero. Bits 5..0 Reserved - the host shall set these bits to zero. bcbwlun: The device Logical Unit Number (LUN) to which the command block is being sent. For devices that support multiple LUNs, the host shall place into this field the LUN to which this command block is addressed. Otherwise, the host shall set this field to zero. bcbwcblength: The valid length of the CBWCB in bytes. This defines the valid length of the command block. The only legal values are 1 through 16 (01h through 10h). All other values are reserved. CBWCB: The command block to be executed by the device. The device shall interpret the first bcbwcblength bytes in this field as a command block as defined by the command set identified by binterfacesubclass. If the command set supported by the device uses command blocks of fewer than 16 (10h) bytes in length, the significant bytes shall be transferred first, beginning with the byte at offset 15 (Fh). The device shall ignore the content of the CBWCB field past the byte at offset (15 + bcbwcblength - 1). The device shall consider the CBW valid only when:?the CBW is 31 (1Fh) bytes in length,?the dcbwsignature contains the proper value,?the bcbwlun contains a valid LUN,?and the bcbwcblength is valid. 5.2 Command Status Wrapper (CSW) The CSW shall start on a packet boundary and shall end as a short packet with exactly 13 (0Dh) bytes transferred. Fields appear aligned to byte offsets equal to a multiple of their byte size. All CSW transfers shall be ordered with the LSB (byte 0) first (little endian). Refer to the USB Specification Terms and Abbreviations for clarification. USB Mass Storage Class Bulk Only Transport Page 16 of 31

Table 5.2 - Command Status Wrapper bit Byte 7 6 5 4 3 2 1 0 0-3 dcswsignature 4-7 dcswtag 8-11 (8-Bh) 12 (Ch) dcswdataresidue bcswstatus dcswsignature: Signature that helps identify this data packet as a CSW. The signature field shall contain the value 53425355h (little endian), indicating CSW. dcswtag: The device shall set this field to the value received in the dcbwtag of the associated CBW. dcswdataresidue: For Data-Out the device shall report in the dcswdataresidue the difference between the amount of data expected as stated in the dcbwdatatransferlength, and the actual amount of data processed by the device. For Data-In the device shall report in the dcswdataresidue the difference between the amount of data expected as stated in the dcbwdatatransferlength and the actual amount of relevant data sent by the device. The dcswdataresidue shall not exceed the value sent in the dcbwdatatransferlength. bcswstatus: bcswstatus indicates the success or failure of the command. The device shall set this byte to zero if the command completed successfully. A non-zero value shall indicate a failure during command execution according to the following table: Table 5.3 - Command Block Status Values Value 00h 01h 02h 03h and 04h 05h to FFh Description Command Passed ("good status") Command Failed Phase Error Reserved (Obsolete) Reserved The host shall consider the CSW valid only when:?the CSW is 13 (Dh) bytes in length,?the dcswsignature contains the proper value,?and the dcswtag matches the dcbwtag from the corresponding CBW. USB Mass Storage Class Bulk Only Transport Page 17 of 31

5.3 Data Transfer Conditions This section describes how the host and device remain synchronized. Enter The host indicates the expected transfer in the CBW using the Direction bit and the dcbwdatatransferlength field. The device then determines the actual direction and data transfer length. The device responds as defined in 6 - Host/Device Data Transfersbelow by transferring data, STALLing endpoints when necessaryspecified, and returning the appropriate CSW. Attempt to read CSW from Bulk-In endpoint STALL Bulk-In - OR - Bulk Error? Yes Clear the STALL condition Attempt to read CSW from Bulk-In endpoint 5.3.1 Command Transport The host shall send each CBW, which contains a command block, to the device via the Bulk-Out endpoint. The CBW shall start on a packet boundary and end as a short packet with exactly 31 (1Fh) bytes transferred. No CSW Valid? No No Bulk-IN endpoint STALLed? The device shall indicate a successful transport of a CBW by accepting (ACKing) the CBW. If the CBW is not valid see 6.6.1 - CBW Not Valid.device detects that the CBW is invalid (see 5.1 - Command Block Wrapper (CBW)), then the device shall STALL both Bulk endpoints and require a Bulk-Only Mass Storage Reset. If the host detects a STALL of the Bulk-Out endpoint during command transport, the host shall respond with a Reset Recovery (see 5.3.4 - Reset Recovery). Yes Phase Error Status? No Yes Yes Perform Reset Recovery 5.3.2 Data Transport All data transport shall begin on a packet boundary. The host shall attempt to transfer the exact number of bytes to or from the device as specified by the Figure 2 - Status Transport Flow dcbwdatatransferlength and the Direction bit. The device shall respond as specified in 6 - Host/Device Data Transfers. To report an error before data transport completes and to maximize data integrity, the device may terminate the command by STALLing the endpoint in use (the Bulk-In endpoint during data in, the Bulk-Out endpoint during data out). 5.3.3 Status Transport The device shall send each CSW to the host via the Bulk-In endpoint. The CSW shall start on a packet boundary and end as a short packet with exactly 13 (Dh) bytes transferred. Figure 2 - Status Transport Flow defines the algorithm the host shall use for any CSW transfer. The CSW indicates to the host the status of the execution of the command block from the corresponding CBW. The dcswdataresidue field indicates how much of the data transferred is to be considered processed or relevant. The host shall ignore any data received beyond that which is relevant. 5.3.3.1 Phase Error Device ready to process next CBW The host shall perform a Reset Recovery when Phase Error status is returned in the CSW. USB Mass Storage Class Bulk Only Transport Page 18 of 31

5.3.4 Reset Recovery For Reset Recovery the host shall issue in the following order: : (a) a Bulk-Only Mass Storage Reset (b) a Clear Feature HALT to the Bulk-In endpoint (c) a Clear Feature HALT to the Bulk-Out endpoint USB Mass Storage Class Bulk Only Transport Page 19 of 31

6 Host/Device Data Transfers 6.1 Overview A Bulk-Only Protocol transaction begins with the host sending a CBW to the device and attempting to make the appropriate data transfer (In, Out or none). The device receives the CBW, checks and interprets it, attempts to satisfy the host's request, and returns status via a CSW. This section describes in more detail this interaction between the host and the device during normal and abnormal Bulk-Only Protocol transactions. 6.2 Valid and Meaningful CBW The host communicates its intent to the device through the CBW. The device performs two verifications on every CBW received. First, the device verifies that what was received is a valid CBW. Next, the device determines if the data within the CBW is meaningful. The device shall not use the contents of the dcbwtag in any way other than to copy its value to the dcswtag of the corresponding CSW. 1.1.16.2.1 Valid CBW The device shall consider the CBW valid when:?? The CBW was received after the device had sent a CSW or after a reset,?? the CBW is 31 (1Fh) bytes in length,?? and the dcbwsignature is equal to 43425355h. 6.2.2 Meaningful CBW The device shall consider the contents of a valid CBW meaningful when:?? no reserved bits are set,?? the bcbwlun contains a valid LUN supported by the device,?? and both bcbwcblength and the content of the CBWCB are in accordance with binterfacesubclass. 6.3 Valid and Meaningful CSW The device generally communicates the results of its attempt to satisfy the host s request through the CSW. The host performs two verifications on every CSW received. First, the host verifies that what was received is a valid CSW Next, the host determines if the data within the CSW is meaningful. 1.1.16.3.1 Valid CSW The host shall consider the CSW valid when:?? the CSW is 13 (Dh) bytes in length,?? and the dcswsignature is equal to 53425355h,?? the dcswtag matches the dcbwtag from the corresponding CBW. 6.3.2 Meaningful CSW The host shall consider the contents of the CSW meaningful when: either the bcswstatus value is 00h or 01h and the dcswdataresidue is less than or equal to dcbwdatatransferlength.. or the bcswstatus value is 02h. 6.4 Device Error Handling The device may not be able to fully satisfy the host's request. At the point when the device discovers that it cannot fully satisfy the request, there may be a Data-In or Data-Out transfer in progress on the bus, and the host may have other pending requests. The device may cause the host to terminate such transfers by STALLing the appropriate pipe. USB Mass Storage Class Bulk Only Transport Page 20 of 31

The response of a device to a CBW that is not meaningful is not specified. Revision 1.0[RC3RC4] Please note that whether or not a STALL handshake actually appears on the bus depends on whether or not there is a transfer in progress at the point in time when the device is ready to STALL the pipe. 6.5 Host Error Handling If the host receives a CSW which is not valid, then the host shall perform a Reset Recovery. If the host receives a CSW which is not meaningful, then the host may perform a Reset Recovery. 6.6 Error Classes In every transaction between the host and the device, there are four possible classes of errors. These classes are not always independent of each other and may occur at any time during the transaction. 1.1.16.6.1 CBW Not Valid If the CBW is not valid, the device shall STALL the Bulk-In pipe. Also, the device shall either STALL the Bulk-Out pipe, or the device shall accept and discard any Bulk-Out data. The device shall maintain this state until a Reset Recovery. 1.1.26.6.2 Internal Device Error The device may detect an internal error for which it has no reliable means of recovery other than a reset. The device shall respond to such conditions by: either or STALLing any data transfer in progress and returning a Phase Error status (bcswstatus = 02h). STALLing all further requests on the Bulk-In and the Bulk-Out pipes until a Reset Recovery. 1.1.36.6.3 Host/Device Disagreements After recognizing that a CBW is valid and meaningful, and in the absence of internal errors, the device may detect a condition where it cannot meet the host s expectation for data transfer, as indicated by the Direction bit of the bmcbwflags field and the dcbwdatatransferlength field of the CBW. In some of these cases, the device may require a reset to recover. In these cases, the device shall return Phase Error status (bcswstatus = 02h). Details on which cases result in Phase Error vs. non-phase Error status are given in 6.7 The Thirteen Cases. 1.1.46.6.4 Command Failure After recognizing that a CBW is valid and meaningful, the device may still fail in its attempt to satisfy the command. The device shall report this condition by returning a Command Failed status (bcswstatus = 01h). 6.7 The Thirteen Cases This section describes the thirteen possible cases of host expectations and device intent in the absence of overriding error conditions. Table 6.1 Host/Device Data Transfer Matrix graphically displays these thirteen cases. Important notes about the thirteen cases.?? Cases (1), (6) and (12) represent the majority of host and device transactions. They indicate those conditions where the host and device agree as to the direction and amount of data to be transferred. These cases are also referred to as the thin diagonal.?? Any host or device behavior not specifically outlined in the following sections shall be considered outside this specification and the results are indeterminate. USB Mass Storage Class Bulk Only Transport Page 21 of 31

Table 6.1 - Host/Device Data Transfer Matrix HOST Hn Hi Ho Dn (1) Hn = Dn (4) Hi > Dn (9) Ho > Dn DEVICE Di (2) Hn < Di (5) Hi > Di (6) Hi = Di (7) Hi < Di Do (3) Hn < Do (8) Hi <> Do (10) Ho <> Di (11) Ho > Do (12) Ho = Do (13) Ho < Do LEGEND Host Expectation Hn Host expects no data transfers Hi Host expects to receive data from the device Ho Host expects to send data to the device Device Intent Dn Device intends to transfer no data Di Device intends to send data to the host Do Device intends to receive data from the host 6.7.1 Hn - Host expects no data transfers These cases occur when dcbwdatatransferlength is zero. This indicates that the host is not expecting to send or receive any data to or from the device. The general requirements of these cases are:?? The value of the Direction bit shall not influence the results of these cases. The specific host requirements are: 1. The host shall send a valid and meaningful CBW.?? The host may set or clear the Direction bit. 2. The host shall attempt to receive a CSW. 3. On a STALL condition receiving the CSW, then:?? The host shall clear the Bulk-In pipe.?? The host shall attempt to receive the CSW again. 4. When the CSW is valid and meaningful, then:?? [Case (1)] The bcswstatus = 00h or 01h, and the dcswdataresidue is 0.?? [Case (2) or (3)] If bcswstatus = 02h, then: The host shall Ignore the value of the dcswdataresidue. The host shall Perform a Reset Recovery. The specific device requirements are: 1. The device shall receive a CBW. 2. When the CBW is valid and meaningful, then:?? The device shall attempt the command. Cases: (1) Hn = Dn (2) Hn < Di (3) Hn < Do USB Mass Storage Class Bulk Only Transport Page 22 of 31

?? [Case (1)] If the device had no data to send or receive, then: The device shall set bcswstatus to 00h or 01h. The device shall set the dcswdataresidue to 0.?? [Case (2) or (3)] If the device did have data to send or receive, then: The device shall set bcswstatus to 02h. 3. The device shall return a valid and meaningful CSW.?? The device may STALL the Bulk-In pipe if bcswstatus is not 00h or 01h. 6.7.2 Hi - Host expects to receive data from the device These cases occur when dcbwdatatransferlength is non zero and the Direction bit is 1 (Data-In). This indicates that the host is expecting to receive data from the device. The specific host requirements are: 1. The host shall send a valid and meaningful CBW. 2. The host shall attempt to receive data from the device. 3. On a STALL condition receiving data, then:?? The host shall accept the data received.?? The host shall clear the Bulk-In pipe. 4. The host shall attempt to receive a CSW. 5. On a STALL condition receiving the CSW, then:?? The host shall clear the Bulk-In pipe.?? The host shall again attempt to receive the CSW. 6. When the CSW is valid and meaningful, then:?? [Case (4), (5), or (6)] If bcswstatus = 00h or 01h, then: The host shall determine the amount of relevant data received from the difference between dcbwdatatransferlength and the value of dcswdataresidue.?? [Case (7) or (8)] If bcswstatus = 02h, then: The host shall ignore the value of the dcswdataresidue. The host shall perform a Reset Recovery. The specific device requirements are: Cases: (4) Hi > Dn (5) Hi > Di (6) Hi = Di (7) Hi < Di (8) Hi <> Do 1. The device shall receive a CBW. 2. When the CBW is valid and meaningful, then:?? The device shall attempt the command.?? [Case (6)] If the device intends to send dcbwdatatransferlength, then: The device shall send dcbwdatatransferlength bytes of data. The device shall set bcswstatus to 00h or 01h. The device shall set dcswdataresidue to zero.?? [Case (4)or (5)] If the device intends to send less data than the host indicated, then: The device shall send the intended data. The device may send fill data to pad up to a total of dcbwdatatransferlength. If the device actually transfers less data than the host indicated, then: The device may end the transfer with a short packet. The device shall STALL the Bulk-In pipe. The device shall set bcswstatus to 00h or 01h. The device shall set dcswdataresidue to the difference between dcbwdatatransferlength and the actual amount of relevant data sent. USB Mass Storage Class Bulk Only Transport Page 23 of 31

?? [Case (7) or (8)] If the device either intends to send more data than the host indicated or intends to receive data from the host, then: The device may send data up to a total of dcbwdatatransferlength. If the device actually transfers less data than the host indicated, then: The device may end the transfer with a short packet. The device shall STALL the Bulk-In pipe. If the device actually transfers dcbwdatatransferlength then: The device may STALL the Bulk-In pipe. The device shall set bcswstatus to 02h. 3. The device shall return a valid and meaningful CSW: 6.7.3 Ho - Host expects to send data to the device These cases occur when dcbwdatatransferlength is non zero-and the Direction bit is 0 (Data-Out). This indicates that the host is expecting to send data to the device. The general requirement of these cases is:?? The host shall not send zero length packets. Cases: (9) Ho > Dn (10) Ho <> Di (11) Ho > Do (12) Ho = Do (13) Ho < Do The specific host requirements are: 1. The host shall send a valid and meaningful CBW. 2. The host shall send data to the device.?? The host shall send a short packet only at the end of the data transfer. 3. On a STALL condition sending data, then:?? The host shall clear the Bulk-Out pipe. 4. The host shall attempt to receive a CSW. 5. On a STALL condition receiving the CSW, then:?? The host shall clear the Bulk-In pipe.?? The host shall again attempt to receive the CSW. 6. When the CSW is valid and meaningful, then:?? [Case (9), (11), or (12)] If bcswstatus = 00h or 01h, then: The host shall determine the amount of data that was processed from the difference of dcbwdatatransferlength and the value of dcswdataresidue.?? [Case (10) or (13)] If bcswstatus = 02h, then: The host shall ignore the value of the dcswdataresidue. The host shall perform a Reset Recovery. The specific device requirements are: 1. The device shall receive a CBW. 2. When the CBW is valid and meaningful, then:?? The device shall attempt the command.?? [Case (9), (11), or (12)] If the device intends to process less than or equal to the amount of data that the host indicated, then: The device shall receive the intended data. The device shall either accept a total of dcbwdatatransferlength, or end the transfer prematurely by STALLing the Bulk-Out pipe. The device shall set bcswstatus to 00h or 01h. The device shall set dcswdataresidue to the difference between dcbwdatatransferlength and the actual amount of data that was processed by the device.?? [Case (10) or (13)] If the device either intends to process more data than the host indicated or intends to send data, then: USB Mass Storage Class Bulk Only Transport Page 24 of 31

The device may receive data up to a total of dcbwdatatransferlength. The device shall either accept a total of dcbwdatatransferlength, or end the transfer prematurely by STALLing the Bulk-Out pipe. The device shall set bcswstatus to 02h. 3. The device shall return a valid and meaningful CSW.?? The device may STALL the Bulk-In pipe if bcswstatus is not 00h or 01h. 6.1Overview As outlined in 0 The host shall consider the CSW valid only when:?the CSW is 13 (Dh) bytes in length,?the dcswsignature contains the proper value,?and the dcswtag matches the dcbwtag from the corresponding CBW. Data Transfer Conditions, a Bulk-Only Protocol transaction begins with the host sending a CBW to the device and attempting to make the appropriate data transfer (In, Out or none). The device receives the CBW, checks and interprets it, attempts to satisfy the host's request, and returns status via a CSW. The device may not be able to fully satisfy the host's request. At the point when the device discovers that it cannot fully satisfy the request, there may be a Data-In or Data-Out transfer in progress on the bus, and the host may have other pending requests. The device can cause the host to terminate such transfers by STALLing the appropriate pipe. Whether or not a STALL handshake actually appears on the bus depends on whether or not there is a transfer in progress at the point in time when the device is ready to STALL the pipe. In this section, the phrase "STALL the pipe" is used to mean "send a STALL handshake in response to any further data request on the pipe." The information Annex A summarizes host and device interaction from the host point of view. There are four possible classes of errors that may occur in a transaction between the host and the device. These errors are listed in the four sections that follow and are summarized in the informative Annex B. 6.1.1Invalid CBW The device may recognize the CBW itself as being invalid. See 5.1 - Command Block Wrapper (CBW) for information on CBW requirements. The device shall respond to an invalid CBW by STALLing both Bulk endpoints as described in 5.3.1 - Command Transport. 6.1.2Internal Errors The device may detect at any time an internal error for which it has no reliable means of recovery other than a reset. The device shall respond to such a condition by: either: STALLing any data transfer in progress (see 5.3.2 - Data Transport) and returning a CSW with the dcswdataresidue set to the difference between the amount of data expected, as stated in the dcbwdatatransferlength, and the amount of relevant data sent or data processed by the device prior to reporting the error. or: STALLing all further request until reset. 6.1.3Overview of The Thirteen Cases In the absence of internal errors, the device may detect a case where it cannot meet the host's expectation for data transfer as indicated by the Direction bit of the bmcbwflags field and the dcbwdatatransferlength field of the CBW. Some cases regarding host/device disagreements require a reset to recover. These cases shall result in the device returning Phase Error status (bcswstatus = 02h). Host/Device data transfer conditions are described in 6.2 - The Thirteen Cases. USB Mass Storage Class Bulk Only Transport Page 25 of 31

6.1.4Command Failure Revision 1.0[RC3RC4] Even if none of the errors described in 6.1.1 - Invalid CBW through 6.1.2 - Internal Errors occur, the device may still fail to execute the command. If this occurs, the device shall report Command Failed status (bcswstatus = 01h). 6.2The Thirteen Cases This section discusses the thirteen possible cases of host expectations, device intent and actual device behavior. Table 6.1 - Host/Device Data Transfer Matrix is referenced throughout this section. Subsequent text outlines the required host and device behavior for each of the thirteen cases. The cases of host and device agreement, i.e. cases 1, 6, and 12, (also known as the "thin diagonal") are shaded in Table 6.1 Table 6.1 - Host/Device Data Transfer Matrix HOST Hn Hi Ho Dn (1) Hn = Dn (4) Hi > Dn (9) Ho > Dn DEVICE Di (2) Hn < Di (5) Hi > Di (6) Hi = Di (7) Hi < Di Do (3) Hn < Do (8) Hi <> Do (10) Ho <> Di (11) Ho > Do (12) Ho = Do (13) Ho < Do LEGEND Host Expectation Hn Host expects no data transfers Hi Host expects to receive data from the device Ho Host expects to send data to the device Device Intent Dn Device intends to transfer no data Di Device intends to send data to the host Do Device intends to receive data from the host 6.2.1Non-Error Cases - Host and Device are in Agreement ('the thin diagonal') Cases: (1) Hn = Dn (6) Hi = Di (12) Ho = Do These cases occur when both the host and device agree on the direction and amount of data to be transferred. Transfer begins with a CBW. For data transfer commands (cases 6 and 12), the host and device shall transfer the amount of data specified in the CBW. For all these cases, the host shall request a CSW and the device shall not STALL any endpoint, but shall respond with non Phase Error status and a dcswdataresidue value of zero in the CSW. 6.2.2Non-Error Cases - Host and Device are NOT in Agreement Cases: (4) Hi > Dn (5) Hi > Di USB Mass Storage Class Bulk Only Transport Page 26 of 31

These cases occur when the host expects to receive more data than the device actually transfers. Revision 1.0[RC3RC4] The device shall either: transfer the amount of data available (Dn or Di), end the transfer with a short packet, and then STALL the Bulk-In endpoint. or: transfer the amount of data expected (Hi), padding as necessary with fill data. The device shall then return status in the CSW. If the device transfers no data, case (4), the device shall set dcswdataresidue to the value received in the dcbwdatatransferlength. If the device transfers data, case (5), the dcswdataresidue shall contain the difference between the amount of data expected as stated in the dcbwdatatransferlength and the amount of relevant data sent by the device. Cases: (9) Ho > Dn (11) Ho > Do These cases occur when the host expects to send more data to the device than the device actually expects. The device shall either: transfer the amount of data acceptable (Dn or Do), and then shall STALL the Bulk-Out endpoint. or: transfer the amount of data expected (Ho). The device shall then return status in the CSW. If the device transfers no data, case (9), the device shall set dcswdataresidue to the value received in the dcbwdatatransferlength. If the device transfers data, case (11), the dcswdataresidue shall contain the difference between the amount of data expected as stated in the dcbwdatatransferlength and the actual amount of data processed by the device. 6.2.3Phase Error Cases Cases: (2) Hn < Di (3) Hn < Do These cases occur when the Host is expecting no data to be transferred, but the device intends to transfer data either to or from the host. The device may STALL the Bulk-In endpoint and then shall return the CSW. The CSW shall indicate a Phase Error and shall contain a zero value in the dcswdataresidue. Case: (8) Hi <> Do This case occurs when the host expects to receive data from the device, while the device intends to receive data from the host. If this occurs the device shall STALL the Bulk-In endpoint and indicate Phase Error in the CSW. The device shall return the value of the dcbwdatatransferlength in the dcswdataresidue. Case: (10) Ho <> Di This case occurs when the host expects to send data to the device while the device intends to send data to the host. If this occurs the device shall STALL the Bulk-Out endpoint and indicate Phase Error in the CSW. The device shall return the value of the dcbwdatatransferlength in the dcswdataresidue. Case: (7) Hi < Di USB Mass Storage Class Bulk Only Transport Page 27 of 31