Failing to send MIDI via TX1 on Teensy 3.2

Status
Not open for further replies.

loveaurell

Well-known member
Hi, I'm trying to build a MIDI controller and started by using this example for reference:
https://www.pjrc.com/teensy/td_libs_MIDI.html

Everything runs fine on the teensy but I get no input signals in my MIDI interface when connecting it to the midi output of my teensy circuit. The interface is working fine with other equipment.

Is there some way to actually check that the TX1 pin is sending the data? When measuring the voltage it seems to be changing at the same speed as the delay values so I guss something is wrong with my circuit. I've tried with 220ohm as well as 47 as mentioned in this thread:
https://forum.pjrc.com/threads/3220...9-Or-is-it-really-only-Serial1?highlight=midi

Any suggestions on how to proceed?
 
A simple oscilloscope will tell you the truth... :)

Unfortunately I don't have one available at the moment. I'm about to buy one, but there's a lot of them to choose from and I haven't been able to decide which one that will suit my needs.

Is there another way to check for activity on the TX pins?
 
Last edited:
The messages that are transmitted seems to alter the voltage around 0.03 volt. It's altering between ~3.343 V and ~3.340V. Is that change to small for the midi interface to recognize? If so, how should I increase the distance between those values?
 
Since midi signals are a quick series of pulses going from ~3.3V to 0V and back, measuring dc levels is absolutely not an option. If 7 midi bits are transmitted at 31250Hz baud rate during the 20ms integration period of your digital multimeter, this might change temporarily the shown value by -(7/625) or -1.12%. But that is not at all a proof that the midi pulses are transmitted at the correct level and with the correct timing. Go and buy an oscilloscope or a logic analyser. A cheap one like this which I use all the time for audio and midi debugging and much more will be fine.
 
As a quick hack, you could try connecting a really bright LED. That's a poor substitute for a scope, but better than a low responding voltmeter.
 
Thanks for the suggestions! Unfortunately I have no spare Teensy, and just ordinary LEDs, but I'll try and see if they give enough feedback anyway.
 
One thing crossed my mind. The midi specification uses 5V. The tx1 on the teensy 3.2 is at 3.3V. I haven't found any info on what voltage the earlier versions of teensy are using on the tx pins but I suspect that they are at 5V? Could this be the problem? And if so, will it work if I increase the signal to 5V building a boost converter?
 
MIDI uses a current loop, which causes a IR LED inside the receiver to couple the signal. The current is what matters, not the voltage.

With only 3.3V, the resistors need to be lowered, to get a similar current.
 
I finally got it sending data. I had the midi jack facing the wrong way (I interpreted the diagram as if the front was facing upwards). Now I get Midi Monitor to recieve the messages, but it tells me they are invalid. I can see the values are increasing, so I must be on the right track at least. Here are some pictures:

IMG_1407.jpg
Skärmavbild 2016-01-07 kl. 19.37.24.png

And some code from the example:
Code:
#include <MIDI.h>

const int channel = 1;

void setup() {
  MIDI.begin();
  Serial.begin(38400);
}

void loop() {
  int note;
  for (note=10; note <= 127; note++) {
    MIDI.sendNoteOn(note, 100, channel);
    Serial.println(note);
    delay(200);
  }
  delay(2000);
}
 
By default, I think the MIDI library uses "running status" and perhaps your receiving program might not be able to decode handle it which would explain why only the note number and the velocity are being printed.
Edit MIDI.h and at about line 48 turn running status off, like this:
Code:
#define USE_RUNNING_STATUS		0			// Running status enables short messages when sending multiple values

Pete
 
By default, I think the MIDI library uses "running status" and perhaps your receiving program might not be able to decode handle it which would explain why only the note number and the velocity are being printed.
Edit MIDI.h and at about line 48 turn running status off, like this:
Code:
#define USE_RUNNING_STATUS		0			// Running status enables short messages when sending multiple values

You are right! At last I'm getting valid messages. Thank you! I find it confusing that a software called "Midi monitor" fails to read all sorts of standard messages. Hopefully my Roland MKS-50 can read running status.
 
Wow Pete, thanks for that ...I had completely forgotten about running status and status bytes... A good reminder ....PS ...MidiOx works fine in running status and provides a lot of great info and tools ..... ...I never paid enough attention to pick up the running status thing (i.e. it just works in MIDIOX) so its great to be reminded of MIDI 101 ...and it is VERY VERY strange to have a midi monitor that returns 'invalid' for 'normal' midi messages.... another great pickup .... !!!
 
Status
Not open for further replies.
Back
Top