T4.1 USB host - with hub circuit questions

snowsh

Well-known member
Hi, I have ordered some of these:
https://www.ebay.co.uk/itm/314071014765

and some of these:
https://www.ebay.co.uk/itm/183726060573

how would I go about setting up the code for the t4.1 to offer 4 usb midi host ports? I certainly dont need multiple midi "cables" for each of these, just a single midi line with 16 channels per usb port.

I want to be able to plug a midi keyboard and multiple synths into my device for 2 way midi comms over usb. Note I am using the midi client line to run 4 midi cables. might be 16 in the future.

so far i am using this code for one port on the usb host:


Code:
#include <MIDI.h>
#include <USBHost_t36.h>

//USB HOST MIDI Class Compliant
USBHost myusb;
USBHub hub1(myusb);
USBHub hub2(myusb);
MIDIDevice midi1(myusb);

ideas?
 
That little circuit board looks like a 4 port USB hub.

I would recommend first testing your code with a regular consumer USB hub plugged into Teensy 4.1's USB host port using the regular USB host cable, and the 4 MIDI devices plugged into that hub. Get the software all working properly with known-good hardware.

Trying to diagnose untested software while also running on top of untested DIY hardware is a recipe for serious frustration!

Software-wise, you should need just 1 instance of USBHub, and then 4 instances of MIDIDevice or MIDIDevice_BigBuffer if you want to support 480 Mbit/sec MIDI devices. Of course, in loop() you'll need whatever MIDI messages processing you want.
 
That little circuit board looks like a 4 port USB hub.

I would recommend first testing your code with a regular consumer USB hub plugged into Teensy 4.1's USB host port using the regular USB host cable, and the 4 MIDI devices plugged into that hub. Get the software all working properly with known-good hardware.

Trying to diagnose untested software while also running on top of untested DIY hardware is a recipe for serious frustration!

Software-wise, you should need just 1 instance of USBHub, and then 4 instances of MIDIDevice or MIDIDevice_BigBuffer if you want to support 480 Mbit/sec MIDI devices. Of course, in loop() you'll need whatever MIDI messages processing you want.

hi Paul, thanks for the answer..
Yes, I intend to test all this first on a hub I have here, just wondering really how this would work software side as I cant find any examples.....
so somthing like this would work: ?

Code:
#include <MIDI.h>
#include <USBHost_t36.h>

//USB HOST MIDI Class Compliant
USBHost myusb;
USBHub hub1(myusb);
//USBHub hub2(myusb);
MIDIDevice midi1(myusb);
MIDIDevice midi2(myusb);
MIDIDevice midi3(myusb);
MIDIDevice midi4(myusb);

how would I know which "port" (socket) corrsponds to which object?
 
Back
Top