I have developed a MIDI foot controller that uses a Teensy 3.6 and has midi connections via USB host, USB regular and via serial midi (2x). I noticed that sending MIDI messages out from my foot controller that the USB Host port midi is lagging. When I connect the same device via the other midi ports, there is no lagging.
The lagging is a problem when i operate an expression pedal. The device I control is responding laggy, making the use of expression pedals useless, when connecting through the USB host port. Other ports work fine. But using other ports means bringing extra gear (external computer) which I do not want to do.
Here is how the host library is called:
In loop I have included:
And sending the actual midi messages:
Looking at the source code of the USBHost_t36 library, whenever a midi message is sent, it is queued. Adding extra myUSB.Task() commands does not seem to help. is there anything I can do to speed up USB? I tried removing a number of instances of USBHub and MIDIDevice_BigBuffer, but that does not seem to make any difference in processing speed.
The lagging is a problem when i operate an expression pedal. The device I control is responding laggy, making the use of expression pedals useless, when connecting through the USB host port. Other ports work fine. But using other ports means bringing extra gear (external computer) which I do not want to do.
Here is how the host library is called:
Code:
#include <USBHost_t36.h>
USBHost myusb;
USBHub hub1(myusb);
USBHub hub2(myusb);
USBHub hub3(myusb);
USBHub hub4(myusb);
#define NUMBER_OF_USB_HOST_MIDI_PORTS 8
MIDIDevice_BigBuffer usbhMIDI01(myusb); // With bigbuffer, newer Roland devices are working properly!
MIDIDevice_BigBuffer usbhMIDI02(myusb);
MIDIDevice_BigBuffer usbhMIDI03(myusb);
MIDIDevice_BigBuffer usbhMIDI04(myusb);
MIDIDevice_BigBuffer usbhMIDI05(myusb);
MIDIDevice_BigBuffer usbhMIDI06(myusb);
MIDIDevice_BigBuffer usbhMIDI07(myusb);
MIDIDevice_BigBuffer usbhMIDI08(myusb);
MIDIDevice_BigBuffer * usbhMIDI[NUMBER_OF_USB_HOST_MIDI_PORTS] = {
&usbhMIDI01, &usbhMIDI02, &usbhMIDI03, &usbhMIDI04, &usbhMIDI05, &usbhMIDI06, &usbhMIDI07, &usbhMIDI08
};
In loop I have included:
Code:
myusb.Task();
for (uint8_t p = 0; p < NUMBER_OF_USB_HOST_MIDI_PORTS; p++) {
VCbridge_in_port[USBHMIDI_PORT >> 4] = p + 1;
usbhMIDI[p]->read();
}
And sending the actual midi messages:
Code:
usbhMIDI[Port]->sendSysEx(sxlength, sxdata, true, cable); // hasterm = true, which means no extra 0xF0 and 0xF7 bytes will be added
Looking at the source code of the USBHost_t36 library, whenever a midi message is sent, it is queued. Adding extra myUSB.Task() commands does not seem to help. is there anything I can do to speed up USB? I tried removing a number of instances of USBHub and MIDIDevice_BigBuffer, but that does not seem to make any difference in processing speed.