We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I'm using interrupt transfers and HID class to transfer data from MCU to PC. For the MCU side I'm modifying the sample hid transfer project in atmel's softpack with Keil uvision and for the PC side I'm using WinDDK.
Essentially I want to increase the transfer speed because the current speed is very slow (< 1 MB/s). I'd like to get the speed up to ~8 MB/s which would require a 1024 B transaction polled every 125 us. I've modified the report and endpoint descriptors which has increased the speed but is still < 1 MB/s. I can't seem to increase the report size further and the driver doesn't appear to be polling at the correct rate.
Below are the report and endpoint descriptors.
Definitions:
/// Interrupt IN endpoint number. #define HIDDTransferDriverDescriptors_INTERRUPTIN 5 /// Polling rate in ms #define HIDDTransferDriverDescriptors_INTERRUPTIN_POLLING 0.125 /// Interrupt IN endpoint polling rate (in milliseconds). #define HIDDTransferDriverDescriptors_INTERRUPTOUT 6 /// Polling rate in ms #define HIDDTransferDriverDescriptors_INTERRUPTOUT_POLLING 0.125 /// Size of the report descriptor in bytes. #define HIDDTransferDriverDescriptors_REPORTSIZE 32 /// Size of the input and output report, in bytes #define HIDDTransferDriver_REPORTSIZE 255
Endpoint Descriptors:
// Interrupt IN endpoint descriptor { sizeof(USBEndpointDescriptor), USBGenericDescriptor_ENDPOINT, USBEndpointDescriptor_ADDRESS( USBEndpointDescriptor_IN, HIDDTransferDriverDescriptors_INTERRUPTIN), USBEndpointDescriptor_INTERRUPT, /*MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE( HIDDTransferDriverDescriptors_INTERRUPTIN), MIN(USBEndpointDescriptor_MAXINTERRUPTSIZE_HS, HIDDTransferDriver_REPORTSIZE)),*/ BOARD_USB_ENDPOINTS_MAXPACKETSIZE(HIDDTransferDriverDescriptors_INTERRUPTIN), HIDDTransferDriverDescriptors_INTERRUPTIN_POLLING }, // Interrupt OUT endpoint descriptor { sizeof(USBEndpointDescriptor), USBGenericDescriptor_ENDPOINT, USBEndpointDescriptor_ADDRESS( USBEndpointDescriptor_OUT, HIDDTransferDriverDescriptors_INTERRUPTIN), USBEndpointDescriptor_INTERRUPT, /*MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE( HIDDTransferDriverDescriptors_INTERRUPTOUT), MIN(USBEndpointDescriptor_MAXINTERRUPTSIZE_HS, HIDDTransferDriver_REPORTSIZE)),*/ BOARD_USB_ENDPOINTS_MAXPACKETSIZE(HIDDTransferDriverDescriptors_INTERRUPTOUT), HIDDTransferDriverDescriptors_INTERRUPTIN_POLLING }
Report Descriptor:
/// Report descriptor used by the driver. const unsigned char hiddReportDescriptor[] = { // Global Usage Page HIDReport_GLOBAL_USAGEPAGE + 2, 0xFF, 0xFF, // Vendor-defined // Collection: Application HIDReport_LOCAL_USAGE + 1, 0xFF, // Vendor-defined HIDReport_COLLECTION + 1, HIDReport_COLLECTION_APPLICATION, // Input report: Vendor-defined HIDReport_LOCAL_USAGE + 1, 0xFF, // Vendor-defined usage HIDReport_GLOBAL_REPORTCOUNT + 1, HIDDTransferDriver_REPORTSIZE, HIDReport_GLOBAL_REPORTSIZE + 1, 8, HIDReport_GLOBAL_LOGICALMINIMUM + 1, (unsigned char) -128, HIDReport_GLOBAL_LOGICALMAXIMUM + 1, (unsigned char) 127, HIDReport_INPUT + 1, 0, // No Modifiers // Output report: vendor-defined HIDReport_LOCAL_USAGE + 1, 0xFF, // Vendor-defined usage HIDReport_GLOBAL_REPORTCOUNT + 1, HIDDTransferDriver_REPORTSIZE, HIDReport_GLOBAL_REPORTSIZE + 1, 8, HIDReport_GLOBAL_LOGICALMINIMUM + 1, (unsigned char) -128, HIDReport_GLOBAL_LOGICALMAXIMUM + 1, (unsigned char) 127, HIDReport_OUTPUT + 1, 0, // No Modifiers HIDReport_ENDCOLLECTION };
Any help getting this to work would be appreciated.
Where did you get the idea that polling could be a fractional value?
If you need high bandwidth, you should consider looking at bulk transfers.
I found the definitions a little ambiguous as the comment says the polling rate is in ms though I've read in another source that the interval for highspeed is calculated differently (2^(bInterval-1)). So I should set bInterval = 1?
I decided not to do bulk transfers because I don't need to transfer data faster than 20 MB/s and I tried working with atmel's MSD project but was unable to compile it.
I believe the reason why I can't further augment the report size is because the report descriptor is defined as an unsigned char array. But if I change it to an unsigned int array then enumeration fails. Any ideas?
I did a quick google search, and found such a sentence.
www.kadtronix.com/usbhidapi_usr.htm The maximum defined transfer rate for the HID class is 64K bytes/sec. For more information, please refer to the following resource:
www.usb.org/.../hidpage
"The maximum defined transfer rate for the HID class is 64K bytes/sec."
According to USB Complete by Jan Axelson that transfer rate is the max for full-speed devices. The max rate for high-speed devices using HID class is 24.576 MB/s.