hathach / tinyusb

An open source cross-platform USB stack for embedded system
https://www.tinyusb.org
MIT License
4.98k stars 1.05k forks source link

Data Seq Error when connecting HID device through USB hub #1997

Open Xanvarok opened 1 year ago

Xanvarok commented 1 year ago

Operating System

Linux

Board

Raspberry Pi Pico

Firmware

/examples/host/cdc_msc_hid

What happened ?

When connecting a USB keyboard (or mouse) to the Pico via a USB hub, the process fails when trying to setup the keyboard (or mouse) throwing a Data Seq Error.

How to reproduce ?

  1. Apply power to Pico
  2. Connect USB hub to Pico
  3. Connect a USB keyboard (or mouse) to the USB hub Or
  4. Connect USB hub to Pico
  5. Connect a USB keyboard (or mouse) to the USB hub
  6. Apply power to Pico

Debug Log as txt file

TinyUSB_Data_Seq_Error.txt

Screenshots

No response

I have checked existing issues, dicussion and documentation

hathach commented 1 year ago

do you have other USB hub to test with, just to make sure it is not as generic issue ? I tested previously fine with my hub.

Xanvarok commented 1 year ago

Unfortunately I do not currently.

The hub does work with both a raspberry pi 4 and with my desktop; however, it does look to be based around a HS8836 which other folks online seem to have issues with in other situations.

I'll see if I can get my hands on another hub to test with.

hathach commented 1 year ago

when you are able to test with other hub and can narrow the issue to the specific chipset, please detail your hub make and model as well as link, picture etc.. If it is the case, I will try to see if I could find it locally here for testing.

Xanvarok commented 1 year ago

So I managed to get my hands on a Sabrent HB-MCRM and everything seems to be working fine with that (log of working one here).

The Sabrent one isn't mine (so I didn't tear it apart) but it seems to claim it's using a Genesys Logic controller... probably a GL850G.

The one that doesn't work is a no-name brand... looks like the controller is actually a Huasheng Electronics HS8836A which seems to be found in a variety of cheap Chinese no-name USB hubs. There are no identifying marks on the case and the PCB is very basic... only silk-screened with "HS8836A-2022-12-02". I'll see if I can track down where it came from if you're interested.

hathach commented 1 year ago

there is a on-going PR that fixes an issue with hub, would you mind trying it out https://github.com/hathach/tinyusb/pull/2016

Xanvarok commented 1 year ago

So I've tried that PR and had the following behavior.

With LOG=3 I'm seeing usbh_edpt_xfer_with_callback 781: ASSERT FAILED rather than the Data Seq Error.

With LOG=2 or lower I'm still getting a Data Seq Error.

morio commented 1 year ago

After #2016 merged, I'm getting Data Seq Error when LOG=3 which is the same error when LOG=0. So at least it is consistent. Here are the logs when I power up with the hub already plugged in: usb-hub-setup.txt

and then after I plug in the B100 Logitech mouse into the hub: (ignore ALL: Resetting devices lines, as that is part of my code)

usb-hub-connect-mouse.txt

If I plug a known working hub into the Data Seq error hub and plug the mouse into the working hub, the mouse works fine. (RP2040->(Data Seq error hub)->(Known working hub)->(B100 Mouse) - works (RP2040->(Data Seq error hub)->(B100 Mouse) - errors

@Xanvarok do you see the same issue as me with the latest tinyusb main line branch?