User`s manual
RSK+ RX62N Applications
R20UT0255EG0100 Page 22 of 22
August 26, 2010
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. Following the same process as
described in the Communications Device Class Application above navigate to the LibUSB driver as described and install it.
It should now be possible to make a connection from the application. 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’ve 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.
1. The “Toggle LED” button enables a LED on the RSK to be toggled on and off.
2. 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.
3. 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 data can be sent successfully between the RSK and the PC. A fixed sized format of data has been chosen 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 Interrupt IN transfer is used for this. An IN message is also sent
in response to certain OUT messages, a BULK IN transfer is used for this.
An OUT message is sent whenever a user clicks on one of the dialog buttons, a BULK OUT transfer is used for this.
The LibUSB application consists of the following files:-
Target:
libusb_app.c
libusb_app.h
usbdescriptors.c
Host:
\PC\RSK_LibUSB\...