Simple generic HID example demonstrating bidirectional communication. The firmware is compatible with the AN82072 Application note of Cypress so that we could use that PC application to test the USB communication.

Dependencies:   USBDevice mbed

13_USBHID_demo

Simple generic HID example demonstrating bidirectional communication. The firmware is compatible with the AN82072 Application note of Cypress so that we could use that PC application to test the USB communication. We send and receive 8 byte packages, however not all of this data is really used.

Input report data (received by the PC):

  • Byte0: button status (0: pressed, 1: released)
  • Byte1-Byte4: raw ADC data (32 bit, big Endian format) - actually we use only the lowest 16 bits...

Output report data (sent by the PC):

  • Byte0: LED control for LED_RED (0: off, 1: on)
  • Byte1: PWM duty cycle control for LED_GREEN (0-100: duty cycle in %)

Hardware requirements:

  • FRDM-KL25Z board
  • Analog signal (potmeter or thermometer) connected to the A0 (PTB0) analog input
  • Pushbutton connected between D3 (PTA12) and GND.
  • Socket labelled as USB shoud be connected to Computer running the Generic HID UI.exe application

Software requirements:

  • We need files Generic HID UI.exe and CyUSB.dll from package AN82072.zip

Usage

  • Write VID and PID values (0x1234 and 0x0006 respectively) and click on the SET button. If the FRDM-KL25Z board is connected, the green "Connected" message should show up.
  • Use the control elements to control the LEDs (you must click the Update button to send a new PWM value).
  • Watch the data read from the ADC and the status of the D3 digital input.

/media/uploads/icserny/an82072.png

Revisions of USBDevice.lib

Revision Date Message Actions
0:f259361d7db8 2016-05-06 First version; File  Diff  Annotate