Again: USB MIDI compatiblity with iConnectivity Devices

bolau

Active member
Hi all,

following up on this thread (https://forum.pjrc.com/threads/57569-Does-Serial-Midi-≠-Class-Compliant), I did some more investigations to get clear on what the connectivity problem is.

I really like the MIO-XL for its plethora of USB host ports. I want to use it as centerpiece of my MIDI rig, involving a Yamaha MODX, Nord Stage2, Access Virus, and a Teensy 3.6.

Unfortunately, the MIO-XL does not recognize the Teensy in its MIDIx4 or MIDIx16 modes, where it provides 4 or 16 virtual ports. Only the single-port MIDI mode works. I have been in contact with the iConnectivity support to investigate the issue. First we suspected thought that the issue might be related to the Teensy being a hybrid USB device, providing MIDI and serial-port protocols, the latter for programming issues.

So I disabled the serial port device, turning the Teensy into a pure MIDI device. Still - the 4 port mode does not work, only if I bring the number of MIDI ports down to two. I know that the MIO-XL supports USB devices with more ports in general. So what could be the problem here? Here are the changes that make the Teensy work on the MIO-XL, but only with 2 ports:

In cores/teensy3/usb_desc.h:
Code:
  #define NUM_INTERFACE		1 // <–– this was 2
  // #define SEREMU_INTERFACE      1	// Serial emulation
  // #define SEREMU_TX_ENDPOINT    1
  // #define SEREMU_TX_SIZE        64
  // #define SEREMU_TX_INTERVAL    1
  // #define SEREMU_RX_ENDPOINT    2
  // #define SEREMU_RX_SIZE        32
  // #define SEREMU_RX_INTERVAL    2
  #define MIDI_INTERFACE        0	// MIDI
  #define MIDI_NUM_CABLES       2 // <–– this was 4
  #define MIDI_TX_ENDPOINT      1 // <–– this was 3
  #define MIDI_TX_SIZE          64
  #define MIDI_RX_ENDPOINT      2 // <–– this was 4
  #define MIDI_RX_SIZE          64


In cores/teensy3/yield.cpp:
Code:
if (running) return; // TODO: does this need to be atomic?
running = 1;
//if (Serial.available()) serialEvent();  // <–– commented out to silence a compile error
if (Serial1.available()) serialEvent1();
if (Serial2.available()) serialEvent2();


This is the USB descriptor in 4-port mode, stripped from the serial programming interface. The MIO-XL does not recognize this device:
Code:
Bus 001 Device 005: ID 16c0:0485 Van Ooijen Technische Informatica Teensyduino MIDI
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x16c0 Van Ooijen Technische Informatica
  idProduct          0x0485 Teensyduino MIDI
  bcdDevice            2.11
  iManufacturer           1 
  iProduct                2 
  iSerial                 3 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          179
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         1 Audio
      bInterfaceSubClass      3 MIDI Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      MIDIStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength          127
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               1 Embedded
        bJackID                 1
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               2 External
        bJackID                 2
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               1 Embedded
        bJackID                 3
        bNrInputPins            1
        baSourceID( 0)          2
        BaSourcePin( 0)         1
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               2 External
        bJackID                 4
        bNrInputPins            1
        baSourceID( 0)          1
        BaSourcePin( 0)         1
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               1 Embedded
        bJackID                 5
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               2 External
        bJackID                 6
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               1 Embedded
        bJackID                 7
        bNrInputPins            1
        baSourceID( 0)          6
        BaSourcePin( 0)         1
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               2 External
        bJackID                 8
        bNrInputPins            1
        baSourceID( 0)          5
        BaSourcePin( 0)         1
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               1 Embedded
        bJackID                 9
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               2 External
        bJackID                10
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               1 Embedded
        bJackID                11
        bNrInputPins            1
        baSourceID( 0)         10
        BaSourcePin( 0)         1
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               2 External
        bJackID                12
        bNrInputPins            1
        baSourceID( 0)          9
        BaSourcePin( 0)         1
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               1 Embedded
        bJackID                13
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               2 External
        bJackID                14
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               1 Embedded
        bJackID                15
        bNrInputPins            1
        baSourceID( 0)         14
        BaSourcePin( 0)         1
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               2 External
        bJackID                16
        bNrInputPins            1
        baSourceID( 0)         13
        BaSourcePin( 0)         1
        iJack                   0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
        bRefresh                0
        bSynchAddress           0
        MIDIStreaming Endpoint Descriptor:
          bLength                 8
          bDescriptorType        37
          bDescriptorSubtype      1 (GENERAL)
          bNumEmbMIDIJack         4
          baAssocJackID( 0)       1
          baAssocJackID( 1)       5
          baAssocJackID( 2)       9
          baAssocJackID( 3)      13
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
        bRefresh                0
        bSynchAddress           0
        MIDIStreaming Endpoint Descriptor:
          bLength                 8
          bDescriptorType        37
          bDescriptorSubtype      1 (GENERAL)
          bNumEmbMIDIJack         4
          baAssocJackID( 0)       3
          baAssocJackID( 1)       7
          baAssocJackID( 2)      11
          baAssocJackID( 3)      15

This is the same USB descriptor, but stripped down to 2-ports using the above changes. This works perfectly fine on the MIO-XL:
Code:
Bus 001 Device 006: ID 16c0:0485 Van Ooijen Technische Informatica Teensyduino MIDI
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x16c0 Van Ooijen Technische Informatica
  idProduct          0x0485 Teensyduino MIDI
  bcdDevice            2.11
  iManufacturer           1 
  iProduct                2 
  iSerial                 3 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          115
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         1 Audio
      bInterfaceSubClass      3 MIDI Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      MIDIStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength           67
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               1 Embedded
        bJackID                 1
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               2 External
        bJackID                 2
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               1 Embedded
        bJackID                 3
        bNrInputPins            1
        baSourceID( 0)          2
        BaSourcePin( 0)         1
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               2 External
        bJackID                 4
        bNrInputPins            1
        baSourceID( 0)          1
        BaSourcePin( 0)         1
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               1 Embedded
        bJackID                 5
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               2 External
        bJackID                 6
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               1 Embedded
        bJackID                 7
        bNrInputPins            1
        baSourceID( 0)          6
        BaSourcePin( 0)         1
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               2 External
        bJackID                 8
        bNrInputPins            1
        baSourceID( 0)          5
        BaSourcePin( 0)         1
        iJack                   0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
        bRefresh                0
        bSynchAddress           0
        MIDIStreaming Endpoint Descriptor:
          bLength                 6
          bDescriptorType        37
          bDescriptorSubtype      1 (GENERAL)
          bNumEmbMIDIJack         2
          baAssocJackID( 0)       1
          baAssocJackID( 1)       5
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
        bRefresh                0
        bSynchAddress           0
        MIDIStreaming Endpoint Descriptor:
          bLength                 6
          bDescriptorType        37
          bDescriptorSubtype      1 (GENERAL)
          bNumEmbMIDIJack         2
          baAssocJackID( 0)       3
          baAssocJackID( 1)       7
The USB descriptors are identical, except for the additional Jack descriptors and the corresponding length fields.

I wonder if the MIO-XL's USB implementation makes additional assumptions that are not met by the Teensy's USB descriptor, although it's supposed to be class compliant. I'd be very thankful for any help, and I'm happy to spend more time investigating the issue if someone has an idea what to try.

I should add: The Yamaha MODX works perfectly fine on the MIO-XL, although it is a hybrid device with audio streaming and 3 MIDI ports:

I would really like to have more than just the two MIDI ports. What could I do to make the Teensy compatible?
I've also posted on the iConnectivity forum, hope to get more ideas there.

Best, Boris
 
Cross referencing with your other post and looking at the Yamaha MODX device descriptors that you posted there, I noticed a discrepancy in the Teensy descriptors, specifically on the length.
Code:
 MIDIStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        [COLOR="#FF0000"]wTotalLength          129[/COLOR]
If you’ll notice this length here is 129 for just three midi ports, whereas the Teensy is only up to 127 for four midi ports. It appears that the length is not correctly added and this may be where the issues are coming from. As far as I can tell the length of the endpoint descriptors need to be added to the Teensy wTotalLength to be inline with the Yamahas, so for the four midi port Teensy the wTotalLength should be 161 I believe. I don’t have one myself to test if that change will fix the issue or not, but that’s about the only thing I notice that’s different.
Code:
       Endpoint Descriptor:
        [COLOR="#FF0000"]bLength                 9[/COLOR]
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
        bRefresh                0
        bSynchAddress           0
        MIDIStreaming Endpoint Descriptor:
          [COLOR="#FF0000"]bLength                 8[/COLOR]
          bDescriptorType        37
          bDescriptorSubtype      1 (GENERAL)
          bNumEmbMIDIJack         4
          baAssocJackID( 0)       1
          baAssocJackID( 1)       5
          baAssocJackID( 2)       9
          baAssocJackID( 3)      13
      Endpoint Descriptor:
        [COLOR="#FF0000"]bLength                 9[/COLOR]
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
        bRefresh                0
        bSynchAddress           0
        MIDIStreaming Endpoint Descriptor:
          [COLOR="#FF0000"]bLength                 8[/COLOR]
          bDescriptorType        37
          bDescriptorSubtype      1 (GENERAL)
          bNumEmbMIDIJack         4
          baAssocJackID( 0)       3
          baAssocJackID( 1)       7
          baAssocJackID( 2)      11
          baAssocJackID( 3)      15
 
You're right, the USB MIDI specification demands that wTotalLength in the Interface Header descriptor is the
Total number of bytes returned for the
class-specific MIDIStreaming interface
descriptor. Includes the combined length
of this descriptor header and all Jack and
Element descriptors.

And the size of the endpoints seem to miss in the calculation, just as you said. So line 691 of cores/teensy3/usb_desc.c must be:
Code:
LSB(7+(6+6+9+9)*MIDI_NUM_CABLES + 2*(9+4+MIDI_NUM_CABLES)),

In line 492 it's already included.

Now the wTotalLength matches the 129 of the Yamaha descriptor when I use NUM_CABLES = 3.

Of course it feels good to have this fixed, but unfortunately it doesn't make a difference for the MIO-XL. It's still the same: the Teensy is recognized and works fine with 2 ports, only receives MIDI with 3 ports, and is not recognized at all with 4 and more ports.
 
The only other two differences I see so far are the wMaxPacketSize and the JackIDs. Teensy uses 64 bytes for wMaxPacketSize and the Yamaha uses 512 bytes. As for the JackIDs, Yamaha looks like it reserves 32 IDs for each type of Jack, 1-32 for MIDI IN External, 33-64 for MIDI IN Embedded, 65-96 for MIDI OUT External, and 97-128 for MIDI OUT Embedded. Whereas the Teensy just declares the IDs in order of appearance so MIDI IN Embedded has the IDs 1,5,9,13,etc and MIDI IN External has the IDs 2,6,10,14,etc. If changing the wMaxPacketSize doesn’t fix the issue I would look at rearranging where the Jacks are defined so they appear in the same order that the Yamaha uses when you look at the device descriptors.
 
I noticed something else: the Teensy is lacking both the "AudioControl Interface Descriptor" as well as the "Standard AC Interface Descriptor" contained in it.
Quoting from the specs (B.3):
The AudioControl interface describes the device structure (audio function topology) and is used to manipulate the Audio Controls. This device has no audio function incorporated. However, the AudioControl interface is mandatory and therefore both the standard AC interface descriptor and the class-specific AC interface descriptor must be present. The class-specific AC interface descriptor only contains the header descriptor.
And indeed we see the Audio Control descriptor not only in the Yamaha descriptor, but also in the other pure MIDI devices we've seen in the threads.
So I added these, but this also doesn't make a difference for the MIO-XL. Will now try your suggestion and play with the jack IDs.
 
This is devastating me...
I've connected another 4-port MIDI interface to the MIO-XL, it's recognized without problems. Then I tuned the Teensy's USB descriptor to match the one of the 4-port interface as close as possible. This involved changing the order and ids of jacks and endpoints, adding the AudioControl interface mentioned above, and fixing the bTotalLength bug. The only difference is that I have iJack==0 for all jacks, but AFAIK, this should not matter. --> Still no luck, the Teensy is not detected correctly on the MIO-XL. My mac is still happy with it.

Let's step back a bit: are you sure that the problem must be in the USB descriptor, or is there other negotiation-like stuff going on that I should look at?

I don't think the maxPacketSize is an issue, all devices I tested on the MIO-XL have 64, with exception of the Yamaha.
 
I’m not too sure, the descriptors are my only guess but I’m not too familiar with all the nuances of USB to say for certain. I don’t have any MIDI interfaces that have USB Host to test things for myself only an old Emagic AMT8 since all of the gear we have is old and doesn’t have USB connectivity. The AMT8 isn’t even “class-compliant” so I can’t read the descriptors off of that to gain any other information since it had to have custom drivers to support the 64 MIDI I/O if you daisy chain 8 of them like it allows.
 
Just a short update - the July-2020 firmware upgrade (v 1.2.0) for the MIO-XL or MIO-XM doesn't help. Still only 2 port MIDI, no serial.
 
I had the same issue with my XL/XM. It is caused by combination of how Mio gear works and a bug in the teensy3 usb stack. When Mio requests the configuration descriptor one of the get descriptor calls requests 128 bytes. It your configuration descriptor is shorter, you are fine. If it is longer, the event is not handled correctly - two packets of 64 bytes (EP0_SIZE) will be transferred and then the it will attempt to run a control transfer with a reminder size 0 bytes (usb_dev.c line 683). It will crash Mio. Any control transfer with length which is a multiply of EP0_SIZE will fail. You need to prevent sending of the empty control transfer.
 
I had the same issue with my XL/XM. It is caused by combination of how Mio gear works and a bug in the teensy3 usb stack. When Mio requests the configuration descriptor one of the get descriptor calls requests 128 bytes. It your configuration descriptor is shorter, you are fine. If it is longer, the event is not handled correctly - two packets of 64 bytes (EP0_SIZE) will be transferred and then the it will attempt to run a control transfer with a reminder size 0 bytes (usb_dev.c line 683). It will crash Mio. Any control transfer with length which is a multiply of EP0_SIZE will fail. You need to prevent sending of the empty control transfer.

Hi Martin, sounds like you got some deep insights there! Do you have a fix that you could share?
Best, Boris
 
I looked at the currrent master on github. Try to adjust the usb_dev.c around line 683 to the following:

Code:
	case 0x09: // IN transaction completed to host
		//serial_print("PID=IN:");
		//serial_phex(stat);
		//serial_print("\n");

		// send remaining data, if any...
		data = ep0_tx_ptr;
		size = ep0_tx_len;

		if ((data) && (size > 0))
		{
			if (size > EP0_SIZE)
			{
				size = EP0_SIZE;
			}

			endpoint0_transmit (data, size);

			data += size;
			ep0_tx_len -= size;
			ep0_tx_ptr = (ep0_tx_len > 0 || size == EP0_SIZE) ? data : NULL;
		}
		else
		{
			// something is not quite right, act accordingly
		}

note, I just tried to draft the idea. This is not a bullet-proof solution.

Also, there is more things to tackle. I think most of them are mentioned in this thread:

- size of the configuration descriptor must be calculated correctly (mio will not work without that)
- it is a good idea to add an Audio control interface. I do believe that MIDI specs says it should be present (mio does not require this one)
- iJacks on embedded Jack In and Out should reference a String descriptor. (Not required but nice to have, mio unfortunately ignores cable string descriptors)

Let me know, if it helped. if not, there might still be something else to adjust.
 
Last edited:
Hi Martin,
I've played with your solution but could not get it to work. Even worse, after updating Teensyduino, my solution of stripping the MIDIx4 down to two ports doesn't work either. I noticed that USB_MIDI4 now also includes the serial emulation, although it shouldn't. If I comment the lines SEREMU_* out as before, I get errors in other parts of the library, which weren't there before :(

Is there any hope this works out of the box with a Teensy4, or will there be the same or a similar issue with multi-port USB in combination with the mio interfaces?

Best, Boris
 
Subscribed ;) We have customers complaining that our 3.2 based widget doesn't work with the iConnectivity MIDI routers USB host and would like to find a solution.
 
Updated patch for a 2-MIDI-Port Teensy on Mio-M/XL

Hello, friends of the mio-Interfaces,

A change in the Teensy 3.6 software broke my patch that made the Teensy work with the iConnectivity mioXL. I'd even say it's a new bug in the Teensy software, since disabling the SEREMU_INTERFACE define causes compiler errors in many files.

Here's an updated manual patch to make the current Teensy 3.6 work with the mioXL with 2 cables/ports:

1. Use Tools -> USB Type -> MIDIx4
2. adapt the file usb_desc.h as before (repeated below)
3. adapt the files usb_seremu.h and usb_seremu.c as shown below
4. no need to adapt yield.cpp anymore!

hardware/teensy/avr/cores/teensy3/usb_desc.h (as before):
Code:
#elif defined(USB_MIDI4)
  ...
  #define NUM_INTERFACE		1  // <-- this was 2
  // #define SEREMU_INTERFACE      1	// <-- commented out
  ...
  #define MIDI_NUM_CABLES       2  // <-- this was 4


hardware/teensy/avr/cores/teensy3/usb_seremu.h (this is new):
Code:
// #if defined(SEREMU_INTERFACE)  // <-- commenting out line 36
//#endif // SEREMU_INTERFACE  // <-- commenting out line 136

hardware/teensy/avr/cores/teensy3/usb_seremu.c (this is new):
Code:
// #if defined(SEREMU_INTERFACE)  // <-- commenting out line 38
//#endif // SEREMU_INTERFACE  // <-- commenting out line 286

Note that this is a dirty hack that I'm not really proud of, since it breaks the USB mode "Serial + MIDIx4". But it's not clear to me how to disentangle the SEREMU_INTERFACE stuff. I think a clean solution would require to fix compilation without SEREMU_INTERFACE, for example in the SDFat files.

Best, Boris
 
Last edited:
@PaulStoffregen, is there a way to disable the SEREMU_INTERFACE in a USB descriptor for the sake of compatibility without breaking code at other places (e.g. Serial being undefined in libraries/SD/utility/SdFile.cpp)?
 
Let me state here for future reference, that all these issues are fixed with a Teensy 4.0.
The MIO-XL can host the Teensy with 4 virtual ports no problem, and even reprogramming works without hitting the physical programming switch. Nice!
 
Do we know, does the same USB client library run on other Teensy's with the latest version of Teensyduino? That is, can we get whatever was fixed in the Teensy 4 USB client code to run on Teensy 3.6 or 3.2?
 
Back
Top