usb MIDI hub with and without computer

lokki

Well-known member
hi there,

i made a USB-MIDI host to DIN Midi and usb-client MIDI device from a teensy 4.1 thanks to the great example "Interface_16x16"

it all works well, but i have one question. since i read MIDI mostly from one of the ports on an attached HUB and distribute it to other hosted devices,DIN Midi and also the usb-port that would normally connect to a Computer (client port), is it safe to run the teensy from external power without a computer attached that reads the MIDI data that is sent to the usb-client port? or will a buffer overflow, or the program crash at some point if the teensy runs standalone but still writes to the client port?

sorry i am not really clear about how usb communication works between a client and a computer host. i know that there is no harm in sending DIN MIDI out, since it is just a serial line writing data with no error checks or handshaking.
 
Hey!

From my experience, that is totally fine.
I have build an "smart" MIDI Hub myself, that allows me to configure the routing between all connected device on the device itself, so I dont need a Computer like on the Blokas Midihub.
I used it for hours without it seeing a computer once.
USB devices talk to the host to handshake and introduce each other, so they know how fast and what "language" they should talk. If there is no computer on the other side of the USB cable, the Teensy USB stack will not be able to talk to a host and should know that there is nothing.

MidiHub.jpg
(The display is now white. blue was a bit bright, and now it matches with the screen of the Syntakt :p)

Jens
 
nice project! and good to know i should be fine writing to the usb-client port with nothing connected.

i ran into this funny issue where all my midi devices connected to the host port of the teensy are only seen the second time i plug the teensy in. this has happened on a teensy 3.6 and happens now also on the teensy 4.1 i am using. it is a very strange bug and seems to suggest the teensy retains some information even if the power has been cut. probably my timings in setup() are not right, and i will experiment with a couple of more delays...
 
I am able to disable ports in the configuration, because every cycle I process and send data to unnecessary ports, is time wasted on things I want to be processed. Thats (and because of some strange issue with Elektron) I added that "feature" in the USB Host Midi thread, where I now know how many virtual cables are support by a given device.

I don't think, that teensy stores data between power cycles. As far as I know, that is now really a memory for that. It is noted on the shop page, that even the power-state of the ON/OFF button is only persistent between power cycles if a battery is connected to VBat. If there is no space for a single bit, I would assume, there is non for more :p

I indeed was not very successful with supporting more than one Device at a time at the Host-Port. I don't know it it was a power issue, or if the hub sucked, or if it is in the Code, but as I don't really need more than one, I just reduce myself to one.
And since I moved to the BigBuffer-Client, I didn't had any issues with Usb Host neither on that Hub, nor on that Sequencer I am working on.
 
i have 7 devices on a HUB and it generally works REALLY well with the usb host library. i used one of these hubs: https://www.uugear.com/product/7-port-usb-hub-for-raspberry-pi/ which has a separate power in and a jumper to select if power should be sent to the host controller as well (teensy in my case). also it has the correct chips for lowest latency (something with the correct MTT, you can find it on the forum here as well), additionally i send MIDI to the usb-client out and to four DIN-MIDI outputs. since my setup is static i do all the configuration/usb device recognition in setup() and did not bother to add a display and switches or encoders. my further plan is to add a INTUOS drawing tablet to one of the usb ports, since that makes for a nice midi controller as well. (basically a giant x/y pad with pressure and tilt support)
 
Wow, this is EXACTLY what I’d like to do…host USB only devices, then spit the MIDI out to DIN or TRS-A or B ports. Any tips on getting started? I can even live with something pretty simple…as long as it hosts the device and passes on its signals. Dying to make a battery powered device that does this.
 
Hey!

There is not much to show, Reading and Writing on the 3 Types of MIDI (Usb Device, Serial and Host) is exactly done as in the Examples. How you route it other than: Read and send to all others is totally up to how you need it.

The basic MIDI Work is only a few lines of code, thanks to those awesome libraries.
 
Back
Top