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) •...
Chapter 3.Development Environment 3.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. When created the sample code will contain the source for both the Host and Target projects, including any configuration driver files. 3.2.Target Sample Code Options When developing USB software it is useful to be able to get debug information out at runtime without stopping code from running such as when stepping in a debugger.
Control (Setup, Data IN/OUT, Status) Bulk (IN and OUT) Interrupt (IN) Some HAL implementations may not be able to support all these modes but the H8SX1664 implementation does. Here is a list of the functions that make up the USBHAL API. Name...
4.2.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.
4.3.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‘...
4.4.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.
4.5.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.
All the applications require that the RSK has been programmed with the appropriate sample code for the application. Details of how to program the RSK have been provided as part of the tutorial with the product. To obtain a digital copy of the manual please visit the Renesas web site at www.renesas.com/renesas_starter_kits...
Page 12
Input Report: Byte 1 Bit 0 = LED status. Bit 1 = ADC value valid indicator. Bit 2 = Switch pressed indicator. Byte 2-5 = 32 bit, little endian ADC Value. Output Report: Byte 1 Bit 0 = LED toggle request. Bit 1 = ADC read request.
5.3.Communications Device Class Application The CDC sample application demonstrates communication with a Windows PC using a standard terminal program. Windows provide 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.
Page 14
COM port , it will receive a repeating message from the RSK saying: “Renesas USB CDC Sample, Press Switch SW1.” Note that the configuration settings for such things as baud rate and parity are irrelevant for this virtual COM port.
Page 15
Pressing SW1 on the RSK will stop this repeating message and will bring up the main menu as shown below. 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.
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. It has been formatted with a FAT file system and given a volume name of “RENESAS”. The available space for data is 4KB.
5.5.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.
Page 18
The “Set LCD” button allows the text of the LCD on the RSK to be changed. To demonstrate that the RSK can also instigate communications you can press a switch on the RSK and this will be indicated back to the host resulting in a message being displayed on the dialog.
For information about the H8SX/1664 assembly language, refer to the H8SX Series Programming Manual For information about the E10A Emulator, please refer to the H8S, H8SX Family E10A-USB Emulator User’s Manual Further information available for this product can be found on the Renesas website at: http://www.renesas.com/renesas_starter_kits General information on Renesas Microcontrollers can be found on the following website.