Midi IN interface for Teensy 3.2 Midi Data Issue

Status
Not open for further replies.

StretchMasterP

New member
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.

diagram.PNG
PCB Full.PNG
20190515_090208.jpg
20190515_090208.jpg
PCB Current Flow.PNG
20190515_090232.jpg
Inkedoutput_LI.jpg
 
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 )
 
ublditmidi01.jpg
ublditmidi02.jpg

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.
 
Thnak you for taking the time to respond ETMoody3.
I checked the soure using MidiOX and it looks all good
midi ox.PNG
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 :)
 
Status
Not open for further replies.
Back
Top