Daisy chain USB hub

Status
Not open for further replies.

nlecaude

Well-known member
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 ?
 
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
 
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...
 
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-hunting-lessons-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.
 
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 !
 
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.
 
Hi! I saw that you solved the problem already, and i saw that you really knows your stuff. So i decided to ask you something. I have FITFORT 7 in 1 with different ports and can get two Anker 4 in 1 with just usb ports (I have found them here and I though that it will be good value for money). Can i connect two usb hubs to another (two Anker to FITFORT)? Will it work?
 
Hi! I saw that you solved the problem already, and i saw that you really knows your stuff. So i decided to ask you something. I have FITFORT 7 in 1 with different ports and can get two Anker 4 in 1 with just usb ports (I have found them here and I though that it will be good value for money). Can i connect two usb hubs to another (two Anker to FITFORT)? Will it work?

Look at posting #5 - For each USB hub you need one (or more) USBHub objects. Again your 7 in 1 is almost for sure at least two logical hubs internally so would require at least 2... Sometimes HUB counts can also get confusing depending on what other objects you plug in. Example I have one or more USB Keyboards which have built in USB Hubs, You need a USBHub object for those keyboards or they system will not see that keyboard.
 
Status
Not open for further replies.
Back
Top