Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 11 of 11

Thread: Problem with sendSysEx via USBHost_t36 and a guitar pedal

  1. #1
    Junior Member
    Join Date
    Jul 2019
    Posts
    6

    Problem with sendSysEx via USBHost_t36 and a guitar pedal

    Hey,

    I'm working on a external controller for my Boss DD-500 delay guitar pedal. This pedals has midi capabilities over USB so I want to use the second usb port of the Teensy 3.6 and the USBHost_t36 library to send mostly system exclusive data to the pedal. I use the following code to check if it's working:

    Code:
    #include <USBHost_t36.h>
    uint8_t buf[] = {0xF0, 0x41, 0x10, 0x00, 0x00, 0x00, 0x4D, 0x12, 0x30, 0x00, 0x10, 0x1F, 0x13, 0x0E, 0xF7}; //this message is a valid message, checked by sending it from Max/MSP to the pedal. 
    USBHost myusb;
    USBHub hub1(myusb);
    USBHub hub2(myusb);
    MIDIDevice midi01(myusb);
    
    void setup() {
      delay(1500);
      myusb.begin();
    }
    
    void loop() {
      midi01.sendSysEx(15,buf,true);
      delay(5000);
    }
    I don't receive the data on my pedal, the corresponding parameter does not change. When I use the USBMidi function of the Teensy, send the sysEx-data to my Macbook and forward it via USB to the Boss DD-500, the parameter does change. When I send midi CC-data from the Teensy direct to the pedal with for example
    Code:
    midi01.sendControlChange(28,127,11);
    it works as well. So I think there is something wrong with how the sysEx data is sent out of the Teensy via the USB-host library, but I can't see what is going on.

    When I enable USBHOST_PRINT_DEBUG in the USBHost_t36 library this is the output:

    Code:
    sizeof Device = 36
    sizeof Pipe = 96
    sizeof Transfer = 64
    power up USBHS PHY
    port change: 10001803
        connect
      begin reset
    port change: 10001805
      port enabled
      end recovery
    new_Device: 12 Mbit/sec
    new_Pipe
    enumeration:
    enumeration:
    enumeration:
    Device Descriptor:
      12 01 10 01 00 00 00 40 82 05 B3 01 00 01 01 02 00 01 
        VendorID = 0582, ProductID = 01B3, Version = 0100
        Class/Subclass/Protocol = 0 / 0 / 0
        Number of Configurations = 1
    enumeration:
    enumeration:
    Manufacturer: BOSS
    enumeration:
    Product: DD-500
    enumeration:
    Config data length = 101
    enumeration:
    Configuration Descriptor:
      09 02 65 00 02 01 00 C0 00 
        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 40 00 
      06 24 02 02 80 00 
      09 24 03 01 20 01 80 01 00 
      09 24 03 02 10 01 40 01 00 
      09 05 03 02 40 00 00 00 00 
        Endpoint = 3 OUT
        Type = Bulk
        Max Size = 64
        Polling Interval = 0
      05 25 01 01 40 
      09 05 84 02 40 00 00 00 00 
        Endpoint = 4 IN
        Type = Bulk
        Max Size = 64
        Polling Interval = 0
      05 25 01 01 20 
    enumeration:
    USBHub memory usage = 960
    USBHub claim_device this=1FFF26E0
    USBHub memory usage = 960
    USBHub claim_device this=1FFF2AA0
    USBHub memory usage = 960
    USBHub claim_device this=1FFF2E60
    USBHub memory usage = 960
    USBHub claim_device this=1FFF3220
    Descriptor 4 = INTERFACE
    MIDIDevice claim this=1FFF2020
    len = 92
    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: 3
          tx_size = 64
    type: 37, len: 5
        MIDI Endpoint Jack Association (ignored)
    type: 5, len: 9
        MIDI Endpoint: 84
          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 transmit complete
      MIDI Data: 04 F0 41 10 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 
    MIDIDevice transmit complete
      MIDI Data: 04 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 00 00 00 
    MIDIDevice transmit complete
      MIDI Data: 04 4D 12 30 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 
    MIDIDevice transmit complete
      MIDI Data: 04 00 10 1F 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 
    MIDIDevice transmit complete
      MIDI Data: 07 13 0E F7 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
    Does anyone have an idea what can be wrong and how to fix it?

    Thanks!

    Roald

  2. #2
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,138
    Apparently Boss pedals are not usb midi compliant but Paul is open to addressing incompatibilities.

    https://forum.pjrc.com/threads/55635...st_t36-library

  3. #3
    Junior Member
    Join Date
    Jul 2019
    Posts
    6
    Quote Originally Posted by oddson View Post
    Apparently Boss pedals are not usb midi compliant but Paul is open to addressing incompatibilities.
    This one is midi usb compliant, as far as I can see. On the pedal I can change the USB mode from 'vendor' to 'generic'. When it is on 'generic' the following code does work (sending midi cc data to switch the pedal on and off via the USBHost_t36 library.) When I set it to 'vendor' it does not work.

    Code:
    #include <USBHost_t36.h>
    int val = 0;
    USBHost myusb;
    USBHub hub1(myusb);
    USBHub hub2(myusb);
    MIDIDevice midi01(myusb);
    
    void setup() {
      delay(1500);
      myusb.begin();
    }
    
    void loop() {
      midi01.sendControlChange(28,(val++ % 2)*127,11);
      delay(5000);
    }

  4. #4
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,138
    Does this mean you're sorted?

  5. #5
    Junior Member
    Join Date
    Jul 2019
    Posts
    6
    No, CC does work when the pedal is in generic mode, but System Exclusive does not work. And that is the main problem..

  6. #6
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,138
    How have you established it will not respond to valid sysex commands?

    I don't know about you but I NEVER send good sysex on the first try. And this thing has four model# bytes and a bunch of other stuff you need to get right for even the simplest command.
    Last edited by oddson; 07-05-2019 at 05:17 PM. Reason: Typo

  7. #7
    Junior Member
    Join Date
    Jul 2019
    Posts
    6
    I've build an editor for this pedal in javascript which works fine. It took me some time, but now I do understand how to create the correct SysEx messages, so I'm pretty sure the SysEx data is correct. And as I mentioned in my first post, if I send the data from the Teensy through the usb-midi connection to my mac and forward it with a midi-patchbay-app to the pedal it does change the parameter.

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,304
    Quote Originally Posted by espoir View Post
    if I send the data from the Teensy through the usb-midi connection to my mac and forward it with a midi-patchbay-app to the pedal it does change the parameter.
    Oh, if only I could somehow reproduce this here. Then I could connect my USB protocol analyzer between the Mac and the pedal, to see what's different about the USB communication.

    Any chance you could help me to recreate this communication? I suppose the first step would be the get another Teensy to act as a stand-in for the pedal?

    I'm not a musician. I don't actually use MIDI for anything. I own 3 cheap MIDI instruments, which I bought only for the purpose of testing Teensy's USB MIDI. I have no idea what the "midi-patchbay-app" is, and even if I did have the software, I would need pretty specific instructions to get it set up the same way you're using.

    But I do know USB communication & Teensy. I wrote these libraries doing the USB MIDI, both device and host. If somehow get the same setup you're using, I do have the gear and experience to look at what's actually different between the Mac's communication and what's in USBHost_t36. If I can capture & inspect the actual USB packets, I'll probably be able to come up with a fix for USBHost_t36 to make it more compatible with this pedal.

  9. #9
    Junior Member
    Join Date
    Jul 2019
    Posts
    6
    Quote Originally Posted by PaulStoffregen View Post
    Any chance you could help me to recreate this communication? I suppose the first step would be the get another Teensy to act as a stand-in for the pedal?
    I hope I can, what exactly do you need to get more information about the problem? The fun thing about this pedal that it has USB-midi and midi over the standard 5 pins connectors. So I can connect two devices at the same time. Next to this I can forward the incoming data from the 5-pin-connector to USB midi or the other way around. So what I did: I used Max/MSP to send a message from my Mac to the pedal via a midi-interface, so via the 5-pin-connector. The pedal forwards this to the USB-midi port and sends it to the Teensy. When I received the sent SysEx message on the Teensy I transmitted the message I want to send to the pedal from the Teensy. Below the output of the USBHost_t36 in debug mode:

    Code:
    MIDIDevice Receive
      MIDI Data: 04 F0 41 10 14 F0 41 10 04 00 00 00 14 00 00 00 04 4D 12 30 14 4D 12 30 04 00 10 1F 14 00 10 1F 07 13 0E F7 17 13 0E F7 
    avail = 69
    queue another receive packet
    read: 1041F004
    read: 1041F014
    read: 4
    read: 14
    read: 30124D04
    read: 30124D14
    read: 1F100004
    read: 1F100014
    read: F70E1307
    
    MIDIDevice transmit complete
      MIDI Data: 04 F0 41 10 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 
    MIDIDevice transmit complete
      MIDI Data: 04 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 00 00 00 
    MIDIDevice transmit complete
      MIDI Data: 04 4D 12 30 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 
    
    read: F70E1317
    
    MIDIDevice transmit complete
      MIDI Data: 04 00 10 1F 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 
    MIDIDevice transmit complete
      MIDI Data: 07 13 0E F7 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
    The message that I sent from Max/MSP is this:
    Code:
    F0 41 10 00 00 00 4D 12 30 00 10 1F 13 0E F7
    The pedal changed it's parameter when I sent the message from Max/MSP, but not when I sent it from the Teensy to the pedal.

    Is this any useful information?

    It would be great if you can come up with a fix for the library to make it work. Let me know if there is more specific information I can pass to you.

  10. #10
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,304
    The debug info is interesting. Looks like part (most) of the message may be getting truncated. Hard to say for sure, and if that is the case, difficult to know if it's a bug in the library or something wrong in the main program. Also looks like the incoming data has 2 messages interleaved, but why I'm not sure. Maybe the receiving code isn't handling that well?

    Any change you could write a smallest-possible program which only sends the sysex message in loop(), plus a 1 second delay. That would eliminate all the receive stuff and give us a small & simple stand-alone program for testing.

    If a simple stand-alone program does work, that's useful info too. Then we can try looking at the receive code and message forwarding.

  11. #11
    Junior Member
    Join Date
    Jul 2019
    Posts
    6
    This is the simple every one second send a message code:
    Code:
    #include <USBHost_t36.h>
    uint8_t buf[] = {0xF0, 0x41, 0x10, 0x00, 0x00, 0x00, 0x4D, 0x12, 0x30, 0x00, 0x10, 0x1F, 0x13, 0x0E, 0xF7}; 
    USBHost myusb;
    USBHub hub1(myusb);
    USBHub hub2(myusb);
    MIDIDevice midi01(myusb);
    
    void setup() {
      delay(1500);
      myusb.begin();
    }
    
    void loop() {
      midi01.sendSysEx(15,buf,true);
      delay(1000);
      Serial.println();
    }
    and this is its output:

    Code:
    MIDIDevice transmit complete
      MIDI Data: 04 F0 41 10 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 
    MIDIDevice transmit complete
      MIDI Data: 04 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 00 00 00 
    MIDIDevice transmit complete
      MIDI Data: 04 4D 12 30 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 
    MIDIDevice transmit complete
      MIDI Data: 04 00 10 1F 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 
    MIDIDevice transmit complete
      MIDI Data: 07 13 0E F7 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 
    
    MIDIDevice transmit complete
      MIDI Data: 04 F0 41 10 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 
    MIDIDevice transmit complete
      MIDI Data: 04 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 00 00 00 
    MIDIDevice transmit complete
      MIDI Data: 04 4D 12 30 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 
    MIDIDevice transmit complete
      MIDI Data: 04 00 10 1F 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 
    MIDIDevice transmit complete
      MIDI Data: 07 13 0E F7 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

Posting Permissions

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