Renesas V850E2 Quick start guide

APPLICATION NOTE
R01AN0011EJ0102 Rev.1.02 Page 1 of 151
Jan 23, 2012
V850E2/MN4
USB MSC (Mass Storage Class) Driver
Summary
This application note describes the sample MSC (Mass Storage Class) driver for the USB function controller that is
incorporated in the V850E2/MN4 microcontroller.
The application note consists primarily of the following parts:
•Sampler driver specifications
•Environment for developing application programs that make use of the sample driver
•Reference information that is useful for using the sample driver
Target Device
RTE-V850E2/MN4-EB-S incorporating the V850E2/MN4 (μPD70F3512)
Contents
1. Introduction........................................................................................................................................2
2. Overview ...........................................................................................................................................3
3. USB Overview.................................................................................................................................10
4. Sample Driver Specifications..........................................................................................................20
5. Development Environment............................................................................................................110
6. Sample Driver Application.............................................................................................................142
7. Outline of the Starter Kit................................................................................................................149
R01AN0011EJ0102
Rev.1.02
Jan 23, 2012

V850E2/MN4 USB MSC (Mass Storage Class) Driver
R01AN0011EJ0102 Rev.1.02 Page 2 of 151
Jan 23, 2012
1. Introduction
1.1 Note
The sample program introduced in this application note is provided only for reference purposes. Renesas does not
guarantee normal operation of the sample program under any circumstances.
When using the sample program, make extensive evaluations of the driver on a user’s set.
1.2 Intended Audiences
This application note is intended for the users who have basic understanding of the capabilities of the V850E2/MN4
microcontroller and who are to develop application systems utilizing that microcontroller.
1.3 Objective
The objective of this application note is to help the users acquire an understanding of the specifications for the
sample program for utilizing the USB function controller incorporated in the V850E2/MN4 microcontroller.
1.4 Organization
This application note is divided into the following topics:
•Overview of the USB standards
•Specifications for the sample driver
•Development environment (CubeSuite, Multi (Note1), or IAR Embedded Workbench (Note2))
•Application of the sample driver
(Note 1) Multi is a registered trademark of Green Hills SoftwareTM, Inc.
(Note 2) IAR Embedded Workbench is a registered trademark of IAR Systems AB.
1.5 How to Read this Document
The readers of this document are assumed to have general knowledge about electronics, logic circuits, and
microcontrollers.
⎯If you want to know the hardware capabilities and electrical characteristics of the V850E2/MN4 microcontroller
→Refer to the separately available V850E2/MN4 Microcontroller User’s Manual [Hardware].
⎯If you want to know the instruction set of the V850E2/MN4 microcontroller
→Refer to the separately available V850E2M User’s Manual [Architecture].

V850E2/MN4 USB MSC (Mass Storage Class) Driver
R01AN0011EJ0102 Rev.1.02 Page 3 of 151
Jan 23, 2012
2. Overview
This application note describes the sample MSC (Mass Storage Class) driver for the USB function controller
incorporated in the V850E2/MN4 microcontroller. It is composed of the following topics:
•Specifications for the sample driver
•Environment for developing application programs that are to use the sample driver
•Reference information useful for making use of the sample driver
In this section, an overview of the sample driver and the description of the applicable microcontrollers are
introduced.
2.1 Overview
2.1.1 Features of the USB Function Controller
The USB function controller of the V850E2/MN4 microcontroller, which is the control target of this sample
driver, has the features listed below.
•Conforms to the USB (Universal Serial Bus Specification) 2.0.
•Operates as a full-speed (12 Mbps) device.
•Endpoints are configured as summarized in the table below.
Table 2.1 V850E2/MN4 Microcontroller’s Endpoint Configuration
Endpoint Name FIFO Size (Bytes) Transfer Type Remarks
Endpoint0 Read 64 Control transfer (IN) ⎯
Endpoint0 Write 64 Control transfer (OUT) ⎯
Endpoint1 64 ×2 Bulk transfer 1 (IN) 2-buffer configuration
Endpoint2 64 ×2 Bulk transfer 1 (OUT) 2-buffer configuration
Endpoint3 64 ×2 Bulk transfer 2 (IN) 2-buffer configuration
Endpoint4 64 ×2 Bulk transfer 2 (OUT) 2-buffer configuration
Endpoint7 64 Interrupt transfer (IN) ⎯
Endpoint8 64 Interrupt transfer (IN) ⎯
•Automatically responds to USB standard requests (except part of requests)
•Bus-powered or self-powered mode selectable
•Internal or external clock selectable (Note 2)
Internal clock: External 9.6 MHz ×20 (internally) ÷4 (48 MHz)
or External 7.2 MHz ×20 (internally) ÷3 (48 MHz)
External clock: Input to the USBCLK pin (fUSB = 48 MHz)
(Note 2) The internal clock is selected for the sample driver.

V850E2/MN4 USB MSC (Mass Storage Class) Driver
R01AN0011EJ0102 Rev.1.02 Page 4 of 151
Jan 23, 2012
2.1.2 Features of the Sample Driver
The MSC (Mass Storage Class) sample driver for the V850E2/MN4 microcontroller has the features listed below.
For details about the features and operations of the sample driver, see section 4, Sample Driver Specifications.
•Operates as a self-powered device.
•Recognized as a bulk-only device of the mass storage class when connected to the host.
•Can be formatted for arbitrary file systems by the host.
•Allows file and folder data to be written into internal RAM.
•Allows the file and folder data to be read out of internal RAM.
•Occupies memory areas of the following sizes (excluding that of the vector table):
ROM: Approx. 9.0 Kbytes
RAM: Approx. 25.5 Kbytes (Note 3)
(Note3) 24 Kbytes of the RAM area (approx. 25.5 Kbytes) is used as the data storage area.
For this reason, the data in the storage area is initialized when device power is turned off or
when the Reset SW is pressed.

V850E2/MN4 USB MSC (Mass Storage Class) Driver
R01AN0011EJ0102 Rev.1.02 Page 5 of 151
Jan 23, 2012
2.1.3 Sample Driver Configuration
The sample driver is available in three versions, i.e., the CubeSuite version, the Multi version, and the IAR
Embedded Workbench version. Use the correct version of the sample driver according to your development
environment.
Each version of the sample driver is made up of the files that are described below.
(1) CubeSuite Version
The CubeSuite version of the sample driver comprises files that are summarized below.
Table 2.2 CubeSuite Version Sample Driver File Configuration
Folder File Outline
main.c Main routine
scsi_cmd.c SCSI command processing
usbf850.c USB initialization, endpoint control, bulk transfer, and control transfer
usbf850_storage.c MSC-specific processing
src
cstart.asm Bootstrap
main.h main.c function prototype declaration
scsi.h SCSI related macro definitions
usbf850.h usbf850.c function prototype declarations
usbf850_desc.h Descriptor definitions
usbf850_errno.h Error code definitions
usbf850_storage.h usbf850_storage.c function prototype declarations
usbf850_types.h User type declarations
include
reg_v850e2mn4.h USB function register definitions
Remarks: The sample driver package comes also with a set of project-related files for the CubeSuite (Renesas
Electronics’ integrated development tool suit). For further information, see section 5.2.1, Setting up
the Host Environment.

V850E2/MN4 USB MSC (Mass Storage Class) Driver
R01AN0011EJ0102 Rev.1.02 Page 6 of 151
Jan 23, 2012
(2) Multi Version
The Multi version of the sample driver comprises files that are summarized below.
Table 2.3 Multi Version Sample Driver File Configuration
Folder File Outline
main.c Main routine
scsi_cmd.c SCSI command processing
usbf850.c USB initialization, endpoint control, bulk transfer, and control transfer
usbf850_storage.c MSC-specific processing
initial.s Bootstrap
src
vector.s Interrupt vector table declarations
main.h main.c function prototype declarations
scsi.h SCSI-related macro definitions
usbf850.h usbf850.c function prototype declarations
usbf850_desc.h Descriptor definitions
usbf850_errno.h Error code definitions
usbf850_storage.h usbf850_storage.c function prototype declarations
usbf850_types.h User type declarations
reg_v850e2mn4.h USB function register definitions
include
df3512_800.h V850E2/MN4 register definitions
Remarks: The sample driver package comes also with a set of project-related files for the Multi (Green Hills
SoftwareTM, Inc. integrated development tool suit). For further information, see section 5.4.1,
Setting up the Host Environment.

V850E2/MN4 USB MSC (Mass Storage Class) Driver
R01AN0011EJ0102 Rev.1.02 Page 7 of 151
Jan 23, 2012
(3) IAR Embedded Workbench Version
The IAR Embedded Workbench version of the sample driver comprises files that are summarized below.
Table 2.4 IAR Embedded Workbench Version Sample Driver File Configuration
Folder File Outline
main.c Main routine
scsi_cmd.c SCSI command processing
usbf850.c USB initialization, endpoint control, bulk transfer, and control transfer
src
usbf850_storage.c MSC-specific processing
main.h main.c function prototype declarations
scsi.h SCSI-related macro definitions
usbf850.h usbf850.c function prototype declarations
usbf850_desc.h Descriptor definitions
usbf850_errno.h Error code definitions
usbf850_storage.h usbf850_storage.c function prototype declarations
usbf850_types.h User type declarations
include
reg_v850e2mn4.h USB function register definitions
Remarks: The sample driver package comes also with a set of project-related files for the IAR Embedded
Workbench. For further information, see section 5.6.1, Setting up the Host Environment.

V850E2/MN4 USB MSC (Mass Storage Class) Driver
R01AN0011EJ0102 Rev.1.02 Page 8 of 151
Jan 23, 2012
2.2 V850E2/MN4 Microcontroller
For details on the V850E2/MN4 microcontroller that is to be controlled by the sample driver, refer to the user’s
manual [hardware] of the individual products.
2.2.1 Applicable Products
The sample driver is applicable to the products that are listed below.
Table 2.5 List of Supported V850E2/MN4 Microcontroller Products
Internal Memory InterruptModel Name Part Number
Flash
Memory RAM
Internal
USB
Function Internal
Note4 External
Note 4
UM
μ
PD70F3510 1 Mbytes 64 Kbytes
+ 64 Kbytes
Host and
Function 180 29
μ
PD70F3512 1 Mbytes 64 Kbytes
+ 64 Kbytes
Host and
Function 190 29
μ
PD70F3514 1 Mbytes 64 Kbytes ×2
+ 64 Kbytes
Host and
Function 196 29
V850E2/MN4
μ
PD70F3515 2 Mbytes 64 Kbytes ×2
+ 64 Kbytes
Host and
Function 196 29
V850E2/MN4
User’s Manual
[Hardware]
(R01UH0011EJ)
(Note 4) Includes nonmaskable interrupts

V850E2/MN4 USB MSC (Mass Storage Class) Driver
R01AN0011EJ0102 Rev.1.02 Page 9 of 151
Jan 23, 2012
2.2.2 Features
The major features of the V850E2/MN4 are listed below.
•Internal memory
RAM: Single core, 64 Kbytes; Dual core, 64 Kbytes ×2
Flash memory: 1 Mbyte
•Flash cache memory
Single core: 16 Kbytes (4-way associative)
Dual core: 16 Kbytes (4-way associative) ×2
•External bus interface
Equipped with 2 systems of memory controllers.
Primary memory controller (SRAM/SDRAM connectable)
Secondary memory controller (SRAM/SDRAM connectable)
•Serial interfaces
Asynchronous serial interface UART: 6 channels
Clock synchronous serial interface CSI: 6 channels
Asynchronous serial interface UART (FIFO): 4 channels
Clock synchronous serial interface CSI (FIFO): 4 channels
I2C: 6 channels
CAN: 2 channels (μPD70F3512, μPD70F3514, and μPD70F3515)
USB function controller: 1 channel
USB host controller: 1 channel
Ethernet controller : 1 channel (μPD70F3512, μPD70F3514, and μPD70F3515)
•DMA controllers
DMA controller: 16 channels
DTS: 128 channels maximum

V850E2/MN4 USB MSC (Mass Storage Class) Driver
R01AN0011EJ0102 Rev.1.02 Page 10 of 151
Jan 23, 2012
3. USB Overview
This section provides a brief description of the USB standard to which the sample driver conforms.
USB (Universal Serial Bus) is a standard for interfacing various peripheral devices with a host computer with a
common connector. It provides an interface that is more flexible and easier to use than conventional interfaces. For
example, it supports the hot-plug feature and allows a maximum of 127 devices to be connected together through the
use of additional connection nodes called hubs. The ratio of the PCs having the USB interface installed to the entire
PCs that are presently available is reaching almost 100%. It can safely be said that the USB interface has become the
standard interface for connecting the PC and peripheral devices.
The USB standard is formulated and managed by the organization called the USB Implementers Forum (USB-IF).
For details on the USB standard, visit the USB-IF’s official web site (www.usb.org).
3.1 Transfer Modes
The USB standard defines four types of transfer modes (control, bulk, interrupt, and isochronous). The major
features of the transfer modes are summarized in table 3.1.
Table 3.1 USB Transfer Modes
Transfer Mode
Item
Control Transfer Bulk Transfer Interrupt Transfer Isochronous
Transfer
Feature Transfer mode that
is used to exchange
information
necessary for
controlling
peripheral devices.
Transfer mode that
is used to handle a
large amount of data
nonperiodically.
Transfer mode that
is used to transfer
data periodically and
has a narrow band
width.
Transfer mode used
in applications that
are required of high
realtime
performance.
High speed (480
Mbps) 64 bytes 512 bytes 1 to 1024 bytes 1 to 1024 bytes
Full speed (12
Mbps) 8, 16, 32, or 64
bytes 8, 16, 32, or 64
bytes 1 to 64 bytes 1 to 1023 bytes
Allowable packet
size
Low speed (1.5
Mbps) 8 bytes ⎯1 to 8 bytes ⎯
Transfer priority 3 3 2 1

V850E2/MN4 USB MSC (Mass Storage Class) Driver
R01AN0011EJ0102 Rev.1.02 Page 11 of 151
Jan 23, 2012
3.2 Endpoints
An endpoint is an item of information used by the host device to identify a specific communication counterpart.
An endpoint is specified by a number from 0 to 15 and the direction (IN or OUT). An endpoint need be provided
for each data communication channel that is to be used by a peripheral device and cannot be shared by two or
more communication channels (Note 5). For example, a device that has the capabilities to write and read to and
from an SD card and to print out data need be provided with an endpoint for writing to an SD card, an endpoint
for reading from an SD card, and an endpoint for sending data to a printer. Endpoint 0 is used for control transfer
which must always be performed by every device.
In data communication, the host device specifies the destination within the USB device using the USB device
address which identifies the device and an endpoint (number and direction).
A buffer memory is provided within every peripheral device as a physical circuit for endpoints. It also serves as
a FIFO that absorbs the difference in communication speed between the USB and the communication
counterpart (e.g., memory).
(Note 5) There is a method of switching channels exclusively using a mechanism called the alternate setting.
3.3 Classes
Peripheral devices (function devices) connected via the USB have various classes defined according to their
functionality. Typical classes include the mass storage class (MSC), communications device class (CDC), printer
class, and human interface device class (HID). For each class, standard specifications are defined in the form of
protocols. A common host driver can be used provided that it conforms to those standard specifications.
3.3.1 Mass Storage Class (MSC)
The mass storage class (MSC) is an interface class used to identify and control storage devices that are
connected via the USB, such as flash memory and hard and optical disk storage devices.
There are two types of communication protocols for the MSC, i.e., the bulk-only transport protocol and CBI
(control/bulk/interrupt) transport protocol. With the bulk-only transport protocol, data is transferred only in bulk
transfer mode. With the CBI transport protocol, control and interrupt transfer modes are used in addition to the
bulk transfer mode. The CBI transport protocol is available only for full-speed floppy disk drives.
The sample driver uses the bulk-only transport protocol for the mass storage class (MSC). For the specifications
for the USB mass storage class (MSC), refer to the MSC specification entitled “Universal Serial Bus Mass
Storage Class Bulk-Only Transport Revision 1.0.”
(1) Data transfer
With the bulk-only transport protocol, all transfers (commands, status, and data) are carried out in bulk transfer
mode.
The host sends commands to devices using bulk OUT transfers.
When a command that involves data transfers is sent, data input/output operations are performed using bulk
IN/bulk OUT transfers.
The device sends the status (command execution result) to the host using a bulk IN transfer.

V850E2/MN4 USB MSC (Mass Storage Class) Driver
R01AN0011EJ0102 Rev.1.02 Page 12 of 151
Jan 23, 2012
Host Device
Bulk OUT
Command send
(CBW)
Bulk IN
Data transfer
Status response
(CSW) Bulk IN
Bulk OUT
Bulk OUT
Bulk IN
Bulk OUT
Bulk IN
Host Device Host Device
Data read Data write No data transfer
Figure 3.1 Data Transfer Flow
(2) CBW format
The structure of a packet for sending a command is defined as a Command Block Wrapper (CBW).
Table 3.2 CBW Format
Bit
Byte
7 6 5 4 3 2 1 0
0-3 dCBWSignature
4-7 dCBWTag
8-11 dCBWDataTransferLength
12 bmCBWFlags
13 Reserved bCBWLUN
14 Reserved bCBWCBLength
15-30 CBWCB
dCBWSignature: Signature. Fixed at 0x43425355 (little endian).
dCBWTag: A tag containing an arbitrary number defined by the host. Used to associate the
status with the corresponding command.
dCBWDataTransferLength: Length of data to be transferred in the data phase. 0 if there is no data to transfer.
bmCBWFlags: Direction of transfer (bit 7). 0 = Bulk OUT, 1 = Bulk IN.
Bits 0 to 6 must always be set to 0.
bCBWLUN: Drive number of one of the two or more drives connected to a single USB device
bCBWCBLength: Length of the command packet
CBWCB: Command packet data

V850E2/MN4 USB MSC (Mass Storage Class) Driver
R01AN0011EJ0102 Rev.1.02 Page 13 of 151
Jan 23, 2012
(3) CSW format
The structure of the status packet is defined as a Command Status Wrapper (CSW).
Table 3.3 CSW Format
Bit
Byte
7 6 5 4 3 2 1 0
0-3 dCSWSignature
4-7 dCSWTag
8-11 dCSWDataResidue
12 bCSWStatus
dCSWSignature: Signature. Fixed at 0x53425355 (little endian).
dCSWTag: The host confirms a phase match when this tag matches with the dCBWTag that is
transferred with the command.
dCSWDataResidue: Remaining data. This field is loaded with the amount of remaining data when the
amount of data returned by the device is found smaller than the amount of data
requested by the host due to, for example, an error occurring during data transfer. A
nonzero value in this field indicates that the length of response data from the device
is shorter than the expected length of data even if the status (bCSWStatus) indicates
a success.
dCSWStatus: Status indicating the result of CBW processing
Table 3.4 CBW Processing Status Parameter Values
dCSWStatus Description
0x00 Success
0x01 Failure
0x02 Phase error
0x03 to 0xFF Reserved

V850E2/MN4 USB MSC (Mass Storage Class) Driver
R01AN0011EJ0102 Rev.1.02 Page 14 of 151
Jan 23, 2012
3.3.2 Subclasses
For the mass storage class (MSC), specify the format in which commands are transmitted from the host to the
target device as the subclass.
(1) Subclass types
Table 3.5 shows a list of subclass codes that are specified for the USB mass storage class.
Table 3.5 USB Mass Storage Subclass Codes
Subclass Code Specification
0x00 SCSI command set not reported (normally not used)
0x01 Reduced Block Commands (RBC), T10 Project 1240-D
0x02 MMC-5 (ATAPI)
0x03 SFF-8070i
0x04 USB Floppy Interface (UFI)
0x05 QIC-157 (IDE QIC tape drive)
0x06 SCSI transparent command set
0x07 Lockable Mass Storage
0x08 IEEE1667
0x09-0xFE Reserved
0xFF Specific to device vender
(2) SCSI commands
The SCSI transfer command set (0x06) must be specified as a subclass when USB memory or a USB card reader
is to be connected. SCSI (Small Computer System Interface) is an interface specification for connecting a
computer with peripheral devices in a bus topology configuration.
Data transfer and function configuration are carried out by specifying SCSI commands in the CBWCB
(command packet data) of the CBW. See section 4.1.4, SCSI Command Handling, for the SCSI commands
supported by the sample driver.

V850E2/MN4 USB MSC (Mass Storage Class) Driver
R01AN0011EJ0102 Rev.1.02 Page 15 of 151
Jan 23, 2012
3.4 Requests
According to the USB specification, communication is initiated by the host device issuing a command called a
request to all function devices. The request contains data such as the direction and type of processing and the
address of the target function device. Each function device decodes the request, determines whether the request is
directed to itself, and responds to the request only when it is directed to the device.
3.4.1 Types
There are three types of requests, namely, the standard requests, class requests, and vendor requests.
See section 4.1.2, Requests Handling, for the requests that the sample driver support.
(1) Standard requests
Standard requests are used in common by all USB compatible devices. A request is a standard request when both
bits 6 and 5 of the bmRequestType field of the request are set to 0. Refer to the USB specification (Universal
Serial Bus Specification Rev. 2.0) for the processing that is to be performed for the standard requests.
Table 3.6 List of Standard Requests
Request Name Target Descriptor Outline
Device Read power (self or bus) and remote wakeup settings.GET_STATUS
Endpoint Read Halt status.
Device Clear remote wakeup.CLEAR_FEATURE
Endpoint Cancel Halt (DATA PID = 0).
Device Set up remote wakeup or test mode.SET_FEATURE
Endpoint Set Halt
GET_DESCRIPTOR Device, configuration, string Read target descriptor
SET_DESCRIPTOR Device, configuration, string Set target descriptor (optional)
GET_CONFIGURATION Device Read current configuration value.
SET_CONFIGURATION Device Set configuration value.
GET_INTERFACE Interface Read alternate value out of the current settings of the
target interface.
SET_INTERFACE Interface Set alternate value of the target interface.
SET_ADDRESS Device Set USB address.
SYNCH_FRAME Endpoint Read frame-synchronous data.

V850E2/MN4 USB MSC (Mass Storage Class) Driver
R01AN0011EJ0102 Rev.1.02 Page 16 of 151
Jan 23, 2012
(2) Class requests
The class requests are unique to the class. A request is a class request when bit 6 of the bmRequestType field is
set to 0 and bit 5 to 1.
The bulk-only transport protocol of the mass storage class (MSC) needs to handle the following requests:
•GET_MAX_LUN (bRequest = 0xFE)
Request used to get the number of logical units (logical unit number) of the mass storage devices.
•MASS_STORAGE_RESET (bRequest = 0xFF)
Request used to reset the interface associated with the mass storage devices.
(3) Vendor requests
The vendor requests are defined uniquely by the individual vendors. A vendor who is to use a vendor request
needs to provide a host driver that handles that request. A request is a vendor request when bit 6 of the
bmRequestType field is set to 1 and bit 5 to 0.
3.4.2 Format
A USB request is 8 bytes long and consists of the fields that are listed in the table below.
Table 3.7 USB Request Format
Offset Field Description
0 bmRequestType Request attribute
Bit 7 Data transfer direction
Bits 6 and 5 Request type
Bits 4 to 0 Target descriptor
1 bRequest Request code
2 wValue Lower
3 Upper
Arbitrary value used in the request
4 wIndex Lower
5 Upper
Index or offset used in the request
6 wLength Lower
7 Upper
Number of bytes to transfer in data stage (data
length)

V850E2/MN4 USB MSC (Mass Storage Class) Driver
R01AN0011EJ0102 Rev.1.02 Page 17 of 151
Jan 23, 2012
3.5 Descriptors
In the USB specification, a set of information that is specific to a function device and is encoded in a predetermined
format is called a descriptor. Each function device sends its descriptor in response to a request from the host device.
3.5.1 Types
The following five types of descriptors are defined:
•Device descriptor
This descriptor is present in all types of devices. It contains basic information such as the version of the
supported USB specification, device class, protocol, maximum packet length available for transfer to
Endpoint0, vendor ID, and product ID.
The descriptor must be sent in response to a GET_DESCRIPTOR_Device request.
•Configuration descriptor
Every device has one or more configuration descriptors. It contains such information as device attributes
(power supplying method) and power consumption. The descriptor must be sent in response to a
GET_DESCRIPTOR_Configuration request.
•Interface descriptor
This descriptor is necessary for each interface. It contains an interface ID, interface class, and the number
of endpoints that are supported. The descriptor must be sent in response to a
GET_DESCRIPTOR_Configuration request.
•Endpoint descriptor
This descriptor is necessary for each endpoint that is specified in the interface descriptor. It defines the
transfer type (direction of transfer), maximum packet length available for transfer to the endpoint, and
transfer interval. Endpoint0, however, does not have this descriptor.
The descriptor must be sent in response to a GET_DESCRIPTOR_Configuration request.
•String descriptor
This descriptor contains an arbitrary string. The descriptor must be sent in response to a
GET_DESCRIPTOR_String request.

V850E2/MN4 USB MSC (Mass Storage Class) Driver
R01AN0011EJ0102 Rev.1.02 Page 18 of 151
Jan 23, 2012
3.5.2 Formats
The size and field structure of descriptors varies depending on the descriptor type as summarized in the tables
below. The data in each field is arranged in little endian format.
Table 3.8 Device Descriptor Format
Field Size
(Bytes) Description
bLength 1 Size of the descriptor
bDescriptorType 1 Type of the descriptor
bcdUSB 2 Release number of the USB specification
bDeviceClass 1 Class code
bDeviceSubClass 1 Subclass code
bDeviceProtocol 1 Protocol code
bMaxPacketSize0 1 Maximum packet size of Endpoint0
idVendor 2 Vendor ID
idProduct 2 Product ID
bcdDevice 2 Device release number
iManufacturer 1 Index of the string descriptor describing the manufacturer
iProduct 1 Index of the string descriptor describing the product
iSerialNumber 1 Index of the string descriptor describing the device’s serial number
bNumConfigurations 1 Number of configurations
Remarks Vendor ID: Identification number that the vendor who is to develop a USB device acquires
from USB-IF
Product ID: Identification number that the vendor assigns to each of its products after
acquiring a vendor ID.
Table 3.9 Configuration Descriptor Format
Field Size
(Bytes) Description
bLength 1 Size of the descriptor
bDescriptorType 1 Type of the descriptor
wTotalLength 2 Total number of bytes of the configuration, interface, and endpoint descriptors
bNumInterfaces 1 Number of interfaces supported by this configuration
bConfigurationValue 1 Identification number of this configuration
iConfiguration 1 Index of the string descriptor describing this configuration
bmAttributes 1 Characteristics of this configuration
bMaxPower 1 Maximum consumption current of this configuration (in 2 μA units)

V850E2/MN4 USB MSC (Mass Storage Class) Driver
R01AN0011EJ0102 Rev.1.02 Page 19 of 151
Jan 23, 2012
Table 3.10 Interface Descriptor Format
Field Size
(Bytes) Description
bLength 1 Size of the descriptor
bDescriptorType 1 Type of the descriptor
bInterfaceNumber 1 Identification number of this interface
bAlternateSetting 1 Presence or absence of alternate setting for this interface
bNumEndpoints 1 Number of endpoints used by this interface
bInterfaceClass 1 Class code
bInterfaceSubClass 1 Subclass code
bInterfaceProtocol 1 Protocol code
iInterface 1 Index of the string descriptor describing this interface
Table 3.11 Endpoint Descriptor Format
Field Size
(Bytes) Description
bLength 1 Size of the descriptor
bDescriptorType 1 Type of the descriptor
bEndpointAddress 1
Transfer direction of this endpoint
Address of this endpoint
bmAttributes 1 Transfer type of this endpoint
wMaxPacketSize 2 Maximum packet size available for transfer at this endpoint
bInterval 1 Interval for polling this endpoint
Table 3.12 String Descriptor Format
Field Size
(Bytes) Description
bLength 1 Size of the descriptor
bDescriptorType 1 Type of the descriptor
bString Arbitrary Arbitrary data string

V850E2/MN4 USB MSC (Mass Storage Class) Driver
R01AN0011EJ0102 Rev.1.02 Page 20 of 151
Jan 23, 2012
4. Sample Driver Specifications
This section contains a detailed description of the features and operations of the USB mass storage class (MSC)
sample driver for the V850E2/MN4 microcontroller. It also describes the specifications for the functions of the
sample driver.
4.1 Overview
4.1.1 Features
The sample driver has the following processing implemented:
(1) Main routine
The main routine performs initialization and waits for interrupts. It performs suspend/resume processing when a
suspend/resume interrupt occurs. For details, see section 4.2.7, Suspend/Resume Processing.
(2) Initialization
The initialization routine manipulates and sets up various registers to make the USB function controller ready for
use. The register settings are broadly divided into those for the V850E2/MN4’s CPU registers and those for the
registers of the USB function controller. For details, see section 4.2.1, CPU Initialization Processing, and section
4.2.2, USB Function Controller Initialization Processing.
(3) Interrupt processing
The INTUSFA0I1 interrupt handler monitors the state of the endpoint for control transfer (Endpoint0) and the
endpoint for bulk OUT transfer (reception) (Endpoint2) and performs appropriate processing according to the
request and data that are received. The INTUSFA0I2 interrupt handler performs the processing that is required
when a resume interrupt occurs. For details, see section 4.2.3, USBF Interrupt Processing (INTUSFA0I1), and
section 4.2.4, USBF Resume Interrupt Processing (INTUSFA0I2).
(4) SCSI command processing
This routine analyzes the CBW data that is received and determines whether it is a SCSI command. If a SCSI
command is received, the routine performs the required processing according to the received SCSI command.
For details, see section 4.1.4, SCSI Command Handling.
This manual suits for next models
2
Table of contents
Popular Storage manuals by other brands

Freecom
Freecom MEDIAPLAYER II - datasheet

IBM
IBM DS3950 Installation, user's, and maintenance guide

Ameriwood HOME
Ameriwood HOME 7712013COM Instruction booklet

Seagate
Seagate ST373453LC - Cheetah 73.4 GB Hard Drive product manual

Shugart
Shugart SA860 Service manual

SEI
SEI HZ640500TX Assembly instructions