LPC Open HID Generic Example

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC Open HID Generic Example

1,150 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Lucio Silveira on Mon Jun 02 12:10:32 MST 2014
Hi everyone. I've tested the usbd_lib_hid_generic from the lpcopen v2.10 to the LPC1769 microcontroller. The examples worked so far, but I'm only enable to send only a single byte report at a time. Could someone help me by saying what I need to change in this project to implement a 64 bytes report comunication from host to device and device to host ?

Thanks in advance
Labels (1)
0 Kudos
5 Replies

863 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Lucio Silveira on Wed Jun 04 03:24:30 MST 2014
Hi Mike. I did what you suggested and everything worked just fine. Now I'm able to write and read 64 bytes at a time. Thanks!
0 Kudos

863 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Lucio Silveira on Tue Jun 03 08:13:23 MST 2014
Thank's Mike. I'll test and let you know about the results.

0 Kudos

863 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mch0 on Tue Jun 03 07:50:10 MST 2014
Oh, indeed, I forgot about the EP size. That's why I said "at least", I didn't compile and test.
I will use hid_generic with 64 Bytes report size later myself, that's why I'm interested and I have done this on a different platform in the past.

Well, the EP size is defined also in hid_desc.c, this is the relevant part of the descriptor:

USB_ENDPOINT_DESC_SIZE,/* bLength */
USB_ENDPOINT_DESCRIPTOR_TYPE,/* bDescriptorType */
HID_EP_IN,/* bEndpointAddress */
USB_ENDPOINT_TYPE_INTERRUPT,/* bmAttributes */
WBVAL(0x0004),/* wMaxPacketSize */
0x08,/* 16ms */          /* bInterval */
/* Endpoint, HID Interrupt Out */
USB_ENDPOINT_DESC_SIZE,/* bLength */
USB_ENDPOINT_DESCRIPTOR_TYPE,/* bDescriptorType */
HID_EP_OUT,/* bEndpointAddress */
USB_ENDPOINT_TYPE_INTERRUPT,/* bmAttributes */
WBVAL(0x0004),/* wMaxPacketSize */

See if a change of  the two WBVAL(0x0004) to WBVAL(64) do the trick.
Probably even better, change  the first to WBVAL(HID_INPUT_REPORT_BYTES) and the second one to WBVAL(HID_OUTPUT_REPORT_BYTES).

The feature reports are handled by EP0, but  would assume that the driver splits a 64 byte transfer as required by USB_MAX_PACKET0.

But since I did neither an actual test nor look into the source code yet, this is an assumption right now.
I hope these changes suffice, because later I'll have to get the same setup running for me, too ...

Mike
0 Kudos

863 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Lucio Silveira on Tue Jun 03 06:19:02 MST 2014
Thank you for answering. I've already done it. I Know there's something more to do like changing something in the endpoint descriptor and change the "IN" and "OUT" report handler but I don't know how to do it.

0 Kudos

863 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mch0 on Tue Jun 03 05:07:14 MST 2014
Hi,

you will want to change at least these definitions in hid_desc.c

#define HID_INPUT_REPORT_BYTES       1/* size of report in Bytes */
#define HID_OUTPUT_REPORT_BYTES      1/* size of report in Bytes */
#define HID_FEATURE_REPORT_BYTES     1/* size of report in Bytes */

Mike
0 Kudos