Page 1 of 1

HID Faster Transfer Rate

Posted: Fri Mar 08, 2013 12:32 am
by 12oclocker
I read something here about using SET_REPORT to increase transfer speed,
http://stackoverflow.com/questions/8773703/faster-usb-hid-output
but I don't understand how they are achieving that...

I read somewhere low speed USB was limited to 8bytes for interrupt transfers, at a per 10ms polling interval, that is pretty slow,
I'd like to send chunks of 32 or 64 bytes to the AVR over HID, and have the AVR respond with 8 bytes.
Using HID without drivers is important to me, so I definitely want to stick with HID methods.
but how would I modify my headers to gain the increase this person was talking about?

Currently I am using these headers....

Code: Select all

PROGMEM const char usbDescriptorHidReport[34] = 
{   
   //[Endpoint 0]
   0x06, 0xa0, 0xff, // USAGE_PAGE (Vendor Defined Page 1)
   0x09, 0x01,       // USAGE (Vendor Usage 1)
   0xa1, 0x01,       // COLLECTION (Application)

   //[Endpoint 1] Interrupt-In (used to send data to the host spontaneously)
   // Input Report (Host PC sends us data)
   0x09, 0x02,       // Usage ID - vendor defined usage2
   0x15, 0x00,       // Logical Minimum (0)
   0x26, 0xFF, 0x00, // Logical Maximum (255)
   0x75, 0x08,       // Report Size (8 bits)
   0x95, 0x08,       // Report Count (8 fields)
   0x81, 0x02,       // Input (Data, Variable, Absolute)

   //[Endpoint 2] Interrupt-Out (PC is sending US data)
   // Output Report (We send data to PC)
   0x09, 0x03,       // Usage ID - vendor defined usage3
   0x15, 0x00,       // Logical Minimum (0)
   0x26, 0xFF, 0x00, // Logical Maximum (255)
   0x75, 0x08,       // Report Size (8 bits)
   0x95, 0x08,         // Report Count (8 fields) //change to 32?
   0x91, 0x02,       // Output (Data, Variable, Absolute)

   0xc0              // END_COLLECTION
};

//to do this you must set USB_CFG_DESCR_PROPS_CONFIGURATION in usbconfig.h
#define W(x) (x)&0xFF,(x)>>8
#define USB_CFG_RESERVED          0x80
#define USB_CFG_SELFPOWERED       0x40 //remove this for BusPowered devices
PROGMEM const char usbDescriptorConfiguration[41] =
{
//Config
   9,      //bLength
   2,      //bDescriptorType   2=CONFIG
   W(41),   //wTotalLength   
   1,      //bNumInterfaces   
   1,      //bConfigurationValue
   0,      //ConfigurationStrIndex
   (USB_CFG_RESERVED | USB_CFG_SELFPOWERED), //ConfigAttributes
   100/2,   //MaxPower (in 2 Milliampere)   100 mA
//HID_Interface
   9,      //bLength
   4,      //bDescriptorType   4=INTERFACE
   0,      //bInterfaceNumber
   0,      //bAlternateSetting
   2,      //bTotalEndpoints
   0x03,   //bInterfaceClass      HID_CSCP_HIDClass
   0x00,   //bInterfaceSubClass   HID_CSCP_NonBootSubclass
   0x00,   //bInterfaceProtocol   HID_CSCP_NonBootProtocol
   0,      //InterfaceStrIndex      0=NONE
//HID_GenericHID
   9,      //bLength
   0x21,   //bDescriptorType HID
   1,1,   //BCD representation of HID version
   0,      //target country code
   1,      //number of HID Report Descriptor infos to follow
   0x22,   //descriptor type: report
   W(34),   //total length of report descriptor
//HID_ReportIN_Endpoint
   7,      //Length
   0x05,   //bDescriptorType ENDPOINT
   0x81,   //bEndpointAddress   ENDPOINT_DIR_IN=0x80+1
   0x03,   //bmAttributes      INTERRUPT   //0x03|(0<<2)|(0<<4)
   W(8),   //wMaxPacketSize
   10,      //Polling Interval in ms (cannot be less than 10)
//HID_ReportOUT_Endpoint
   7,      //Length
   0x05,   //bDescriptorType ENDPOINT
   0x02,   //bEndpointAddress   ENDPOINT_DIR_IN=0x00+2
   0x03,   //bmAttributes      INTERRUPT   //0x03|(0<<2)|(0<<4)
   W(8),   //wMaxPacketSize
   10,      //Polling Interval in ms (cannot be less than 10)
};

Re: HID Faster Transfer Rate

Posted: Tue Jun 25, 2013 3:43 pm
by ulao
I'm after the same thing
viewtopic.php?f=8&t=8493

From the SO page I think he is claiming that he stole more bandwidth from one of the pipes. I will look in to that but I dont think its possible with v-usb.

I think his reference to set_report is just setting the report type like so:
7, /* sizeof(usbDescrEndpoint) */
USBDESCR_ENDPOINT, /* descriptor type = endpoint */
//0x81, /* IN endpoint number 1 */
0x81, // bulk IN endpoint number 1
0x03, /* attrib: Interrupt endpoint */
8, 0, /* maximum packet size */
0x08, /* in ms */
I dont think v-usb has a special function above that. Maybe its possible to take from the default report and give to the second or take from an output and give to an input I'm just not cretin on that. I'm not sure how one would edit the default report to be honest?

Re: HID Faster Transfer Rate

Posted: Mon Jul 22, 2013 9:46 am
by horo
Hi,

Some time ago I checked the USB polling rate depending on device descriptor parameters (for MIDI device): http://forums.obdev.at/viewtopic.php?f=8&t=1352&start=15#p9104

Ciao, Martin