Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 8 of 8

Thread: Daisy chain USB hub

  1. #1
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467

    Daisy chain USB hub

    I'm planning on building a USB midi merger/router with the Teensy 3.6 and was planning on using this hub : https://www.adafruit.com/product/3298 as I could easily embed it in an enclosure with the Teensy. I was wondering if I could then plug an external hub to the first one if I wanted to add more ports? Is this transparent to the host library ?

  2. #2
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467
    Polite bump !

  3. #3
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,693
    Have you got two 'normal' hubs to chain and work as deired? I expect it does. If so - saying anything about a Pi Zero W with that unique Adafruit Hub connecting to another hub would probably best be answered by trying it

  4. #4
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467
    Thanks for your answer, just ordered the Zero4U so will test soon. The Zero4U is just a normal hub with a Pi footprint so if 2 regular hubs can be Daisy chained I assume it'll work...

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,559
    USBHost_t36 definitely supports hubs.

    It is very close to "transparent", but you do need to place a USBHub object in your code for each hub chip you want the library to be able to support. From the photo, that Adafruit product has 1 hub chip. Many 7 or 10 port hubs are actually 2 or 3 chips inside. For example, most a 10 port hub is typically three 4 port hubs, where 2 of them are permanently connected to 2 of the first 4-port hub's ports. So if you don't know what type of hub a user will plug in, best to put 3 or 4 extra USBHub instances in your code, in case they use a hub with several chips inside. Most of the library's examples of 2 or 3 instances, so just copy those lines & edit the instance names.

    Assuming you have enough hub instance, the library manages hubs & devices connecting and disconnecting from them automatically.

    If you do find any hub that doesn't work with the library, please start a thread to report it. This Adafruit one is easy. If it's a no-name hub, try to figure out where you bought it. Fixing USB host issues is pretty much impossible when we can't buy the problematic device.

    On hubs, I can tell you the 5 I have here work perfectly. Many people have used other hubs too, so no bugs are currently known about any hubs.

    FWIW, almost 1 year ago we did have a report of a specific USB 2-port hub that didn't work. It was a bug in the library, which was fixed last summer. It turned out the bug wasn't actually in the hub driver, but a rather subtle bug in configuring virtual USB pipes deep within the library. I wrote a detailed blog article about the bug hunt.

    https://www.pjrc.com/usb-hub-bug-hun...ssons-learned/

    Something the library does not do, is check the USB power descriptors. If you plug a power hungry device into an unpowered hub, or if you try to chain unpowered hubs, the library will not notice and will try to use them anyway. The USB spec says hosts are support to read the mA spec from each device and know whether a hub is powered (like a wall wart) or unpowered (getting its power only over a USB cable) and detect when you try use too much power, and refuse to enumerate the new device. USBHost_t36 does not do any of this checking. It will try to make use of whatever you plug in.

    For best compatibility, you'll want to make sure you give that Adafruit hub power on its JST connector.

  6. #6
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467
    Thanks for the very detailed response Paul ! I'll report my findings for sure. The idea of using the Zero4U was indeed to power it via it's JST connector, easier to integrate in a casing (and cheaper!) than taking apart an existing hub. I like the idea of having a few ports built-in + the possibility to extend further with an external hub.
    Eager to test this all out !

  7. #7
    Junior Member
    Join Date
    Jul 2019
    Posts
    3
    Hey did you gegt any further on this MIDI merger project? I am currently inquiring if its feasible to connect a teensy, a midibox and an axoloti board via midi-over-USB instead of DIN midi. and i just found out teensy supports USB hubs, so i want to try send midi from the midibox via usb to a usb hub hosted by the teensy, and then send midi (through) via the same hub to the axoloti usb.

  8. #8
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467
    Hi! I did not have time to try it myself but my co-worker did and it works great!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •