Jan 23, 2012 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 •...
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.
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.
Page 4
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.
Page 5
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. R01AN0011EJ0102 Rev.1.02...
Page 6
User type declarations reg_v850e2mn4.h USB function register definitions 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.
Page 7
V850E2/MN4 USB MSC (Mass Storage Class) Driver (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...
Page 8
V850E2/MN4 USB MSC (Mass Storage Class) Driver 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.
Page 9
V850E2/MN4 USB MSC (Mass Storage Class) Driver 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) ×...
V850E2/MN4 USB MSC (Mass Storage Class) Driver 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.
Page 11
V850E2/MN4 USB MSC (Mass Storage Class) Driver 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 .
Page 12
V850E2/MN4 USB MSC (Mass Storage Class) Driver Data read Data write No data transfer Host Device Host Device Host Device Command send Bulk OUT Bulk OUT Bulk OUT (CBW) Bulk IN Bulk OUT Data transfer Status response Bulk IN Bulk IN...
Page 13
V850E2/MN4 USB MSC (Mass Storage Class) Driver (3) CSW format The structure of the status packet is defined as a Command Status Wrapper (CSW). Table 3.3 CSW Format Byte dCSWSignature dCSWTag 8-11 dCSWDataResidue bCSWStatus dCSWSignature: Signature. Fixed at 0x53425355 (little endian).
Page 14
V850E2/MN4 USB MSC (Mass Storage Class) Driver 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.
Page 15
V850E2/MN4 USB MSC (Mass Storage Class) Driver 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.
Page 16
V850E2/MN4 USB MSC (Mass Storage Class) Driver (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.
Page 17
V850E2/MN4 USB MSC (Mass Storage Class) Driver 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.
Page 18
V850E2/MN4 USB MSC (Mass Storage Class) Driver 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...
Page 19
V850E2/MN4 USB MSC (Mass Storage Class) Driver Table 3.10 Interface Descriptor Format Size Description Field (Bytes) bLength Size of the descriptor bDescriptorType Type of the descriptor bInterfaceNumber Identification number of this interface bAlternateSetting Presence or absence of alternate setting for this interface...
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.
Page 21
V850E2/MN4 USB MSC (Mass Storage Class) Driver 4.1.2 Request Handling Table 4.1 lists the USB requests that are defined for the hardware (V850E2/MN4) and firmware (sample driver). Table 4.1 USB Request Processing Request Name Code Processing Standard request GET_INTERFACE 0x81...
Page 22
V850E2/MN4 USB MSC (Mass Storage Class) Driver (1) Standard requests The sample driver performs the following response processing for requests that the V850E2/MN4 does not automatically respond: (a) GET_DESCRIPTOR_string This request is used by the host to get the string descriptor of a function device.
Page 23
Subclass code: None bDeviceProtocol 0x00 Protocol code: No unique protocol used bMaxPacketSize0 0x40 Maximum packet size of Endpoint0: 64 idVendor 0x045B Vendor ID: Renesas Electronics idProduct 0x0200 Product ID: V850E2/MN4 bcdDevice 0x0001 Device release number: First version iManufacturer 0x01 Index of string descriptor describing the manufacturer: 1...
Page 24
V850E2/MN4 USB MSC (Mass Storage Class) Driver (2) Configuration descriptor This descriptor is sent in response to a GET_DESCRIPTOR_configuration request. Since the hardware automatically responds to the GET_DESCRIPTOR_configuration request, the settings are stored in the USFA0CIEn registers (n = 0 to 255) when the USB function controller is initialized.
Page 25
V850E2/MN4 USB MSC (Mass Storage Class) Driver (4) Endpoint descriptor This descriptor is sent in response to a GET_DESCRIPTOR_configuration request. Since the hardware automatically responds to the GET_DESCRIPTOR_configuration request, the settings are stored in the USFA0CIEn registers (n = 0 to 255) when the USB function controller is initialized.
Page 26
Serial number: bString – V850E2/MN4: 020008065010 (Note 6) The value varies with the size of the bString field. (Note 7) The size and value are not fixed because this area can be set up arbitrarily by the vendor. R01AN0011EJ0102 Rev.1.02...
Page 27
V850E2/MN4 USB MSC (Mass Storage Class) Driver 4.1.4 SCSI Command Handling The sample driver specifies the SCSI transfer command set (0x06) as a subclass. The SCSI commands that are supported by the sample driver are listed in table 4.10. The sample driver returns a STALL response when it receives a command that is not listed in table 4.10.
Page 28
V850E2/MN4 USB MSC (Mass Storage Class) Driver (2) REQUEST_SENSE command (0x03) This command sends the sense data to the host. The sample driver sends the sense data listed in table 4.14 to the host. Table 4.12 REQUEST_SENSE Command Format Byte...
Page 29
V850E2/MN4 USB MSC (Mass Storage Class) Driver (3) READ6 command (0x08) This command transfers data from the specified range of logical data blocks to the host. Table 4.15 READ6 Command Format Byte Operation code (0x08) Logical unit number (LUN) Logical block address (LBA)
Page 30
V850E2/MN4 USB MSC (Mass Storage Class) Driver (6) INQUIRY command (0x12) This command notifies the host of the configuration information and attributes of the device. The sample driver sends the INQUIRY_TABLE values to the host. Table 4.18 SEEK Command Format...
Page 31
V850E2/MN4 USB MSC (Mass Storage Class) Driver (7) MODE _SELECT command (0x15) This command sets the data format of the device and other parameters. The sample driver loads MODE_SELECT_TABLE with values. Table 4.20 MODE_SELECT Command Format Byte Operation code (0x15)
Page 32
V850E2/MN4 USB MSC (Mass Storage Class) Driver (8) MODE_SENSE6 command (0x1A) This command sends the values of the mode select parameters and other attributes of the device to the host. The sample driver sends the MODE_SENSE_TABLE values to the host.
Page 33
V850E2/MN4 USB MSC (Mass Storage Class) Driver (9) START_STOP_UNIT command (0x1B) This command enables or disables accesses to the device. The sample driver initializes the sense data and terminates normally. Table 4.24 START_STOP_UNIT Command Format Byte Operation code (0x1B) Logical unit number (LUN)
Page 34
V850E2/MN4 USB MSC (Mass Storage Class) Driver (11) READ_FORMAT_CAPACITIES command (0x23) This command notifies the host of the capacity (number of blocks and block length) of the device. The sample driver sends the READ_FORMAT_CAPACITY_TABLE values to the host. Table 4.26...
Page 35
V850E2/MN4 USB MSC (Mass Storage Class) Driver (12) READ_CAPACITY command (0x25) This command notifies the host of the size of the data on the device. The sample driver sends the READ_CAPACITY_TABLE values to the host. Table 4.28 READ_CAPACITY Command Format...
Page 36
V850E2/MN4 USB MSC (Mass Storage Class) Driver (14) WRITE10 command (0x2A) This command writes the received data into the specified block on the device. Table 4.31 WRITE10 Command Format Byte Operation code (0x2A) Logical unit number (LUN) Logical block address (LBA)
Page 37
V850E2/MN4 USB MSC (Mass Storage Class) Driver (17) SYNCHRONIZE_CACHE command (0x35) This command synchronizes the data in the specified range of blocks in cache memory with that on the medium. The sample driver initializes the sense data and terminates normally.
Page 38
V850E2/MN4 USB MSC (Mass Storage Class) Driver (19) MODE_SENSE10 command (0x5A) This command notifies the host of the values of the mode select parameters and attributes of the device. The sample driver sends the MODE_SENSE10_TABLE values to the host. Table 4.36...
Page 39
V850E2/MN4 USB MSC (Mass Storage Class) Driver (20) MODE_SELECT10 command (0x55) This command sets the data format of the device and other parameters. The sample driver loads MODE_SELECT10_TABLE with values. Table 4.38 MODE_SELECT10 Command Format Byte Operation code (0x55) Logical unit number (LUN)
Page 40
V850E2/MN4 USB MSC (Mass Storage Class) Driver 4.2 Operations When the sample driver is started, it performs the sequence of processes that are illustrated in the figure below. This section describes the individual processes. Start Initialization processing Interrupt occurred Interrupt occurred...
Page 41
(2) H bus initialization This process initializes the H-bus. The routine initializes the H bus according to the specified directions. See the V850E2/MN4 Microcontroller User’s Manual [Hardware]. (3) Initializing USB clock This process sets up the multiplexed pin P13 to which UCLK is connected. This sample driver uses UCLK as the USB clock input to the USB.
Page 42
V850E2/MN4 USB MSC (Mass Storage Class) Driver 4.2.2 USB Function Controller Initialization Processing The USB function controller initialization processing routine sets up the parameters necessary for starting the use of the USB function controller. Figure 4.10 USB Function Controller Initialization Processing Flow (1) Configuring the D+ signal as pull down Loads the CPU’s P4.10 with “0.”...
Page 43
V850E2/MN4 USB MSC (Mass Storage Class) Driver (3) Initializing the EPC circuit Loads the USFA0EPCCTL register with “0x00000000” to cancel the EPC reset signal. (4) Initializing the USB function buffer Loads the USFBC register with “0x00000003” to enable the USBF buffer and floating provisions.
Page 44
V850E2/MN4 USB MSC (Mass Storage Class) Driver (9) Setting up the interrupt mask register Sets the mask bits associated with the interrupt sources of the USB function controller. The following registers are accessed during this processing: (a) The USFA0ICn registers (n = 0 to 4) are loaded with “0x00. This setting causes all interrupt sources to be cleared.
Page 45
V850E2/MN4 USB MSC (Mass Storage Class) Driver 4.2.3 USBF Interrupt Processing (INTUSFA0I1) The INTUSFA0I1 interrupt handler monitors the state of the endpoint (Endpoint0) for control transfer and the endpoint (Endpoint2) for bulk OUT transfer (reception) and takes the actions according to the received requests and data.
Page 46
V850E2/MN4 USB MSC (Mass Storage Class) Driver (3) BUSRST interrupt processing The interrupt handler recognizes the occurrence of a BUSRST interrupt when the BUSRST bit of the USFA0IS0 register is set to 1. The interrupt handler takes the following actions if a BUSRST interrupt has occurred: •...
Page 47
V850E2/MN4 USB MSC (Mass Storage Class) Driver 4.2.4 USBF Resume Interrupt Processing (INTUSFA0I2) The INTUSFA0I2 interrupt handler performs processing when a resume interrupt occurs. During resume interrupt processing, the resume/suspend flag (rs_flag) is set to "RESUME (0x01)." The processing to be performed when rs_flag is set to "RESUME" is accomplished by the main routine.
Page 48
V850E2/MN4 USB MSC (Mass Storage Class) Driver (1) Determining whether the MASS_STORAGE_RESET processing is in progress The routine recognizes that MASS_STORAGE_RESET processing is in progress if the MASS_STRAGE_RESET processing flag (mass_storage_reset) is set to 1. If the processing is in progress, the interrupt handler calls the CBW data error processing function (usbf850_cbw_error) and terminates the CBW data receive processing.
Page 49
V850E2/MN4 USB MSC (Mass Storage Class) Driver 4.2.6 SCSI Command Processing When CBW data is received via the USB, the CBW command analysis function (usbf850_storage_cbwchk) is called to process the received SCSI command. Start of SCSI command processing Command packet length =...
Page 50
V850E2/MN4 USB MSC (Mass Storage Class) Driver 4.2.7 Suspend/Resume Processing The suspend/resume processing is executed within the main routine according to the processing flow shown below. Start of main routine Initialization usbf850_rsuspd_flg set? _DI() processing __halt() processing Set usbf850_rsuspd_flg __EI() processing Figure 4.16...
Page 51
V850E2/MN4 USB MSC (Mass Storage Class) Driver 4.3 Function Specifications This section describes the functions that are implemented in the sample driver. 4.3.1 List of Functions Table 4.40 shows a list of functions that are implemented in the source files for the sample driver.
Page 52
V850E2/MN4 USB MSC (Mass Storage Class) Driver Table 4.41 Sample Driver Functions (2/2) Source File Function Name Description scsi_cmd.c scsi_command_to_ata Executes a SCSI command. ata_test_unit_ready Processes the TEST UNIT READY command. ata_seek Processes the SEEK command. ata_start_stop_unit Processes the START STOP UNIT command.
Page 53
V850E2/MN4 USB MSC (Mass Storage Class) Driver 4.3.2 Correlation among the Sample Driver Functions There are some sample driver functions that call another function during their execution. This function call relationships are shown below. main cpu_init usbf850_init __halt Figure 4.17...
Page 54
V850E2/MN4 USB MSC (Mass Storage Class) Driver usbf850_no_data scsi_command_to_ata usbf850_csw_ret usbf850_data_send usbf850_data_out scsi_command_to_ata usbf850_bulkout_stall usbf850_csw_ret usbf850_data_send usbf850_data_in scsi_command_to_ata usbf850_sendstallEP0 usbf850_bulkin_stall usbf850_bulkout_stall usbf850_csw_ret usbf850_data_send Figure 4.19 Function Calls within CBW/CSW Processing R01AN0011EJ0102 Rev.1.02 Page 54 of 151 Jan 23, 2012...
Page 56
V850E2/MN4 USB MSC (Mass Storage Class) Driver 4.3.3 Function Descriptions This section contains a description of the functions that are implemented in the sample driver. (1) Functional description format The functional descriptions are given in the format shown below. Function Name [Synopsis] Gives a synopsis of the function.
Page 57
V850E2/MN4 USB MSC (Mass Storage Class) Driver (2) Main routine functions main [Synopsis] Perform main processing. [C language format] void main(void) [Parameters] None [Return Value] None [Function] This function is called first when the sample driver is started. The function calls the USB initialization function (usbf850_init), then monitors the resume/suspend flag (usbf850_rsuspd_flg).
Page 58
V850E2/MN4 USB MSC (Mass Storage Class) Driver cpu_init [Synopsis] Initialize CPU. [C language format] void cpu_init(void) [Parameters] None [Return Value] None [Function] This function is called during initialization processing. It initializes the H bus and sets up the USB clock and other parameters that are necessary to use the USB function controller.
Page 60
V850E2/MN4 USB MSC (Mass Storage Class) Driver (3) USB function controller processing functions usbf850_init [Synopsis] Initialize USB function controller. [C language format] void usbf850_init(void) [Parameters] None [Return Value] None [Function] This function is called during initialization processing. It allocates and sets up the data area, and sets interrupt request masks and other parameter items that are necessary to use the USB function controller.
Page 61
V850E2/MN4 USB MSC (Mass Storage Class) Driver usbf850_intusbf0 [Synopsis] INTUSFA0I1 interrupt handler processing. [C language format] void usbf850_intusbf0(void) [Parameters] None [Return Value] None [Function] This function is called as a USB interrupt handler (INTUSFA0I1). It monitors the endpoint for control transfer (Endpoint0) and the endpoint for bulk OUT transfer (reception) (Endpoint2), and takes the required actions according to the received request or command.
Page 62
V850E2/MN4 USB MSC (Mass Storage Class) Driver usbf850_intusbf1 [Synopsis] Perform INTUSFA0I2 interrupt handler processing. [C language format] void usbf850_intusbf1(void) [Parameters] None [Return Value] None [Function] This function is called as a USB resume interrupt (INTUSFA0I2) handler. It sets the resume/suspend flag (usbf850_rsuspd_flg) to "RESUME (0x01)."...
Page 63
V850E2/MN4 USB MSC (Mass Storage Class) Driver usbf850_data_send [Synopsis] Send USB data. [C language format] INT32 usbf850_data_send(UINT8 *data, INT32 len, INT8 ep) [Parameters] Parameter Description UINT8 *data Pointer to transmit data buffer INT32 len Transmit data length INT8 ep Endpoint number of the endpoint to be used for data...
Page 64
V850E2/MN4 USB MSC (Mass Storage Class) Driver usbf850_data_receive [Synopsis] Receive USB data. [C language format] INT32 usbf850_data_receive(UINT8 *data, INT32 len, INT8 ep) [Parameters] Parameter Description UINT8 *data Pointer to receive data buffer INT32 len Receive data length INT8 ep Endpoint number of the endpoint to be used for data...
Page 65
V850E2/MN4 USB MSC (Mass Storage Class) Driver usbf850_rdata_length [Synopsis] Get USB receive data length. [C language format] void usbf850_rdata_length(INT32 *len , INT8 ep) [Parameters] Parameter Description INT32* len Pointer to the address storing the receive data length INT8 ep Endpoint number of the data receiving endpoint...
Page 66
V850E2/MN4 USB MSC (Mass Storage Class) Driver usbf850_send_EP0 [Synopsis] Send USB data for Endpoint0. [C language format] INT32 usbf850_send_EP0(UINT8* data, INT32 len) [Parameters] Parameter Description UINT8* data Pointer to transmit data buffer INT32 len Transmit data size [Return Value] Symbol...
Page 67
V850E2/MN4 USB MSC (Mass Storage Class) Driver usbf850_receive_EP0 [Synopsis] Receive USB data for Endpoint0. [C language format] INT32 usbf850_receive_EP0(UINT8* data, INT32 len) [Parameters] Parameter Description UINT8* data Pointer to receive data buffer INT32 len Receive data size [Return Value] Symbol...
Page 68
V850E2/MN4 USB MSC (Mass Storage Class) Driver usbf850_send_null [Synopsis] Send Null packet for Bulk/Interrupt In Endpoint. [C language format] INT32 usbf850_send_null(INT8 ep) [Parameters] Parameter Description INT8 ep Endpoint number of the data transmitting endpoint [Return Value] Symbol Description DEV_OK Normal termination...
Page 69
V850E2/MN4 USB MSC (Mass Storage Class) Driver usbf850_sendnullEP0 [Synopsis] Send NULL packet for Endpoint0. [C language format] void usbf850_sendnullEP0(void) [Parameters] None [Return Value] None [Function] This function sends a Null packet from the USB function controller by clearing the FIFO for Endpoint0 and setting the bit that specifies the end of data to 1.
Page 70
V850E2/MN4 USB MSC (Mass Storage Class) Driver usbf850_sendstallEP0 [Synopsis] Send STALL response for Endpoint0. [C language format] void usbf850_sendstallEP0(void) [Parameters] None [Return Value] None [Function] This function causes the USB function controller to return a STALL response by setting the bit that indicates the use of a STALL handshake to 1.
Page 71
V850E2/MN4 USB MSC (Mass Storage Class) Driver usbf850_ep_status [Synopsis] Notify state of FIFO for Bulk/ Interrupt In Endpoint. [C language format] INT32 usbf850_ep_status(INT8 ep) [Parameters] Parameter Description INT8 ep Endpoint number of the data transmitting endpoint [Return Value] Symbol Description...
Page 72
V850E2/MN4 USB MSC (Mass Storage Class) Driver usbf850_fifo_clear [Synopsis] Clear FIFO for Bulk/ Interrupt Endpoint. [C language format] void usbf850_fifo_clear(INT8 in_ep, INT8 out_ep) [Parameters] Parameter Description INT8 in_ep Data transmitting Endpoint INT8 out_ep Data receiving Endpoint [Return Value] None [Function] This function clears the FIFO for the specified Endpoint (Bulk/Interrupt) and the data receive flag (usbf850_rdata_flg).
Page 73
V850E2/MN4 USB MSC (Mass Storage Class) Driver usbf850_standardreq [Synopsis] Process standard request not automatically responded by USB function controller. [C language format] void usbf850_standardreq(USB_SETUP *req_data) [Parameters] Parameter Description USB_SETUP Pointer to area storing the request data *req_data [Return Value] None [Function] This function is called by the Endpoint0 monitoring routine.
Page 74
V850E2/MN4 USB MSC (Mass Storage Class) Driver usbf850_getdesc [Synopsis] Process GET_DESCRIPTOR request. [C language format] void usbf850_getdesc(USB_SETUP *req_data) [Parameters] Parameter Description USB_SETUP Pointer to area storing the request data *req_data [Return Value] None [Function] This function is called to process standard requests that are not automatically responded by the USB function controller.
Page 75
V850E2/MN4 USB MSC (Mass Storage Class) Driver (4) USB Mass storage class processing functions usbf850_classreq [Synopsis] Process MSC class request. [C language format] void usbf850_classreq(USB_SETUP *req_data) [Parameters] Parameter Description USB_SETUP Pointer to area storing the request data *req_data [Return Value]...
Page 76
V850E2/MN4 USB MSC (Mass Storage Class) Driver usbf850_blkonly_mass_storage_reset [Synopsis] Perform Mass Storage Reset processing. [C language format] void usbf850_blkonly_mass_storage_reset(USB_SETUP *req_data) [Parameters] Parameter Description USB_SETUP Pointer to area storing the request data *req_data [Return Value] None [Function] This function clears the FIFOs for Endpoint1 and Endpoint2 and sets up a STALL response. Subsequently, the function sends a NULL packet from Endpoint0.
Page 77
V850E2/MN4 USB MSC (Mass Storage Class) Driver usbf850_max_lun [Synopsis] Perform Get Max Lun processing. [C language format] void usbf850_max_lun(USB_SETUP *req_data) [Parameters] Parameter Description USB_SETUP Pointer to area storing the request data *req_data [Return Value] None [Function] This function sends the number of logical units (Logical Unit Number) of the mass storage device.
Page 78
V850E2/MN4 USB MSC (Mass Storage Class) Driver usbf850_rx_cbw [Synopsis] Receive CBW data. [C language format] void usbf850_rx_cbw(void) [Parameters] None [Return Value] None [Function] This function reads CBW data from the FIFO for the bulk IN endpoint (Endpoint2) and calls the CBW data command analysis function (usbf850_storage_cbwchk).
Page 79
V850E2/MN4 USB MSC (Mass Storage Class) Driver usbf850_storage_cbwchk [Synopsis] Analyze and process CBW data command. [C language format] INT32 usbf850_storage_cbwchk(void) [Parameters] None [Return Value] The status established during CBW checking is returned. Symbol Description DEV_OK Normal termination DEV_ERROR Abnormal termination...
Page 80
V850E2/MN4 USB MSC (Mass Storage Class) Driver usbf850_cbw_error [Synopsis] Perform CBW data error processing. [C language format] void usbf850_cbw_error(void) [Parameters] None [Return Value] None [Function] This command reports a STALL response for the bulk IN endpoint (Endpoint1) and bulk OUT endpoint (Endpoint2).
Page 81
V850E2/MN4 USB MSC (Mass Storage Class) Driver usbf850_no_data [Synopsis] Process SCSI NO DATA command. [C language format] void usbf850_no_data(void) [Parameters] None [Return Value] None [Function] This function performs NO DATA command processing and returns the processing results in the CSW format.
Page 82
V850E2/MN4 USB MSC (Mass Storage Class) Driver usbf850_data_in [Synopsis] Performs SCSI DATA IN command. [C language format] void usbf850_data_in(void) [Parameters] None [Return Value] None [Function] This function performs DATA IN (WRITE) command processing and returns the processing results in the CSW format.
Page 83
V850E2/MN4 USB MSC (Mass Storage Class) Driver usbf850_data_out [Synopsis] Process SCSI DATA OUT command. [C language format] void usbf850_data_out(void) [Parameters] None [Return Value] None [Function] This function performs DATA OUT (READ) command processing and returns the processing results in the CSW format.
Page 84
V850E2/MN4 USB MSC (Mass Storage Class) Driver usbf850_csw_ret [Synopsis] Process CSW response. [C language format] INT32 usbf850_csw_ret(UINT8 status) [Parameters] Parameter Description UINT8 status Results of command processing [Return Value] Results of CSW transmission processing Symbol Description DEV_OK Normal termination [Function] This function creates CSW format data from the processing results and sends it via USB.
Page 85
V850E2/MN4 USB MSC (Mass Storage Class) Driver usbf850_bulkin_stall [C language format] void usbf850_bulkin_stall(void) [Parameters] None [Return Value] None [Function] This function clears the FIFO for Endpoint1 and returns a STALL response. R01AN0011EJ0102 Rev.1.02 Page 85 of 151 Jan 23, 2012...
Page 86
V850E2/MN4 USB MSC (Mass Storage Class) Driver usbf850_bulkout_stall [C language format] void usbf850_bulkout_stall(void) [Parameters] None [Return Value] None [Function] This function clears the FIFO for Endpoint2 and returns a STALL response. R01AN0011EJ0102 Rev.1.02 Page 86 of 151 Jan 23, 2012...
Page 87
V850E2/MN4 USB MSC (Mass Storage Class) Driver (5) SCSI command processing functions scsi_command_to_ata [Synopsis] Process SCSI command execution. [C language format] INT32 scsi_command_to_ata(UINT8 *ScsiCommandBuf, UINT8 *pbData, INT32 lDataSize, INT32 TransFlag) [Parameters] Parameter Description UINT8 *ScsiCommandBuf Pointer to buffer storing the SCSI command...
Page 88
V850E2/MN4 USB MSC (Mass Storage Class) Driver ata_test_unit_ready [Synopsis] Process TEST UNIT READY command. [C language format] INT32 ata_test_unit_ready(INT32 TransFlag) [Parameters] Parameter Description INT32 TransFlag Direction of data transfer [Return Value] Symbol Description DEV_OK Normal termination DEV_ERR_NODATA Transfer direction error in NO DATA command [Function] This function clears the sense data (sense key = 0x00).
Page 89
V850E2/MN4 USB MSC (Mass Storage Class) Driver ata_seek [Synopsis] Process SEEK command. [C language format] INT32 ata_seek(INT32 TransFlag) [Parameters] Parameter Description INT32 TransFlag Direction of data transfer [Return Value] Symbol Description DEV_OK Normal termination DEV_ERR_NODATA Transfer direction error in a NO DATA command [Function] This function clears the sense data (sense key = 0x00).
Page 90
V850E2/MN4 USB MSC (Mass Storage Class) Driver ata_start_stop_unit [Synopsis] Process START STOP UNIT command. [C language format] INT32 ata_start_stop_unit(INT32 TransFlag) [Parameters] Parameter Description INT32 TransFlag Direction of data transfer [Return Value] Processing result Symbol Description DEV_OK Normal termination DEV_ERR_NODATA Transfer direction error in a NO DATA command [Function] This function clears the sense data (sense key = 0x00).
Page 91
V850E2/MN4 USB MSC (Mass Storage Class) Driver ata_synchronize_cache [Synopsis] Process SYNCHRONIZE CACHE command. [C language format] INT32 ata_synchronize_cache(INT32 TransFlag) [Parameters] Parameter Description INT32 TransFlag Direction of data transfer [Return Value] Processing result Symbol Description DEV_OK Normal termination DEV_ERR_NODATA Transfer direction error in a NO DATA command [Function] This function clears the sense data (sense key = 0x00).
Page 92
V850E2/MN4 USB MSC (Mass Storage Class) Driver ata_request_sense [Synopsis] Process REQUEST SENSE command. [C language format] INT32 ata_request_sense(UINT8 *ScsiCommandBuf, UINT8 *pbData, INT32 lDataSize, INT32 TransFlag) [Parameters] Parameter Description UINT8 Pointer to buffer storing the SCSI command *ScsiCommandBuf UINT8 *pbData Pointer to buffer storing command data...
Page 93
V850E2/MN4 USB MSC (Mass Storage Class) Driver ata_inquiry [Synopsis] Process INQUIRY command [C language format] INT32 ata_inquiry(UINT8 *ScsiCommandBuf, UINT8 *pbData, INT32 lDataSize, INT32 TransFlag) [Parameters] Parameter Description UINT8 Pointer to buffer storing the SCSI command *ScsiCommandBuf UINT8 *pbData Pointer to buffer storing command data...
Page 94
V850E2/MN4 USB MSC (Mass Storage Class) Driver ata_mode_select [Synopsis] Process MODE SELECT(6) command. [C language format] INT32 ata_mode_select(UINT8 *ScsiCommandBuf, UINT8 *pbData, INT32 lDataSize, INT32 TransFlag) [Parameters] Parameter Description UINT8 Pointer to buffer storing the SCSI command *ScsiCommandBuf UINT8 *pbData Pointer to buffer storing command data...
Page 95
V850E2/MN4 USB MSC (Mass Storage Class) Driver ata_mode_select10 [Synopsis] Process MODE SELECT(10) command. [C language format] INT32 ata_mode_select10(UINT8 *ScsiCommandBuf, UINT8 *pbData, INT32 lDataSize, INT32 TransFlag) [Parameters] Parameter Description UINT8 Pointer to buffer storing the SCSI command *ScsiCommandBuf UINT8 *pbData Pointer to buffer storing command data...
Page 96
V850E2/MN4 USB MSC (Mass Storage Class) Driver ata_mode_sense [Synopsis] Process MODE SENSE(6) command. [C language format] INT32 ata_mode_sense(UINT8 *ScsiCommandBuf, UINT8 *pbData, INT32 lDataSize, INT32 TransFlag) [Parameters] Parameter Description UINT8 Pointer to buffer storing the SCSI command *ScsiCommandBuf UINT8 *pbData Pointer to buffer storing command data...
Page 97
V850E2/MN4 USB MSC (Mass Storage Class) Driver ata_mode_sense10 [Synopsis] Process MODE SENSE(10) command. [C language format] INT32 ata_mode_sense10(UINT8 *ScsiCommandBuf, UINT8 *pbData, INT32 lDataSize, INT32 TransFlag) [Parameters] Parameter Description UINT8 Pointer to buffer storing the SCSI command *ScsiCommandBuf UINT8 *pbData Pointer to buffer storing command data...
Page 98
V850E2/MN4 USB MSC (Mass Storage Class) Driver ata_read_format_capacities [Synopsis] Process READ FORMAT CAPACITIES command. [C language format] INT32 ata_read_format_capacities(UINT8 *ScsiCommandBuf, UINT8 *pbData, INT32 lDataSize, INT32 TransFlag) [Parameters] Parameter Description UINT8 Pointer to buffer storing the SCSI command *ScsiCommandBuf UINT8 *pbData...
Page 99
V850E2/MN4 USB MSC (Mass Storage Class) Driver ata_read_capacity [Synopsis] Process READ CAPACITY command. [C language format] INT32 ata_read_capacity(UINT8 *ScsiCommandBuf, UINT8 *pbData, INT32 lDataSize, INT32 TransFlag) [Parameters] Parameter Description UINT8 Pointer to buffer storing the SCSI command *ScsiCommandBuf UINT8 *pbData Pointer to buffer storing command data...
Page 100
V850E2/MN4 USB MSC (Mass Storage Class) Driver ata_read6 [Synopsis] Process READ(6) command. [C language format] INT32 ata_read6(UINT8 *ScsiCommandBuf, UINT8 *pbData, INT32 lDataSize, INT32 TransFlag) [Parameters] Parameter Description UINT8 Pointer to buffer storing the SCSI command *ScsiCommandBuf UINT8 *pbData Pointer to buffer storing command data...
Page 101
V850E2/MN4 USB MSC (Mass Storage Class) Driver ata_read10 [Synopsis] Process READ(10) command. [C language format] INT32 ata_read10(UINT8 *ScsiCommandBuf, UINT8 *pbData, INT32 lDataSize, INT32 TransFlag) [Parameters] Parameter Description UINT8 Pointer to buffer storing the SCSI command *ScsiCommandBuf UINT8 *pbData Pointer to buffer storing command data...
Page 102
V850E2/MN4 USB MSC (Mass Storage Class) Driver ata_write6 [Synopsis] Process WRITE(6) command [C language format] INT32 ata_write6(UINT8 *ScsiCommandBuf, UINT8 *pbData, INT32 lDataSize, INT32 TransFlag) [Parameters] Parameter Description UINT8 Pointer to buffer storing the SCSI command *ScsiCommandBuf UINT8 *pbData Pointer to buffer storing command data...
Page 103
V850E2/MN4 USB MSC (Mass Storage Class) Driver ata_write10 [Synopsis] Process WRITE(10) command. [C language format] INT32 ata_write10(UINT8 *ScsiCommandBuf, UINT8 *pbData, INT32 lDataSize, INT32 TransFlag) [Parameters] Parameter Description UINT8 Pointer to buffer storing the SCSI command *ScsiCommandBuf UINT8 *pbData Pointer to buffer storing command data...
Page 104
V850E2/MN4 USB MSC (Mass Storage Class) Driver ata_verify [Synopsis] Process VERIFY command. [C language format] INT32 ata_verify(UINT8 *ScsiCommandBuf, UINT8 *pbData, INT32 lDataSize, INT32 TransFlag) [Parameters] Parameter Description UINT8 Pointer to buffer storing the SCSI command *ScsiCommandBuf UINT8 *pbData Pointer to buffer storing command data...
Page 105
V850E2/MN4 USB MSC (Mass Storage Class) Driver ata_write_verify [Synopsis] Process WRITE VERIFY command. [C language format] INT32 ata_write_verify(UINT8 *ScsiCommandBuf, UINT8 *pbData, INT32 lDataSize, INT32 TransFlag) [Parameters] Parameter Description UINT8 Pointer to buffer storing the SCSI command *ScsiCommandBuf UINT8 *pbData Pointer to buffer storing command data...
Page 106
V850E2/MN4 USB MSC (Mass Storage Class) Driver ata_write_buff [Synopsis] Process WRITE BUFF command. [C language format] INT32 ata_write_buff(UINT8 *ScsiCommandBuf, UINT8 *pbData, INT32 lDataSize, INT32 TransFlag) [Parameters] Parameter Description UINT8 Pointer to buffer storing the SCSI command *ScsiCommandBuf UINT8 *pbData Pointer to buffer storing command data...
Page 107
V850E2/MN4 USB MSC (Mass Storage Class) Driver scsi_to_usb [Synopsis] Send USB data (SCSI command). [C language format] INT32 scsi_to_usb(UINT8 *pbData, INT32 TransFlag) [Parameters] Parameter Description UINT8 *pbData Pointer to buffer storing command data INT32 TransFlag Direction of data transfer [Return Value]...
Page 108
V850E2/MN4 USB MSC (Mass Storage Class) Driver 4.4 Data Structures This section describes the data structures that are used by the sample driver. (1) USB device request structure The USB device request structure is defined in the file "usbf850.h." typedef struct { UINT8 RequstType;...
Page 109
V850E2/MN4 USB MSC (Mass Storage Class) Driver (4) SCSI SENSE DATA Structure The SCSI SENSE DATA structure is defined in the file "scsi_cmd.c." typedef struct _SCSI_SENSE_DATA { UINT8 sense_key; UINT8 asc; UINT8 ascq; } SCSI_SENSE_DATA, *PSCSI_SENSE_DATA; Figure 4.24 SCSI SENSE DATA Structure R01AN0011EJ0102 Rev.1.02...
5. Development Environment This section gives an example of constructing an environment for developing application programs using the USB mass storage class sample driver for the V850E2/MN4 and the procedures for debugging them in that environment. 5.1 Development Environment This section introduces a sample development configuration of hardware and software tool products.
Page 111
⎯ Project-related file (Note 9) (Note 8) Contact Renesas for product and ordering information. (Note 9) The sample driver package comes with sample files that are built with CubeSuite, Multi, and IAR Embedded Workbench. R01AN0011EJ0102 Rev.1.02 Page 111 of 151...
Page 112
V850E2/MN4 USB MSC (Mass Storage Class) Driver 5.2 Setting up a CubeSuite Environment This section explains the preparatory steps that are required to develop or debug using CubeSuite which is introduced in section 5.1, Development Environment. See section 5.4, Setting up a Multi Environment, when using Multi for program development and debugging.
Page 113
V850E2/MN4 USB MSC (Mass Storage Class) Driver (3) Installing device files Copy the V850E2/MN4 device files for CubeSuite in the folder where CubeSuite is installed. Example: D:\Renesas Electronics CubeSuite\CubeSuite\Device_Custom Figure 5.3 Example of Destination Folder for Storing the Device Files (4) Setting up a workspace Follow the procedure given below when using the project-related files that come with the sample driver package.
Page 114
V850E2/MN4 USB MSC (Mass Storage Class) Driver <2> The “Open File” dialog box will appear. Select the project file for CubeSuite which is located in the “prj” folder in the directory in which the sample driver is installed. Figure 5.5 Selecting the CubeSuite Project File R01AN0011EJ0102 Rev.1.02...
Page 115
V850E2/MN4 USB MSC (Mass Storage Class) Driver (5) Setting up the build tool Follow the procedure given below to select the version of CX850 which is to be used as the build tool and to designate V850E2M MINICUBE as the debugging tool.
Page 116
V850E2/MN4 USB MSC (Mass Storage Class) Driver <3> Select ”V850E2M MINICUBE (Debug Tool)” from the Project Tree and select ”Using Debug Tool”→”V850E2M MINICUBE” from the right-click menu. Figure 5.8 Selecting the Debugging Tool R01AN0011EJ0102 Rev.1.02 Page 116 of 151 Jan 23, 2012...
Page 117
Connect between the RTE-V850E2/MN4-EB-S and the host machine. Connect the RTE-V850E2/MN4-EB-S and the host machine via the MINICUBE for debugging. In addition, connect between the USB B type receptacle of the RTE-V850E2/MN4-EB-S and the USB receptacle of the host machine for the MSC. Host machine Remarks: See section 7, Outline of the Starter Kit, for the physical appearance and port configuration of the RTE-V850E2/MN4-EB-S.
Page 118
V850E2/MN4 USB MSC (Mass Storage Class) Driver 5.3 Debugging in the CubeSuite Environment This section explains the procedure to debug an application program that is developed in the workspace introduced in section 5.2, Setting up the CubeSuite Environment. 5.3.1 Generating a Load Module To write a program into the target device, it is necessary to compile its source file that is coded in C or assembly language into a load module.
Page 119
You write (load) the generated load module into the target for execution. (1) Writing a load module Shown below is the procedure to write a load module into the RTE-V850E2/MN4-EB-S via CubeSuite. <1> Choose “Download” from the “Debug” menu and start the debugger.
Page 120
V850E2/MN4 USB MSC (Mass Storage Class) Driver (2) Running the program Press the CubeSuite’s button or choose “Go” from the “Debug” menu. Figure 5.13 Running the Program R01AN0011EJ0102 Rev.1.02 Page 120 of 151 Jan 23, 2012...
Page 121
Figure 5.14 Folder Configuration for the Sample Driver (Multi Version) (3) Installing device files Copy the V850E2/MN4 device files for Multi in the folder where Multi is installed. Example: C:\Green\V800.V517D\devicefile Figure 5.15 Example of Destination Folder for Storing the Device Files R01AN0011EJ0102 Rev.1.02...
Page 122
V850E2/MN4 USB MSC (Mass Storage Class) Driver (4) Starting Multi Select and start Multi Project File in “V850E2_MN4(MSC)_GHS.gpj” which is included in the sample driver package from the Explorer. Figure 5.16 Selecting the Multi Project File (5) Setting up the debugging tool Given below is the procedure to use MINICUBE as the debugging tool.
Page 123
V850E2/MN4 USB MSC (Mass Storage Class) Driver <2> Select the “Create New Connection Method” icon from the “Connection Chooser” dialog box. Figure 5.18 Selecting the Create New Connection Method <3> In the Create New Connection Method dialog box, enter an arbitrary name in the Name textbox and select “Custom”...
Page 124
Connect between the RTE-V850E2/MN4-EB-S and the host machine. Connect the RTE-V850E2/MN4-EB-S and the host machine via the MINICUBE for debugging. In addition, connect between the USB B type receptacle of the RTE-V850E2/MN4-EB-S and the USB receptacle of the host machine for the MSC. Host machine Remarks: See section 7, Outline of the Starter Kit, for the physical appearance and port configuration of the RTE-V850E2/MN4-EB-S.
Page 125
V850E2/MN4 USB MSC (Mass Storage Class) Driver 5.5 Debugging in the Multi Environment This section explains the procedure to debug an application program that is developed in the workspace that is introduced in section 5.4, Setting up the Multi Environment.
Page 126
You program (load) the generated load module into the target for execution. (1) Programming the load module Shown below is the procedure to program a load module into the RTE-V850E2/MN4-EB-S via Multi. <1> Choose “Connect” from the Multi’s “Connect” menu to open the Connection Chooser.
Page 127
V850E2/MN4 USB MSC (Mass Storage Class) Driver <3> MULTI Debugger will then start. Choose “Debug Program” from the “File” menu and download the load module. Figure 5.25 Choosing a MULTI Debugger Menu The load module is generated in the “prj” folder under the name of “V850E2_MN4_MSC_GHS.” Select it and click the “Open”...
Page 128
V850E2/MN4 USB MSC (Mass Storage Class) Driver (2) Running the program Press the MULTI Debugger’s button or choose “Go on Selected Items” from the “Debug” menu. Figure 5.27 Running the Program R01AN0011EJ0102 Rev.1.02 Page 128 of 151 Jan 23, 2012...
Page 129
V850E2/MN4 USB MSC (Mass Storage Class) Driver 5.6 Setting up IAR Embedded Workbench Environment This section explains the preparatory steps that are required to develop or debug using IAR Embedded Workbench which is introduced in section 5.1, Development. 5.6.1 Setting up the Host Environment You create a dedicated workspace on the host machine.
Page 130
V850E2/MN4 USB MSC (Mass Storage Class) Driver (3) Installing device files Copy the V850E2/MN4 device files for the IAR Embedded Workbench in the folder where the IAR Embedded Workbench is installed. Example: C:\Program Files\IAR Systems\Embedded Workbench 6.0 for V850 kickstart\v850\inc Figure 5.29...
Page 131
V850E2/MN4 USB MSC (Mass Storage Class) Driver (5) Setting up the debugging tool Given below is the procedure to use MINICUBE as the debugging tool. <1> Select “Options” of the “V850E2_MN4(MSC)_IAR- Release (or Debug)” properties item, and open the Connection Chooser.
Page 132
V850E2/MN4 USB MSC (Mass Storage Class) Driver <3> Select “MINICUBE E2x” from Driver in the “Setup” tab and press the “OK” button. Figure 5.33 Selecting Debugger R01AN0011EJ0102 Rev.1.02 Page 132 of 151 Jan 23, 2012...
Page 133
Connect between the RTE-V850E2/MN4-EB-S and the host machine. Connect the RTE-V850E2/MN4-EB-S and the host machine via the MINICUBE for debugging. In addition, connect between the USB B type receptacle of the RTE-V850E2/MN4-EB-S and the USB receptacle of the host machine for the MSC. Host machine Remarks: See section 7, Outline of the Starter Kit, for the physical appearance and port Configuration of the RTE-V850E2/MN4-EB-S.
Page 134
V850E2/MN4 USB MSC (Mass Storage Class) Driver 5.7 Debugging in the IAR Embedded Workbench Environment This section explains the procedure to debug an application program that is developed in the workspace that is introduced in section 5.6, Setting up IAR Embedded Workbench Environment.
Page 135
You program (load) the generated load module into the target for execution. (1) Programming the load module Shown below is the procedure to program a load module into the RTE-V850E2/MN4-EB-S via IAR Embedded Workbench. <1> Select “Download and Debug” from the “Project” menu in the IAR Embedded Workbench. And load the generated load module into the target.
Page 136
V850E2/MN4 USB MSC (Mass Storage Class) Driver (2) Running the program Press the IAR Embedded Workbench button or choose “Go” from the “Debug” menu. Figure 5.37 Running the Program R01AN0011EJ0102 Rev.1.02 Page 136 of 151 Jan 23, 2012...
Page 137
CubeSuite, Multi, or IAR Embedded Workbench environment. (1) Connecting to the USB B receptacle Connect between the USB B receptacle of the RTE-V850E2/MN4-BE-S and a USB port of the host machine with a USB cable. (2) Installing the host driver The driver to be used for connection with the USB B receptacle is the host driver for the mass storage class which comes standard with Windows.
Page 138
V850E2/MN4 USB MSC (Mass Storage Class) Driver (4) Formatting a removable disk Open the Windows’s “My Computer” and “Removable Disk” will appear. Figure 5.39 Checking the Removable Disk Remarks: ”(F:)” in this screen example is the drive letter that is automatically assigned by the OS. This drive letter varies with the host machine’s configuration.
Page 139
V850E2/MN4 USB MSC (Mass Storage Class) Driver <2> The “Format Removable Disk” dialog box will then appear. Select necessary items and click the “Start” button. Figure 5.41 Format Menu and Format Complete Dialog Box <3> A message will appear when formatting is completed. Click the “OK” button.
Page 140
V850E2/MN4 USB MSC (Mass Storage Class) Driver <2> Open the Removal Disk in the My Computer and copy the TEST.txt file from the local disk to the Removable Disk. Figure 5.43 Copying the Test Data File <3> Open the Test folder in the local disk and copy the TEST.txt file from the Removable Disk to the Test folder.
Page 141
V850E2/MN4 USB MSC (Mass Storage Class) Driver <4> Open the TEST.txt file in the Test folder and make sure that its contents match those of the TEST.txt file on the local disk. Figure 5.45 Checking the Test Data File Remarks: An internal RAM area of 24 Kbytes is used as the data area. Consequently, the data you stored will be initialized when the device power is turned off or the Reset switch is pressed.
6. Sample Driver Application This section contains the information you should be aware of when using the USB mass storage class (MSC) sample driver for the V850E2/MN4. 6.1 Overview You create a driver that suits your system by customizing the sample driver.
Page 143
V850E2/MN4 USB MSC (Mass Storage Class) Driver 6.2 Customization This section describes the sections you should rewrite when using the sample driver. 6.2.1 Application Section The main routine processing function (main) in the file "main.c" shows simple processing as an example of use of the sample driver.
Page 144
I/O registers of the V850E2/MN4. The IAR Embedded Workbench version of the sample driver comes with a separate file named "io70f3512.h" which contains the definitions of internal I/O registers of the V850E2/MN4. (1) File "usbf850.h" Defines the settings of the USB function controller registers.
Page 145
V850E2/MN4 USB MSC (Mass Storage Class) Driver 6.2.4 Making Changes to the SCSI Command Processing The SCSI command processing is coded in the files "scsi_cmd.c" and "scsi.h." Make the changes shown below when adding a new SCSI command that is to be supported.
Page 146
V850E2/MN4 USB MSC (Mass Storage Class) Driver 6.2.5 Changing the RAM Disk Size The size of the RAM disk is defined in the file "scsi.h." The product of ALL_LOGICBLOCK (total number of blocks) and LOGICBLOCK_SIZE (block size) indicates the capacity of the RAM disk (this is set to 0x6000 (= 24 Kbytes) for the sample driver).
Page 147
V850E2/MN4 USB MSC (Mass Storage Class) Driver 6.2.6 Vendor and Product Name Settings You can modify the vendor and product names for any disk drive by editing the response values to the INQUIRE command defined in the file "scsi_cmd.c." (1) INQUIRY_TABLE code "INQUIRY_TABLE"...
Page 148
V850E2/MN4 USB MSC (Mass Storage Class) Driver 6.3 Using Functions Since processes that are frequently used or that have broad utility are implemented as defined functions, they simplify coding and contribute to reduction in code size. See section 4.3, Function Specifications, for details on the functions.
Midas lab Inc. 7.1 Outline The RTE-V850E2/MN4-EB-S is a starter kit that allows you to experience the development of an application system using the V850E2/MN4. You can follow a sequence of development processes from program preparation, building, debugging, to operation check simply by installing required development tools and a USB driver on the host machine and connecting this kit via MINICUBE.
Page 150
V850E2/MN4 USB MSC (Mass Storage Class) Driver 7.3 Major Specifications The major specifications of the RTE-V850E2/MN4-EB-S are given below. • CPU: μPD70F3512 (V850E2/MN4) • Operating frequency: 200 MHz (PLL-driven x20 multiplier function) • Interface: Two USB receptacles (USB host type A × 1, USB function type B × 1)
Page 151
V850E2/MN4 USB MSC (Mass Storage Class) Driver Website and Support Renesas Electronics Website http://www.renesas.com/ Inquiries http://www.renesas.com/inquiry All trademarks and registered trademarks are the property of their respective owners. R01AN0011EJ0102 Rev.1.02 Page 151 of 151 Jan 23, 2012...
Page 152
Revision Record Description Rev. Date Page Summary 1.00 Jun 30, 2010 — First edition issued. 1.01 Jan 14, 2011 Text format revised. Descriptions of GHS version added to Chapter 5, Development Environment. 1.02 Jan 23, 2012 2, 5, 7, 124, Desriptions of IAR Embedded Workbench are added.
Page 153
General Precautions in the Handling of MPU/MCU Products The following usage notes are applicable to all MPU/MCU products from Renesas. For detailed usage notes on the products covered by this manual, refer to the relevant sections of the manual. If the descriptions under General Precautions in the Handling of MPU/MCU Products and in the body of the manual differ from each other, the description in the body of the manual takes precedence.
Page 154
Electronics product for any application categorized as "Specific" without the prior written consent of Renesas Electronics. Further, you may not use any Renesas Electronics product for any application for which it is not intended without the prior written consent of Renesas Electronics. Renesas Electronics shall not be in any way liable for any damages or losses incurred by you or third parties arising from the use of any Renesas Electronics product for an application categorized as "Specific"...
Need help?
Do you have a question about the V850E2 and is the answer not in the manual?
Questions and answers