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

Thread: Midi IN interface for Teensy 3.2 Midi Data Issue

  1. #1

    Midi IN interface for Teensy 3.2 Midi Data Issue

    Hi,
    I am wondering if anyone can help, I been working in a MIDI interface for my Drum Machine project but I have hit an issue with the MIDI in Interface I am building. The Midi out works a treat but the Midi In I am getting lots of messages but i don't seem to see Note ON and Note OFF just lost of type 252 and 224 midi messages. I have highlighted the messages where I did start to press the keys on my keyboard, and there seem to be some other messages coming through. I am using the circuit design from from https://www.pjrc.com/teensy/td_libs_MIDI.html and the code example.
    Code:
    #include <MIDI.h>
    
    MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, MIDI);
    
    void setup() {
      MIDI.begin(MIDI_CHANNEL_OMNI);
      Serial.begin(57600);
      Serial.println("MIDI Input Test");
    }
    
    unsigned long t=0;
    
    void loop() {
      int type, note, velocity, channel, d1, d2;
      if (MIDI.read()) {                    // Is there a MIDI message incoming ?
        byte type = MIDI.getType();
        switch (type) {
          case midi::NoteOn:
            note = MIDI.getData1();
            velocity = MIDI.getData2();
            channel = MIDI.getChannel();
            if (velocity > 0) {
              Serial.println(String("Note On:  ch=") + channel + ", note=" + note + ", velocity=" + velocity);
            } else {
              Serial.println(String("Note Off: ch=") + channel + ", note=" + note);
            }
            break;
          case midi::NoteOff:
            note = MIDI.getData1();
            velocity = MIDI.getData2();
            channel = MIDI.getChannel();
            Serial.println(String("Note Off: ch=") + channel + ", note=" + note + ", velocity=" + velocity);
            break;
          default:
            d1 = MIDI.getData1();
            d2 = MIDI.getData2();
            Serial.println(String("Message, type=") + type + ", data = " + d1 + " " + d2);
        }
        t = millis();
      }
      if (millis() - t > 10000) {
        t += 10000;
        Serial.println("(inactivity)");
      }
    }
    I have tested the continuity and checked the wiring path are correct, even check that the Opto is switching then power applied to the input.
    checked the voltages values are correct and getting to the correct places. even reproduced this on a breadboard with the same results.
    i have updated my Arduino IDE 1.8.9 and Teensy installer to 1.46 to see if that made a difference but with no luck.
    I am at a loss so any ideas or help would be greatly appreciated.

    Click image for larger version. 

Name:	diagram.PNG 
Views:	8 
Size:	15.7 KB 
ID:	16634
    Click image for larger version. 

Name:	PCB Full.PNG 
Views:	4 
Size:	17.9 KB 
ID:	16635
    Click image for larger version. 

Name:	20190515_090208.jpg 
Views:	10 
Size:	90.9 KB 
ID:	16637
    Click image for larger version. 

Name:	20190515_090208.jpg 
Views:	10 
Size:	90.9 KB 
ID:	16637
    Click image for larger version. 

Name:	PCB Current Flow.PNG 
Views:	1 
Size:	21.5 KB 
ID:	16636
    Click image for larger version. 

Name:	20190515_090232.jpg 
Views:	7 
Size:	73.9 KB 
ID:	16638
    Click image for larger version. 

Name:	Inkedoutput_LI.jpg 
Views:	4 
Size:	62.2 KB 
ID:	16639

  2. #2
    Member
    Join Date
    Mar 2014
    Location
    New Ulm, Mn
    Posts
    29
    I don't see anything obvious.

    You might want to try the 10k on pin 7 as suggested on the page from where you got the circuit. I'm using a simpler circuit ( ubuild.it breakout board ) that doesn't have a lot of the precautions in the circuit you're referencing and it works for me.

    Also check and make sure what you're sending with is working! It may seem elementary but it's worth checking everything ( you know, like moon phase., etc )

  3. #3
    Member
    Join Date
    Mar 2014
    Location
    New Ulm, Mn
    Posts
    29
    Click image for larger version. 

Name:	ublditmidi01.jpg 
Views:	5 
Size:	191.7 KB 
ID:	16641
    Click image for larger version. 

Name:	ublditmidi02.jpg 
Views:	3 
Size:	141.4 KB 
ID:	16642

    Thought I'd send pics because the T3.1 or 3.2 fits in between the jacks so nicely...

    Your data suggests random pitch bend and stop clock commands. I suspect this is garbled, but to be sure, check this output from your connected device with any other tool you might have.

    I've heard of diodes out of spec causing garbling problems but to be honest , that's a reach.

  4. #4
    Thnak you for taking the time to respond ETMoody3.
    I checked the soure using MidiOX and it looks all good
    Click image for larger version. 

Name:	midi ox.PNG 
Views:	0 
Size:	16.0 KB 
ID:	16643
    I tried also tried adding the 10k on pin on 7 with no luck.
    I know its going to be somthing really simple but just cant see it.

    Thanks again

Posting Permissions

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