 RE: LPC2468 USB_EndPoint1 settings for Sending 50 Bytes to Host(PC) Tsuneo Chinzei HID Report Descriptor
HID_LogicalMin(0),
HID_LogicalMax(1),
This declaration means each byte of your report has just one of two values, 0 or 1. Is it what you want? If you use full extent of byte, 0x00 - 0xFF, modify above code as follows.
HID_LogicalMin(0),
HID_LogicalMaxS( 0x00FF ),
Please note, Instead of HID_LogicalMax(), HID_LogicalMaxS() macro is applied, because the parameter of these macro is signed integer. HID_LogicalMax() - single byte, signed integer HID_LogicalMaxS() - two bytes, signed integer
Endpoint descriptor The problem is here, wMaxPacketSize on the endpoint descriptor.
WBVAL(0x000A), /* wMaxPacketSize */
You've set it to 10 bytes. It means your device splits 50 bytes report into 5 transactions of 10 bytes.
WBVAL(0x0040), /* wMaxPacketSize */
Set it to 64 bytes. I recommend you to set it always to 64 for full-speed device. On the spec, any number will do, but it doesn't mean the programer of the PC device driver has debugged it in all numbers. 64 is the certain number absolutely, because it is the full size for interrupt (HID) and bulk endpoints on full-speed.
Maybe, you aren't sure how wMaxPacketSize works. I wrote a short article about the relation of "Transfer - transaction - packet" in this post. It describes how wMaxPacketSize works on the USB protocol. It is applied to bulk and interrupt (HID) transfer. "C8051F340 USB_Bulk example question" on SiLabs Forum http://www.cygnal.org/ubb/Forum9/HTML/001627.html
Endpoint handler - USB_EndPoint1 If you want to send 10 bytes report, set HID_ReportCount to 10 on the report descriptor. HID_ReportCount() determines the transfer size. The HID device driver on PC drops all transfer, whose size doesn't match to the report descriptor. Then, your host application sees just the report whose size is defined in the report descriptor. Also, this USB_EndPoint1() implementation means that your firmware sends the report repeatedly at the rate of bInterval (10 ms, but actually 8 ms) on the endpoint descriptor. If you send the report just when you want, see this implementation. "HID Mouse keeps sending unneeded data!" http://www.keil.com/forum/docs/thread11531.asp For report of greater size, see this topic. "USB HID reports longer than 64 bytes on lpc2141" http://www.keil.com/forum/docs/thread12679.asp Tsuneo |