Hello all, on my MCB2140 i have installed USb HID example, i try to understand some basic things how it's work.
1) In the current example i set bInterval=0x0A; //10ms, everything else is unchanged. On my sniffer on host side, i read the speed of 127 B/s. So if my bInterval of sending 1 report is 10ms, should i expect the speed to be equal 100*10ms*1B= 100 B/s?
2) Is it poisable to modify this example to support a isochronous transfer or isochronous is only reserved for audio..
> 1) In the current example i set bInterval=0x0A; //10ms
In this case, 10 ms bInterval is interpreted to 8 ms by Windows. USB spec allows that host takes less value for the actual interval, than bInterval value on an interrupt endpoint. Usually, 1, 2, 4, 8, 16 or 32 ms is chosen, so that actual value is the closest and not-greater than bInterval. This rule comes from restriction of OHCI host controller.
> 2) Is it poisable to modify this example to support a isochronous transfer or isochronous is only reserved for audio..
HID class doesn't accept isoc endpoint. You have to select another USB class / PC driver. These generic drivers support isoc transfer.
- MS WDK usbsamp example (free) C:\WINDDK\7600.16385.1\src\usb\usbsamp\ MS WDK (Windows Driver Kit) v7.1.0 download (619.8 MB) " href= "sourceforge.net/.../wiki">sourceforge.net/.../wiki
- Thesycon USBIO (commercial) www.thesycon.de/.../usbio.shtml
- Jungo WinDriver (commercial) www.jungo.com/.../windriver_usb_pci_driver_development_software.html
etc. If you need more transfer speed, usually bulk transfer is better than isoc. I've written on this issue in this topic, recently.
USB Isochronous Transfer knowledgebase.nxp.com/showthread.php
Tsuneo
Thanks Tsuneo for clarifying me this, i just confirm that with a sniffer on host side.
If you need more transfer speed, usually bulk transfer is better than isoc.
To implement bulk transfer i understand that i need to change in ConfigurationDescriptor(usbdesc.h) the statment USB_ENDPOINT_TYPE_INTERRUPT to USB_ENDPOINT_TYPE_BULK ? About sending data is there anything else to change if i want to use bulk?
As discussed on above LPCXpresso topic, CDC is handy for bulk transfer.
Mr Tsuneo in file hiduser.c i found this function:
BOOL HID_GetIdle (void) { EP0Buf[0] = HID_IdleTime[SetupPacket.wValue.WB.L]; return (__TRUE); }
1) Is this SetupPacket.wValue.WB.L represent the lowest byte of my packet ? 2) What is the purpose of this function ? 3) I i want to increse my input report (InReport[64]), should i modify then this function for example:
EP0Buf[1] = HID_IdleTime[SetupPacket.wValue.WB.L]; ... EP0Buf[63] = HID_IdleTime[SetupPacket.wValue.WB.L];
> 1) Is this SetupPacket.wValue.WB.L represent the lowest byte of my packet ?
Yes. For Get_Idle request, host passes target report ID to this parameter.
2) What is the purpose of this function ?
Refer to "7.2.3 Get_Idle Request" of the HID spec www.usb.org/.../HID1_11.pdf
Host asks the current value of report interval, set by Set_Idle request or the default.
3) I i want to increse my input report (InReport[64]), should i modify then this function
No. The reasons are twofold, 1) The report interval is set by host using Set_Idle request. Device should follow this order.
2) Windows put Set_Idle( 0 ), indefinite interval, just after enumeration. It means, the device can return input report anytime as it likes. Therefore, the report interval is determined just by bInterval value of the endpoint descriptor.
Thanks Tsuneo, things are much clear now.