Forum Rule: Always post complete source code & details to reproduce any issue!
Page 2 of 3 FirstFirst 1 2 3 LastLast
Results 26 to 50 of 53

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

  1. #26
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,692
    Quote Originally Posted by xxxajk View Post
    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.


    Quote Originally Posted by xxxajk View Post
    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!

  2. #27
    Senior Member xxxajk's Avatar
    Join Date
    Nov 2013
    Location
    Buffalo, NY USA
    Posts
    516
    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.

  3. #28
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,692
    Quote Originally Posted by xxxajk View Post
    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)

  4. #29
    Senior Member xxxajk's Avatar
    Join Date
    Nov 2013
    Location
    Buffalo, NY USA
    Posts
    516
    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.

  5. #30
    Quote Originally Posted by PaulStoffregen View Post
    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

  6. #31
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,692
    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.

  7. #32
    Quote Originally Posted by PaulStoffregen View Post
    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 …

  8. #33
    Senior Member xxxajk's Avatar
    Join Date
    Nov 2013
    Location
    Buffalo, NY USA
    Posts
    516
    Did UHS3 work too?

  9. #34
    Quote Originally Posted by PaulStoffregen View Post
    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.

  10. #35
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,692
    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.

  11. #36
    Quote Originally Posted by PaulStoffregen View Post
    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

  12. #37
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,692
    The debug info should be much longer. Please make sure you copy *all* of it. Details matter!

  13. #38
    Quote Originally Posted by PaulStoffregen View Post
    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.

  14. #39
    Quote Originally Posted by uleria View Post
    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

  15. #40
    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…

  16. #41
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,692
    Quote Originally Posted by uleria View Post
    … 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!

  17. #42
    Quote Originally Posted by PaulStoffregen View Post
    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.

  18. #43
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,692
    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.

  19. #44
    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?

  20. #45
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,692
    Quote Originally Posted by uleria View Post
    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 by PaulStoffregen; 03-04-2019 at 09:46 PM. Reason: typo

  21. #46
    Quote Originally Posted by PaulStoffregen View Post
    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.

  22. #47
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,692
    Does it print anything after "new_Pipe" if you run with only the hub connected, but nothing plugged into the hub?

  23. #48
    Quote Originally Posted by PaulStoffregen View Post
    Does it print anything after "new_Pipe" if you run with only the hub connected, but nothing plugged into the hub?
    No nothing else printed.

  24. #49
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,692
    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.

  25. #50
    ok, I will try to check it on the weekend.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •