User’s Manual 16 RX62N Group Renesas Starter Kit+ USB Function Sample Code User’s Manual RENESAS MCU RX Family / RX600 Series All information contained in these materials, including products and product specifications, represents information on the product at the time of publication and is subject to change by Renesas Electronics Corp. without notice. Please review the latest information published by Renesas Electronics Corp. through various means, including the Renesas Electronics Corp.
Notice 1. 2. 3. 4. 5. 6. 7. All information included in this document is current as of the date this document is issued. Such information, however, is subject to change without any prior notice. Before purchasing or using any Renesas Electronics products listed herein, please confirm the latest product information with a Renesas Electronics sales office.
Disclaimer By using this Renesas Starter Kit (RSK), the user accepts the following terms: The RSK is not guaranteed to be error free, and the entire risk as to the results and performance of the RSK is assumed by the User.
How to Use This Manual 1. Purpose and Target Readers This manual is designed to provide the user with an understanding of the RSK hardware functionality, and electrical characteristics. It is intended for users designing sample code on the RSK platform, using the many different incorporated peripheral devices. The manual comprises of an overview of the capabilities of the RSK product, but does not intend to be a guide to embedded programming or hardware design.
2.
Table of Contents 1. Overview ............................................................................................................................................ 7 2. Development Environment ................................................................................................................ 8 2.1 2.2 2.3 Sample Code Configuration ......................................................................................................................................
RSK+RX62N R20UT0255EG0100_RX62N Rev.1.00 th 26 August 2010 RENESAS STARTER KIT+ 1. Overview The RSK USB sample code provides a basis for a developer to add USB device functionality to a system. It includes sample applications for the three most common USB Device classes:• Human Interface Device (HID) • Communication Device Class – Abstract Control Model (CDC-ACM) • Mass Storage Class (MSC) In addition to the three defined USB classes a LibUSB sample is included.
RSK+ RX62N Development Environment 2. Development Environment 2.1 Sample Code Configuration The Sample code is provided as a project generator with the RSK. To create the sample code project follow the instructions in the RSK Quick Start Guide for creating a new project. Choose as a project type one of the following: 1. USB Communication Device Class 2. USB Human Interface Device Class 3. USB LibUSB Device 4.
RSK+ RX62N USB Stack 3.USB Stack (Target) The USB software is implemented in the form of a USB stack comprising of three layers. At the bottom of the stack is a hardware abstraction layer (HAL) that provides a hardware independent API for the upper layers. In the middle is a core layer (USBCore) that handles standard device requests. At the top of the stack are the USB Device Classes consisting of HID, CDC and MSC. These specific classes are described in their own sections below.
RSK+ RX62N USBHALInterruptHandler Applications The system must be setup so that this gets called when any USB Interrupt occurs. The HAL module consists of the following files:¾ usb_hal.c ¾ usb_hal.h. ¾ usb_common.
RSK+ RX62N 3.2 Applications USBCore The USBCore layer handles standard USB requests common to all USB devices during the enumeration stage. This means that a developer can concentrate on any class or vendor specific implementation. The USBCore requires initialising with the descriptors specific to the device being implemented. It uses the USBHAL, which it initialises, to access the particular HW.
RSK+ RX62N 3.3 Applications Human Interface Device Class The HID class as the name suggests is commonly used for things like keyboards, mice and joysticks where a human’s action is causing the need for communication. However this does not need to be the case. The HID class is suitable for any device where the communication can be achieved by sending data in ‘reports‘ of a predefined size where the data transfer rate is not critical. The HID class has been supported by Microsoft Windows 98 onwards.
RSK+ RX62N 3.4 Applications Communication Device Class The CDC ACM allows a host to see a device as a standard serial (COM) port. This is particularly useful when working with legacy applications that use serial communications. Bulk IN and Bulk OUT transfers are used for all non-setup data. The CDC module utilises the USBCore layer for the processing of all standard requests. In addition it processes the following class requests.
RSK+ RX62N 3.5 Applications Mass Storage Class The MSC class has become a very popular way for devices, such as cameras and USB Pens, to share data with PCs. The reason for the success is that when the device is plugged in to a host PC it appears to the PC as just another drive and therefore users can use familiar applications such as Windows Explorer to access the data. From Windows 2000 onwards the MSC class has been supported with no need for custom drivers or ‘inf’ files.
RSK+ RX62N Applications 4. Applications 4.1 Introduction to Applications The following sections introduce the sample applications that can be used to demonstrate each of the USB solutions. The HID and LibUSB projects require specially written host applications that are supplied as both executables and as source. The CDC and MSC projects make use of standard Windows applications. All the applications require that the RSK has been programmed with the appropriate sample code for the application.
RSK+ RX62N Applications Program the RSK with the HID application and run the code. Connect a USB cable between the PC and the RSK. The first time the device is connected to a specific USB port windows will detect the new device and automatically load the intrinsic HID class driver. When windows has completed the enumeration process you need to make a connection from the application to the target.
RSK+ RX62N 4.3 Applications Communications Device Class Application The CDC sample application demonstrates communication with a Windows PC using a standard terminal program. Windows provides a suitable application called HyperTerminal. Any other serial terminal program will be able to be used if available. Program the RSK with the CDC application and run the code as described in the RSK tutorial manual. Connect a USB cable between the host PC and the RSK.
RSK+ RX62N Applications Either type or browse to the location of the CDC project you have generated and built and then to the host/driver folder. Press next to install the CDC support. During the installation process a warning may be displayed as shown. Please choose “Continue Anyway” to install the driver. Please review the Microsoft website for details of the Windows Logo Testing programme. Windows will then complete the installation of the CDC USB driver.
RSK+ RX62N Applications To demonstrate two-way communication press SW2 to put the RSK into echo mode. In this mode anything typed on the Terminal will be read by the RSK and then echoed back to the terminal. Pressing SW3 cancels this echo mode. Figure 2 - Serial communication dialog The CDC application functionality specific to USB consists of the following files:Target: usb_cdc_app.c usb_cdc_app.h Host: \PC\ CDC_Demo.
RSK+ RX62N 4.4 Applications Mass Storage Class Demonstration The MSC sample demonstrates how a host can view a MSC device as an external drive. There is no additional application for this as the MSC support is inherent in Windows XP. Start the MSC sample application running on the RSK then connect the RSK to a Windows PC via a USB cable. Using Windows Explorer, or similar, look to find the new drive that Windows will have mounted. This drive is viewing the contents of the sample RAM Disk on the RSK.
RSK+ RX62N 4.5 Applications LibUSB The LibUSB sample application is functionally similar to the previous HID application. The difference is that this sample includes software for a Windows host PC called RSK_LibUSB. The intention of this open source library is to provide a platform independent operating system interface allowing a device to be used on multiple operating systems with a common code base.
RSK+ RX62N Applications Note: This is a screen shot after a connection has been made and the ‘Set LCD’ button and then the ‘Read ADC’ button have been used. Program the RSK with the LibUSB sample code as described in the RSK tutorial manual. Then run the code. Connect a USB cable between the host PC and the RSK. The first time the device is connected to a specific USB port Windows will detect the new device and ask for the appropriate driver. This has been provided in a subdirectory of the sample code.
5. Additional Information Technical Support For details on how to use High-performance Embedded Workshop (HEW, refer to the HEW manual available on the CD or from the web site. For information about the RX62N series microcontrollers refer to the RX62N Group hardware manual. For information about the RX62N assembly language, refer to the RX600 Series Software Manual. Online technical support and information is available at: http://www.renesas.
REVISION HISTORY Rev. RSK+ RX62N USB User’s Manual Date Description Page 0.01 29,July, 2010 1.00 26,August,2010 ⎯ Summary Preliminary version.
RSK+RX62N User’s Manual: USB Function Samples Publication Date: Rev.1.
http://www.renesas.com SALES OFFICES Refer to "http://www.renesas.com/" for the latest and detailed information. Renesas Electronics America Inc. 2880 Scott Boulevard Santa Clara, CA 95050-2554, U.S.A. Tel: +1-408-588-6000, Fax: +1-408-588-6130 Renesas Electronics Canada Limited 1101 Nicholson Road, Newmarket, Ontario L3Y 9C3, Canada Tel: +1-905-898-5441, Fax: +1-905-898-3220 Renesas Electronics Europe Limited Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, U.
RX62N Group R20UT0255EG0100