USBHost_t36 Midi InputFunctions example is not working for me... Hardware issue?

Status
Not open for further replies.
Novation Launchpad isn't a regular midi device.

It is indeed a class compliant USB MIDI device.

Novation used interrupt rather than bulk for their endpoints. The USB audio class spec allows this, though it is a rather unusual choice.


The actual core of UHS3 is quite fast. I'd have to say if it acts that way across everything, then it is UHS3, else it is the t3.2 code.

If you care about this, hopefully this at least gives you a test case to look at the issue.... a test case where you actually have the source code for the device side! ;)
 
Novation Launchpad... any chance you can give me a
Code:
lsusb -vdVID:PID
on Linux for that? I should be able to make it work.

T3.2 testing midi... Well, I don't "care" in the fact that I've never used it, but, hey, why not. I can take a look at it later tonight if I get some free time.
 
Novation Launchpad... any chance you can give me a lsusb -vdVID:pID on Linux for that?

Code:
Bus 004 Device 032: ID 1235:0069 Focusrite-Novation 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x1235 Focusrite-Novation
  idProduct          0x0069 
  bcdDevice            0.01
  iManufacturer           1 Focusrite A.E. Ltd
  iProduct                2 Launchpad MK2
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           82
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      1 Control Device
      bInterfaceProtocol      0 
      iInterface              3 Launchpad MK2
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength            9
        bInCollection           1
        baInterfaceNr( 0)       1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         1 Audio
      bInterfaceSubClass      3 MIDI Streaming
      bInterfaceProtocol      0 
      iInterface              3 Launchpad MK2
      MIDIStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength           46
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               1 Embedded
        bJackID                 1
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               1 Embedded
        bJackID                 2
        bNrInputPins            1
        baSourceID( 0)          1
        BaSourcePin( 0)         1
        iJack                   0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
        MIDIStreaming Endpoint Descriptor:
          bLength                 5
          bDescriptorType        37
          bDescriptorSubtype      1 (GENERAL)
          bNumEmbMIDIJack         1
          baAssocJackID( 0)       2
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
        MIDIStreaming Endpoint Descriptor:
          bLength                 5
          bDescriptorType        37
          bDescriptorSubtype      1 (GENERAL)
          bNumEmbMIDIJack         1
          baAssocJackID( 0)       1
Device Status:     0x0000
  (Bus Powered)
 
Pushed some fixes, enhancements. Let me know if Novation Launchpad works now, or not.
The Audio Control subclass isn't supported, needs an interface driver for that.
 
Good news, turns out a friend here in the Portland area has an OP-1 and they're willing to let me use at a bi-weekly electronics meetup.

I'm still getting over a cold right now, so it's unlikely I'll make it out there this week. Will probably have to wait until Feb 4th.

Paul, did you have a chance to try the OP1? Excited to hear your findings ;)
 
Yes, I did get a chance to use a TE OP-1.

Apparently the OP-1 has 3 different USB modes. The OP-1 I used was in MIDI mode. We didn't try reconfiguring to the other modes, because it was needed for a live performance the next night.

The problem did indeed turn out to be the buffer sizes. With large buffers, the OP-1 worked fine. :)

On github, I've added a MIDIDevice_BigBuffer class. If you use the latest from github, you should be able to make the OP-1 work by just replacing "MIDIDevice" with "MIDIDevice_BigBuffer" near the top of your program. If you watch the memory usage, you should see the "Global variables use" increase by about 4000 bytes.

Not yet in the library, but I'm planning to add soon, will be an optional speed parameter. Then you'll be able to also use myusb.begin(12) to disable 480 Mbit speed. When running at only 12 Mbit, the large buffers are not needed. I tested 12 Mbit too (by editing the library internally). OP-1 works with the normal MIDIDevice when the speed is only 12 Mbit.
 
Yes, I did get a chance to use a TE OP-1.

Apparently the OP-1 has 3 different USB modes. The OP-1 I used was in MIDI mode. We didn't try reconfiguring to the other modes, because it was needed for a live performance the next night.

The problem did indeed turn out to be the buffer sizes. With large buffers, the OP-1 worked fine. :)

On github, I've added a MIDIDevice_BigBuffer class. If you use the latest from github, you should be able to make the OP-1 work by just replacing "MIDIDevice" with "MIDIDevice_BigBuffer" near the top of your program. If you watch the memory usage, you should see the "Global variables use" increase by about 4000 bytes.

Not yet in the library, but I'm planning to add soon, will be an optional speed parameter. Then you'll be able to also use myusb.begin(12) to disable 480 Mbit speed. When running at only 12 Mbit, the large buffers are not needed. I tested 12 Mbit too (by editing the library internally). OP-1 works with the normal MIDIDevice when the speed is only 12 Mbit.

Paul, that's amazing news!! Thank you very much for your efforts.
Will try as soon as possible and report back …
 
Yes, I did get a chance to use a TE OP-1.

Apparently the OP-1 has 3 different USB modes. The OP-1 I used was in MIDI mode. We didn't try reconfiguring to the other modes, because it was needed for a live performance the next night.

The problem did indeed turn out to be the buffer sizes. With large buffers, the OP-1 worked fine. :)

On github, I've added a MIDIDevice_BigBuffer class. If you use the latest from github, you should be able to make the OP-1 work by just replacing "MIDIDevice" with "MIDIDevice_BigBuffer" near the top of your program. If you watch the memory usage, you should see the "Global variables use" increase by about 4000 bytes.

Not yet in the library, but I'm planning to add soon, will be an optional speed parameter. Then you'll be able to also use myusb.begin(12) to disable 480 Mbit speed. When running at only 12 Mbit, the large buffers are not needed. I tested 12 Mbit too (by editing the library internally). OP-1 works with the normal MIDIDevice when the speed is only 12 Mbit.

Ok, I tried – but unfortunately still no luck …

I downloaded your newest version from Github and double-checked for the new MIDIDevice_BigBuffer class – it's there. I use the example file "InputFunctions". In the file, I changed "MIDIDevice midi1(myusb);" to "MIDIDevice_BigBuffer midi1(myusb);". Uploaded to the Teensy 3.6. Connect OP1 in Midi Mode.
As before, with the Akai LPK25 it is working, with the OP1 it is not working. I tried different orders of turning on and connecting, with no luck. I am really sorry, but I'm not sure, what I'm doing wrong. :confused:
 
Maybe your OP-1 is set of one of the modes I didn't test?

Please edit USBHost_t36.h. Uncomment this line:

Code:
//#define USBHOST_PRINT_DEBUG

You'll see a tremendous amount of debug info printed to the serial monitor. Please copy and paste all of it to a message here.
 
Maybe your OP-1 is set of one of the modes I didn't test?

Please edit USBHost_t36.h. Uncomment this line:

Code:
//#define USBHOST_PRINT_DEBUG

You'll see a tremendous amount of debug info printed to the serial monitor. Please copy and paste all of it to a message here.

Thank you for your help.
OP1 is in Midi Mide (Pressing Shift + Com, then selecting "CTRL" by pressing 2).

Here is the debug info:

Code:
USB Host InputFunctions example
sizeof Device = 36
sizeof Pipe = 96
sizeof Transfer = 64
power up USBHS PHY
 reset waited 5
USBHS_ASYNCLISTADDR = 0
USBHS_PERIODICLISTBASE = 1FFF4000
periodictable = 1FFF4000
port change: 10001803
    connect
  begin reset
port change: 18001205
  port enabled
  end recovery
new_Device: 480 Mbit/sec
new_Pipe
 
The debug info should be much longer. Please make sure you copy *all* of it. Details matter!

I wish I could. I guess that's the problem. It's all there is on the serial monitor … after "new_Pipe" nothing else is printed.
When connecting another device, there's much more info.
 
I wish I could. I guess that's the problem. It's all there is on the serial monitor … after "new_Pipe" nothing else is printed.
When connecting another device, there's much more info.

here is what's printed when unplugging the OP-1 again:

Code:
port change: 1C00100A
    disconnect
disconnect_Device:
USBDriver (available_drivers) list: 1FFF33C0 -> 1FFF3140 -> 1FFF2020
USBDriver (dev->drivers) list: (empty
USBDriver (available_drivers) list: 1FFF33C0 -> 1FFF3140 -> 1FFF2020
delete_Pipe 1FFF4400
  shut down async schedule
  Free transfers
    * 536823104 * remove * free
    * 536822912
    * 536822976 * remove * defer free until QH
  Free transfers attached to QH
    * 536822912
    * 536822976
    * 536823040
* Delete Pipe completed
removed Device_t from devlist
  disable
 
Here's the debug info when connecting the Akai LPK25 (working):

Code:
USB Host InputFunctions example
sizeof Device = 36
sizeof Pipe = 96
sizeof Transfer = 64
power up USBHS PHY
 reset waited 5
USBHS_ASYNCLISTADDR = 0
USBHS_PERIODICLISTBASE = 1FFF4000
periodictable = 1FFF4000
port change: 10001803
    connect
  begin reset
port change: 10001005
  port enabled
  end recovery
new_Device: 12 Mbit/sec
new_Pipe
enumeration:
enumeration:
enumeration:
Device Descriptor:
  12 01 10 01 00 00 00 10 E8 09 76 00 00 01 01 02 00 01 
    VendorID = 09E8, ProductID = 0076, Version = 0100
    Class/Subclass/Protocol = 0 / 0 / 0
    Number of Configurations = 1
enumeration:
enumeration:
Manufacturer: AKAI professional LLC
enumeration:
Product: LPK25
enumeration:
Config data length = 101
enumeration:
Configuration Descriptor:
  09 02 65 00 02 01 00 A0 32 
    NumInterfaces = 2
    ConfigurationValue = 1
  09 04 00 00 00 01 01 00 00 
    Interface = 0
    Number of endpoints = 0
    Class/Subclass/Protocol = 1 / 1 / 0
  09 24 01 00 01 09 00 01 01 
  09 04 01 00 02 01 03 00 00 
    Interface = 1
    Number of endpoints = 2
    Class/Subclass/Protocol = 1 / 3 / 0
  07 24 01 00 01 41 00 
  06 24 02 01 01 00 
  06 24 02 02 02 00 
  09 24 03 01 03 01 02 01 00 
  09 24 03 02 04 01 01 01 00 
  09 05 01 02 40 00 00 00 00 
    Endpoint = 1 OUT
    Type = Bulk
    Max Size = 64
    Polling Interval = 0
  05 25 01 01 01 
  09 05 81 02 40 00 00 00 00 
    Endpoint = 1 IN
    Type = Bulk
    Max Size = 64
    Polling Interval = 0
  05 25 01 01 03 
enumeration:
USBHub memory usage = 960
USBHub claim_device this=1FFF3140
USBHub memory usage = 960
USBHub claim_device this=1FFF3500
Descriptor 4 = INTERFACE
MIDIDevice claim this=1FFF2020
len = 92
  Interface is unknown (might be Yahama)
type: 36, len: 9
    MIDI Header (ignored)
type: 4, len: 9
Descriptor 36 =  ???
Descriptor 4 = INTERFACE
MIDIDevice claim this=1FFF2020
len = 74
  Interface is MIDI
type: 36, len: 7
    MIDI Header (ignored)
type: 36, len: 6
    MIDI IN Jack (ignored)
type: 36, len: 6
    MIDI IN Jack (ignored)
type: 36, len: 9
    MIDI OUT Jack (ignored)
type: 36, len: 9
    MIDI OUT Jack (ignored)
type: 5, len: 9
    MIDI Endpoint: 1
      tx_size = 64
type: 37, len: 5
    MIDI Endpoint Jack Association (ignored)
type: 5, len: 9
    MIDI Endpoint: 81
      rx_size = 64
type: 37, len: 5
    MIDI Endpoint Jack Association (ignored)
new_Pipe
new_Pipe
Descriptor 36 =  ???
Descriptor 36 =  ???
Descriptor 36 =  ???
Descriptor 36 =  ???
Descriptor 36 =  ???
Descriptor 5 = ENDPOINT
Descriptor 37 =  ???
Descriptor 5 = ENDPOINT
Descriptor 37 =  ???
MIDIDevice Receive
  MIDI Data: 3A FD 80 B9 0B 5D 19 BE 81 CE 44 19 A8 E3 00 2B 7E 70 D9 56 E7 7E 31 3B A6 BA A9 98 23 E5 9C 5F 98 02 AB A9 50 AE 25 15 5E 5C 1A 54 DB 28 A8 6E FC 51 D7 7C E8 BD 31 FC 7D AC 2B 68 35 9F 00 5C 
avail = 383
queue another receive packet
read: B980FD3A
read: BE195D0B
read: 1944CE81
read: 2B00E3A8
read: 56D9707E
read: 3B317EE7
SysEx Message: 7E 31 3B (end)
read: 98A9BAA6
SysEx Message: BA A9 (end)
read: 5F9CE523
read: A9AB0298
read: 1525AE50
read: 541A5C5E
read: 6EA828DB
read: 7CD751FC
read: FC31BDE8
read: 682BAC7D
read: 5C009F35

and then (when pressing keys):

Code:
MIDIDevice Receive
  MIDI Data: 09 90 3C 76 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
avail = 398
queue another receive packet
read: 763C9009
Note On, ch=1, note=60, velocity=118
etc…
 
… after "new_Pipe" nothing else is printed.

Maybe this is a power related problem? I can't think of any other reason why it would suddenly stop there.

Can you try using a powered USB hub? First make sure the hub is getting external power. Then plug the hub into Teensy 3.6, and the OP-1 into the hub. That way, the OP-1 will draw all its power from the hub, not from Teensy.

If the hub has more than 7 ports, you might need to add more hub instances in the code. Usually 10+ port hubs internally are multiple 4 port hubs connected together.

Alternately if you have a voltmeter, can you (very carefully) monitor the voltage at the red and black wires going to the USB cable? Be extremely cautious, since the Teensy 3.6 pins aren't 5V tolerant, so you don't want to accidentally short the 5V power to anything nearby!
 
Maybe this is a power related problem? I can't think of any other reason why it would suddenly stop there.

Can you try using a powered USB hub? First make sure the hub is getting external power. Then plug the hub into Teensy 3.6, and the OP-1 into the hub. That way, the OP-1 will draw all its power from the hub, not from Teensy.

Yes, it worked!!!
Had to try three different USB hubs until it finally worked with an old usb2.0 hub I luckily had lying around.
Thank you again for your help, Paul!

Now I can play and sequence my modular from the OP-1, which has awesome crazy sequencers.
 
Glad it's working!

Any chance I could talk you into doing a little more testing on those 2 hubs that didn't work?

If the problems were "only" power related, then I'm fine with that. But if you've found hubs that don't work with USBHost_t36, I'd really like to know more about them. Just running the "Test" example with the hub and a USB mouse or keyboard would be plenty to check if those hubs work.

If you really do have hubs that USBHost_t36 can't use, please start a new thread with at least whatever info you have on the hubs, or just photos if they are generic no-name products. The debug data would also really help.
 
Sure, I can do that.

One hub I tried was this one:
"Anker® USB 3.0 Aluminum 13-Port Hub + 5V 2.1A Smart Ladeport mit 12V 5A Power Adapter [VIA VL812-B2 Chipset]"

When connecting the hub (also with nothing else connected to the hub), I see the same behaviour as with OP-1 directly: Debug info stops at
Code:
…
new_Device: 480 Mbit/sec
new_Pipe

The other one was a USB C hub and probably didn't work because of a cheap adapter I used.
Should I open a new thread regarding the Anker?
 
Should I open a new thread regarding the Anker?

Before starting a new thread, try plugging into different ports on that hub. My guess is you'll find 5 of the 13 ports work and 8 are "dead". If so, that's a sure sign it's really 4 hubs inside and you've got only 2 hub instances in the example. Adding more hub instances in the code should solve that problem.

If none of the ports work, definitely start a new thread with as much info as possible.
 
Last edited:
Before starting a new thread, try plugging into different ports on that hub.

Sorry, if I wrote it a bit unclearly.
Here's what I do: First, I only connect the hub from its USB 3.0 B male to the USB Host connection of the Teensy 3.6. I restart the Teensy with the example "Test" file on it. Debug info that gets printed:

Code:
USB Host Testing
sizeof Device = 36
sizeof Pipe = 96
sizeof Transfer = 64
power up USBHS PHY
 reset waited 4
USBHS_ASYNCLISTADDR = 0
USBHS_PERIODICLISTBASE = 1FFF4000
periodictable = 1FFF4000
port change: 10001803
    connect
  begin reset
port change: 18001205
  port enabled
  end recovery
new_Device: 480 Mbit/sec
new_Pipe

Then I do the same with a usb keyboard plugged into any of the USB inputs of the hub: does not work or print anything else.
 
My best guess, again, is very likely a power problem. Can you give more info about how Teensy 3.6 is getting power? Is is plugged directly into a PC? Or into a hub? Is that hub powered or unpowered (getting power only on its USB cable to the PC)?

Maybe try using a voltmeter to check the VIN pin, to see how much voltage Teensy 3.6 is receiving. Also (very carefully) check the 5V output on the host port, to see how much voltage Teensy is giving to your hub to run. My guess is these will probably show voltages much less than 5 volts.
 
Status
Not open for further replies.
Back
Top