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

Thread: Midi Out with Teensy 3.6

  1. #1
    Junior Member
    Join Date
    Jun 2019
    Posts
    2

    Midi Out with Teensy 3.6

    Hi all! I'm trying to build a midi program changer and I'm trying to get MIDI out working from my Teensy 3.6 before I add more complexity to the design.

    My physical setup involves running TX1 to a 220ohm resistor to pin 5 on a MIDI port. Also running 5v to a 200ohm resistor then to pin 4 on the MIDI port. Finally ground is connected to pin 2 on the MIDI port.

    Below is the code I'm trying to use to test if the signal can be received by my synth, but it isn't working!

    Code:
    #include <MIDI.h>
    
    #define LED 13
    
    MIDI_CREATE_INSTANCE(HardwareSerial, Serial, MIDI);
    
    void setup()
    {
      pinMode(LED, OUTPUT);
      MIDI.begin(MIDI_CHANNEL_OFF);
    }
    
    void loop()
    {
      digitalWrite(LED, HIGH);
      MIDI.sendNoteOn(60, 127, 1);
      delay(1000);
      MIDI.sendNoteOff(60, 0, 1);
      digitalWrite(LED, LOW);
      delay(1000);
    }
    Any thoughts on what might be happening?

  2. #2
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,494
    I guess that you won't see anything when you connect your oscilloscope to the TX1 pin...

    Your code instantiates the wrong serial port. Serial is the virtual serial over USB. The hardware UART on pins 0 and 1 is Serial1.

    Thus write MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, MIDI);

    If that does not yet solve the problem, you should take into account that the logic high voltage of the Teensy 3.x is 3.3V and not 5V as on Teensy 2.x and Arduino. You probably need to reduce the value of the TX1 series resistor from 220R to 180R or even 150R. The midi transport does not work with voltage but with current control and the series resistor has to be dimensioned to let 5mA flow when TX1 is active.

  3. #3
    Junior Member
    Join Date
    Jun 2019
    Posts
    2
    Spot on, it was both! Up and running now, thanks for the quick response!

  4. #4
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,494
    You are welcome!

Posting Permissions

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