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

Thread: Teensy 3.2 MIDI SysEx size over 255 bytes

  1. #1
    Junior Member
    Join Date
    Jan 2016
    Posts
    13

    Teensy 3.2 MIDI SysEx size over 255 bytes

    Hello everybody,

    I connected my Teensy 3.2 with a Blofeld Synthesizer to recieve and send MIDI messages.

    I can send and recieve ControlChange data and I'm able to recieve small SysEx data from the synth. But I want to recieve a sound dump from my synthesizer which is 256 bytes long, so the SysEx-Array has to be that log as well and I changed
    Code:
    #define MIDI_SYSEX_ARRAY_SIZE 255   // Maximum size is 65535 bytes.
    to 256 in the MIDI.h library.

    But now the Teensy stops operating, as soon as my synth sends any kind of SysEx data.
    I don't even have to implement any actions on recieving SysEx data to make this error appear.

    Is there something else that I have to chance besides the adjustment of the MIDI_SYSEX_ARRAY_SIZE?

    My code:
    Code:
    #include <MIDI.h>
    
    const int channel = 1;
    int cc;
    int val;
    
    void setup()
    {                
      Serial.begin(38400);
      Serial1.begin(31250);
      MIDI.begin();
      pinMode(13, OUTPUT);
      digitalWrite(13, HIGH);
    }
    
    void loop()                     
    {
      if (MIDI.read()) {
      byte type = MIDI.getType();
      switch (type) {
         case ControlChange:
            cc = MIDI.getData1();
            val = MIDI.getData2();
            Serial.print("CC: ");
            Serial.print(cc);
            Serial.print(" Value: ");
            Serial.println(val);
            break;
            }
      }
    }
    Sorry for my english, I'm not a native speaker..

  2. #2
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,318
    In midi.cpp this piece of code:
    Code:
    					case 0xF7:
    						if (getTypeFromStatusByte(mPendingMessage[0]) == SystemExclusive) {
    							
    							// Store System Exclusive array in midimsg structure
    							for (byte i=0;i<MIDI_SYSEX_ARRAY_SIZE;i++) {
    won't handle more than 255 bytes correctly. Change the for statement to:
    Code:
    							for (unsigned int i=0;i<MIDI_SYSEX_ARRAY_SIZE;i++) {
    and give it another try.

    Pete

  3. #3
    Junior Member
    Join Date
    Jan 2016
    Posts
    13
    Yes! Thank you very much, that solved the problem!

    Jonas

  4. #4
    Senior Member adrian's Avatar
    Join Date
    Oct 2015
    Location
    Wellington, NZ
    Posts
    504
    nice pickup...that is a bug!

Posting Permissions

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