Help with Lufa usb 2.0 spec.

31 views
Skip to first unread message

ulao

unread,
Dec 16, 2018, 12:09:19 AM12/16/18
to LUFA Library Support List

I'm coming from v-usb to LUFA so there are areas I will fall short in. For the most I'm able to use the documentation and get what I need done. I was able to create a 1.1 usb spec device and it works great. From what I can tell and perhaps I'm just wrong but the atmega32u2 chip should handle the following;

USB 1.1 full speed, high speed

USB 2.0  full speed, high speed

From what I know and this could be wrong but the main advantage with 2.0, is that it will handle a larger payload. I'm not particularly interested in that at the moment but I need to be 2.0 complaint for my particular requirement.  I was able to change the USB config to reflect 2.0 but I'm still getting 8 ms per interrupt poll. I'm not really sure the best way to know of I'm now a 2.0 device to the host? Is there a way to know checking in device manager? Also I'm not sure how I change the poll rate. Is it the PollingIntervalMS?


This is  what I have now.

.HID_JoystickHID = { .Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID}, .HIDSpec = VERSION_BCD(2.0), .CountryCode = 0x00, .TotalReportDescriptors = 1, .HIDReportType = HID_DTYPE_Report, .HIDReportLength = sizeof(JoystickReport) }, .HID_ReportOUTEndpoint = { .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, .EndpointAddress = JOYSTICK_OUT_EPADDR, .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), .EndpointSize = JOYSTICK_EPSIZE, .PollingIntervalMS = 0x05 }, .HID_ReportINEndpoint = { .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, .EndpointAddress = JOYSTICK_EPADDR, .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), .EndpointSize = JOYSTICK_EPSIZE, .PollingIntervalMS = 0x05 }

I need a poll rate of 5ms. Though I see 8 in my usb analyzer.

Dean Camera

unread,
Dec 22, 2018, 10:26:11 PM12/22/18
to lufa-s...@googlegroups.com, ulao

None of the 8-bit AVR devices support USB 2.0 High Speed mode unfortunately - they're all limited to the "Low" (1.5MBit/s) and "Full" (12Mbit/s) speed USB transfer rates, which are quite slow. This, along with I2C clock rates, is a great poster-child for not using subjective names for transfer rates in specifications, as it leads to the madness of increasingly meaningless low/full/high/super/etc. prefixes as newer, faster versions are specified.

Identifying as a USB 2.0 device is a simple as setting the right value of 0x200 for the "bcdUSB" field in the Device descriptor of your device. The 2.0 vs 1.1 difference doesn't mean too much in terms of the low and full speed grades, so most devices will just use 1.1 for the broadest compatibility support.

For Full Speed devices, the polling interval is specified in numbers of 1ms USB frames. The host may cache these values, so I'd suggest modifying the bcdDevice field of the Device descriptor to force it to re-fetch and parse the Configuration descriptor as you make changes. The bcdDevice field has no special meaning, so just increment it with each test to bypass Windows' descriptor cache.

Note that the endpoint polling interval set in the Endpoint descriptor is informational for the host, and it might have a lower bound on how short the polling interval can be. It's driven by the host in the end, so the host can choose to ignore your requested polling interval, or just use whatever interval it decides is most appropriate.


Cheers!

- Dean

--
You received this message because you are subscribed to the Google Groups "LUFA Library Support List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lufa-support...@googlegroups.com.
To post to this group, send email to lufa-s...@googlegroups.com.
Visit this group at https://groups.google.com/group/lufa-support.
For more options, visit https://groups.google.com/d/optout.

ulao

unread,
Dec 25, 2018, 4:24:11 PM12/25/18
to LUFA Library Support List
Thank for the clarification. Do you happen to know what the lowest  windows usb host poll rate is for HID devices for full-speed 1.1? If I request 1ms will it negotiate to the lowest possible or just deny it?

Dean Camera

unread,
Jan 2, 2019, 5:26:20 AM1/2/19
to lufa-s...@googlegroups.com, ulao

I'm not sure - and it's probably something that's changed over the years with different versions of Windows, and might vary depending on the USB controller on the host. The host should try to honor it as best it can, so setting a 1ms poll period should result in the host polling it as quick as it can.

- Dean

--
Reply all
Reply to author
Forward
0 new messages