Author Topic: HID Data Cannot exceed 128 bytes !!??  (Read 12939 times)

samulasun

  • Member
  • ***
  • Posts: 2
HID Data Cannot exceed 128 bytes !!??
« on: August 09, 2010, 09:43:46 pm »
Hi all,

I met a strange situation, I send 0x86 bytes from device to PC,
but PC only show 0x06 bytes on the screen (by Bushound),
the rest 0x80 bytes disappear. I use an USB analyzer to capture
the physical transaction, the data is correct, there are 0x86 bytes
in the USB BUS, but I can only see 0x06 bytes !!??


It looks like the PC reset automatically when receive data more than 128 bytes.

I think this may cause by the report descriptor, the following is my descriptor:
{
   0x06,0x0A,0xFF,          // Usage Page (FFA0h, vendor defined)
   0x09,0x01,                // Usage (vendor defined)
   0xA1,0x00,                // Collection (Application)
   0x09,0x02,                 // Usage (vendor defined)
   0xA1,0x00,                // Collection (Physical)
   0x06,0xA1,0xFF,          // Usage Page (vendor defined)
                                                   
// The Input report                               
   0x09,0x03,              // Usage (vendor defined)
   0x09,0x04,            // Usage (vendor defined)
   0x15,0x00,            // Logical minimum (80h or -128)
   0x26,0x00,0x01,         // Logical maximum (7Fh or 127)
   0x35,0x00,            // Physical minimum (0)
   0x45,0x7F,            // Physical maximum (255)
   0x75,0x08,            // Report size (8 bits)
   0x96,0x00,0x01,         // Report count (2 fields)
   0x81,0x02,                // Input (data, variable, absolute)
                               
   0x09,0x05,             // Usage (vendor defined)
   0x09,0X06,              // Usage (vendor defined)
   0x15,0x00,            // Logical minimum (80h or -128)
   0x26,0x00,0x01,         // Logical maximum (7Fh or 127)
   0x35,0x00,            // Physical minimum (0)
   0x45,0xFF,            // Physical maximum (255)
   0x75,0x08,            // Report size (8 bits)
   0x96,0x00,0x01,         // Report count (2 fields)
   0x91,0x02,            // Output (data, variable, absolute)
                                                   
   0xC0,                  // End Collection (Physical)
   0xC0,                  // End Collection (Application)
};

Could someone please help me to understand why this happen, Thank you all.


Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: HID Data Cannot exceed 128 bytes !!??
« Reply #1 on: August 09, 2010, 11:31:26 pm »
All HID data is in defined reports. Your report descriptor shows a 2-byte Input report. Thus your device should send 2 bytes to the host in each interrupt IN transfer. The host will likely ignore data that doesn't fit the HID's report format.

Jan

Guido Koerber

  • Frequent Contributor
  • ****
  • Posts: 72
Re: HID Data Cannot exceed 128 bytes !!??
« Reply #2 on: August 10, 2010, 05:11:36 am »
The descriptor looks all wrong, you seem to have forgotten the second byte for some of the values. Your report size is 256 bytes as per your descriptor. Depending on the speed your device uses the report may need to be broken down into multiple transfers, they size of interrupt data packets is limited depending on the device speed.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: HID Data Cannot exceed 128 bytes !!??
« Reply #3 on: August 10, 2010, 08:03:30 am »
Guido is correct. I was looking at the comments, not the actual data.

Jan

samulasun

  • Member
  • ***
  • Posts: 2
Re: HID Data Cannot exceed 128 bytes !!??
« Reply #4 on: August 10, 2010, 09:29:45 pm »
Hi Jan,Guido,

Thanks for your help. Very important and useful information.

"forgotten the second byte for some of the values"==> I will use DT to re-check the descriptor

"Depending on the speed your device uses"==> Did you mean the diference of USB1.1 and 2.0. Or did you mean the
endpoint size?? I set the endpoint size to 0xFF.

"report may need to be broken down into multiple transfers"==> Did you mean the original 0x86 size data may become 2 transaction ??

Thank you all, I will use DT to re-design first.

Guido Koerber

  • Frequent Contributor
  • ****
  • Posts: 72
Re: HID Data Cannot exceed 128 bytes !!??
« Reply #5 on: August 11, 2010, 04:37:03 am »
The transfer size (endpoint size) depends on the speed your device uses, low speed allows 8 bytes max, full speed 64 bytes max for interrupt transfers.