background image

 

Chapter 5.Applications 

5.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. 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

 and select your RSK from the list. 

5.2.Human Interface Device Application 

The HID host sample application is written for a Windows host PC and is called RSK_HID.   

The pre-built executable has been provided with the project generator.  Navigate to the release directory under the project and run 

RSK_HID.exe. The following window will be displayed: 

 

 

Figure 2 - HID host PC application 

 

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. Click the 

“Connect” button and you will be asked to confirm the VID and PID of the device you wish to connect with. If you have not altered the firmware 

on the RSK to use your own VID and PID then the defaults will be correct. When a connection is successfully made information about the 
device will be displayed and the rest of the buttons will be enabled. 

The “Toggle LED” button enables a LED on the RSK to be toggled on and off. 

The “Read ADC” button will command the RSK to read its ADC and return the value back to the host where it will be displayed. 

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. 

This demonstrates that Input and Output HID reports are being sent successfully between the RSK and the PC. The format of the reports is 

as follows: 

11 

Summary of Contents for H8SX1664

Page 1: ...0J0134 0100 Renesas Starter Kit for H8SX1664 USB Sample Code User s Manual RENESAS SINGLE CHIP MICROCOMPUTER H8SX FAMILY Rev 1 00 Renesas Technology Europe Ltd Revision date 08 January 2008 www renesas com ...

Page 2: ... 5 Chapter 4 USB Stack Target 6 4 1 Hardware Abstraction Layer 6 4 2 USBCore 7 4 3 Human Interface Device Class 8 4 4 Communication Device Class 9 4 5 Mass Storage Class 10 Chapter 5 Applications 11 5 1 Introduction to Applications 11 5 2 Human Interface Device Application 11 5 3 Communications Device Class Application 13 5 4 Mass Storage Class Demonstration 16 5 5 LibUSB 17 Chapter 6 Additional I...

Page 3: ...red trademarks of their respective companies or organisations Copyright Renesas Technology Europe Ltd 2007 All rights reserved Renesas Technology Corporation 2007 All rights reserved Renesas Solutions Corporation 2007 All rights reserved Website http www renesas com Glossary ADC Analog to Digital Converter USB Universal Serial Bus CPU Central Processing Unit DAC Digital to Analog Converter DMA Dir...

Page 4: ...stem A sample using a Microsoft Windows XP host is provided The embedded software is available as source written in ANSI C and does not require an operating system The host applications software is also available as source written for MS Windows using VisualC This manual describes the technical details of the RSK hardware The Quick Start Guide and Tutorial Manual provide details of the software in...

Page 5: ...SK To view the serial output the following settings are required Baud 19200 Data 8 Bit Parity None Stop Bits 1 Flow None The level of debug message can be set using the define VERBOSE_LEVEL This is described in the file usb_common h in the USBStack directory Note that a high level of debug messages can significantly slow down the system 3 3 Host Application Software To build the Microsoft Visual C...

Page 6: ...ion does Here is a list of the functions that make up the USBHAL API Name Description USBHAL_Init Initialise the HAL Register callback functions If using the USB Core layer then this is done automatically USBHAL_Config_Get Get the current HAL configuration USBHAL_Config_Set Set the current HAL configuration USBHAL_Control_ACK Generate an ACK on the Control IN pipe Used following a setup packet USB...

Page 7: ...ted and this is currently English Manufacturer Product Serial Number The USBCDC API consists of a single function called USBCORE_Init This initialises the USBCore and the HAL In addition to passing device descriptors to this function it also requires call back functions for the following conditions A Setup packet has been received that this layer can t handle This enables a higher layer to handle ...

Page 8: ...its own drivers for it so there is no need to develop a custom Windows driver or even a Windows inf file This implementation of the HID class supports a single IN report and a single OUT report Both Interrupt IN and Control IN via Get_Report transfers are supported for sending a report to the host Reports from the host must use Control OUT via Set_Report Here are the functions that make up the USB...

Page 9: ...e the functions that make up the USBCDC API Name Description USBCDC_Init Initialise the CDC module This also initialises the Core and HAL layers USBCDC_IsConnected Returns the connected status of the device USBCDC_WriteString A blocking function that sends a string to the host USBCDC_PutChar A blocking function that sends a character to the host USBCDC_GetChar A blocking function that gets a chara...

Page 10: ...packaged up in a Command Block Wrapper CBW within a Bulk OUT transfer A data stage may follow in either direction and then to complete the SCSI command the device sends a status response in the form of a Command Status Wrapper CSW The following SCSI commands are supported INQUIRY READ_CAPACITY10 READ10 REQUEST_SENSE TEST_UNIT_READY WRITE10 VERIFY10 PREVENT_ALLOW_MEDIUM_REMOVAL Optional MODE_SENSE6...

Page 11: ...tion 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 Click the Connect button and you will be asked to confirm the VI...

Page 12: ... read request Bit 2 LCD set request Byte 2 17 16 ASCII Characters for LCD An input report is sent whenever a switch on the RSK is pressed or when the host requests a report An output report is sent whenever a user clicks on one of the dialog buttons The HID application functionality specific to USB consists of the following files Target usb_hid_app c usb_hid_app h Host Application PC RSK_HID 12 ...

Page 13: ...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 The first time the device is connected to a specific USB port windows will detect the new device Windows will present the following dialog where you should select No not this time In the following dialog select Install from a list or spe...

Page 14: ...ort will become available to Window Applications To be able to see the port that has been allocated you can open the Windows Device Manager window To do this go to the start menu and select run In the dialog displayed type devmgmt msc This will open the device manager Expand the group of serial ports and the installed ports will be listed When the Serial Terminal program connects to this COM port ...

Page 15: ... on the Terminal will be read by the RSK and then echoed back to the terminal Pressing SW3 cancels this echo mode Figure 3 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 inf Note that the configuration settings for such things as baud rate and parity are irrelevant for this virtual CO...

Page 16: ...h a FAT file system and given a volume name of RENESAS The available space for data is 4KB It includes one example file called Renesas txt which can be opened edited and saved As you would expect from a normal drive you can also copy files to it although remember that this is a RAM Disk that will loose its contents when power is removed from the RSK Figure 4 Windows Explorer showing new Disk Drive...

Page 17: ...ot after a connection has been made and the Read ADC button and the Set LCD 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 pr...

Page 18: ...hosen for all messages one for OUT and one for IN IN Message RSK to PC 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 OUT Message PC to RSK Byte 1 Bit 0 LED toggle request Bit 1 ADC read request Bit 2 LCD set request Byte 2 17 16 ASCII Characters for LCD An IN message is sent whenever a switch on the RSK is pressed An ...

Page 19: ...p Hardware Manual 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 ...

Page 20: ...User s Manual Publication Date Rev 1 00 08 Jan 2008 Published by Renesas Technology Europe Ltd Dukes Meadow Millboard Road Bourne End Buckinghamshire SL8 5FH United Kingdom 2008 Renesas Technology Europe and Renesas Solutions Corp All Rights Reserved ...

Page 21: ...Renesas Starter Kit for H8SX1664 USB Sample Code User s Manual Renesas Technology Europe Ltd Dukes Meadow Millboard Road Bourne End Buckinghamshire SL8 5FH United Kingdom ...

Reviews: