Author Topic: multiple USB HID high speed devices  (Read 12484 times)

Dinesh

  • Member
  • ***
  • Posts: 13
multiple USB HID high speed devices
« on: February 12, 2013, 09:27:09 am »
Hi,
I am using a High speed USB HID device with 125us polling interval. When I use two devices in the same host both works fine. However, when I disconnect one of them (sometimes) the other one also gets a disconnect->connect->set configuration #1 events. Has anyone faced such problem?

If I pulg and un-plug a USB keyboard then my custom HID is not affected. I face the above stated problem only when two custom HID devices are used. My custom HID device uses Windows' default HID driver.

Details:
Hosts tested: Windows 7 and Windows Vista
Target uses gadgetfs/usb driver.

Thanks in advance!

Best regards,
Dineshkumar M.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: multiple USB HID high speed devices
« Reply #1 on: February 12, 2013, 10:02:34 am »
This should not happen of course. Trying with and without external hubs and using different hubs might provide a clue.

Dinesh

  • Member
  • ***
  • Posts: 13
Re: multiple USB HID high speed devices
« Reply #2 on: February 12, 2013, 10:24:06 am »
Thanks for your reply Jan.
Can Windows HID driver or device management software in windows issue a soft disconnect to all the devices of same VID and PID? This is because I dont receive a device arraival or removel notification during this disconnec and connect events. Also a file handle opened for the device is still valid after this disconnect and conenct. i.e. I am able to read or write to the device with the same file handle.


BR/Dinesh

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: multiple USB HID high speed devices
« Reply #3 on: February 12, 2013, 10:44:27 am »
A disconnect is a hardware event. However, the USB drivers can reset a port at any time. A hardware protocol analyzer can show if the port was reset. If the system has multiple host controllers (most do), attaching the devices to different host controllers could also help to isolate the problem.

Barry Twycross

  • Frequent Contributor
  • ****
  • Posts: 263
Re: multiple USB HID high speed devices
« Reply #4 on: February 12, 2013, 01:05:25 pm »
I've know broken hosts which a disconnect on one port could cause trouble on another port. What hardware are you running? Though I'm pretty sure the problems I'm remembering affected full speed, not high speed devices.

As Jan suggests, an analyser trace, or potentially a scope trace of the affected device might reveal clues as to what's going on.

Dinesh

  • Member
  • ***
  • Posts: 13
Re: multiple USB HID high speed devices
« Reply #5 on: February 13, 2013, 11:11:37 am »
Thanks for your replies Jan and Barry!
As a continuation in the debugging process I tried to vary the polling interval of the Interrupt end point from 125us to higher values like 250us, 500us and 1ms. By increasing thepolling interval I see that the occurance of disconnect event is reduced or not observed at all. Could it be related to Host controller's state when it is polling very fast (i.e. 125us) that makes host controller to reset (or disconnect and connect) all the USB ports?


Barry,
I used USB explorer to analyze and I observe events like get descriptor (device and configuration) for the device that is not removed. I also used other non HID High speed devices like USB mass storage disk and USB to ethernet device which where also able to sense disconnection, provided my custom HID (with 125us polling interval) is also connected.

BR/Dinesh.

Barry Twycross

  • Frequent Contributor
  • ****
  • Posts: 263
Re: multiple USB HID high speed devices
« Reply #6 on: February 15, 2013, 04:43:24 pm »
If your analyser trace reveals no clue as to why you were disconnected, my next move is usually an oscilloscope. It can be triggered from the rising edge of D+ as it goes to full speed idle after the disconnect. Then you can have a look at the preceding SOF, which should be 3ms before the trigger.

Disconnect detection is done at the EOP of the SOF. The EOP is elongated to 40 bits (from the normal 8 bits) for the SOF (and only the SOF) which makes it quite distinctive. During the last 8 bits of that the host will monitor the bus voltage. If the bus is at a differential voltage greater than 525mV, the device may be disconnected (and must be disconnected at greater than 625mV).

If you see such voltages then you need to work out what's causing it. I've seen hosts manage to tune their termination resistance too high, which cause an overvoltage. I've seen devices which have terminations just a bit too high resistance which eventually be seen as a disconnect. I've seen hosts which glitch at certain times (such as resume) which is seen as a disconnect if it overlaps a SOF. I've seen SOFs which were suddenly twice the voltage of the previous one, one end of the wire had removed their terminations. Working out which end that was required a current probe to show there was no current flowing into the device terminations.

If you don't see such a voltage, then the most likely answer is a problem inside the host.