MIDI with SoftSerial on Teensy++ 2.0

Status
Not open for further replies.

dentopt

New member
Hi,
I am currently trying to build a midi switch similar to
https://www.jimkim.de/guitar-projects/arduino-midi-switch/
For this purpose, I am using a Teensy++2.0 that shall be controlled via one MIDI in.
Due to the surrounding design, I cannot use the Teensy's hardware serial.
Instead, a Softserial at Pin F6 shall be used.
Unfortunately, every test with SoftSerial/AltSoftserial to accommodate the
Midi standard (baudrate 312500 = 320µs/symbol) did not work so far.
The electrical signal at the input pin appears to be valid,
wherefore I assume there is some timing issue on the Teensy++2.0 (running at 16Mhz).
I am using the following test:

#include "SoftwareSerial.h"
#define MIDI_LED ((uint8_t)PIN_C3) //LED FX
#define I_MIDI_IN ((uint8_t)PIN_F6) //MIDI1
#define MIDI_PGM_CHANGE 192
SoftwareSerial midiSerial(I_MIDI_IN, I_MIDI_IN);
void setup() {
// JTAG disable for PORT F. write JTD bit twice within four cycles.
MCUCR |= (1 << JTD);
MCUCR |= (1 << JTD);
Serial.begin(9600); // USB is always 12 Mbit/sec for USB connection
pinMode(I_MIDI_IN, INPUT_PULLUP);
pinMode(MIDI_LED, OUTPUT); //LED FX
midiSerial.begin(31250); // Setup serial output (out to MIDI)
delay(100); //Wait startup
}
void loop(){
if (midiSerial.available() > 1) {
/////////////////////////////////////////////////////////////////////////////
//This part is never reached for any midi signal!?
/////////////////////////////////////////////////////////////////////////////
// flash MIDI led
digitalWrite(MIDI_LED, HIGH);
delay(100);
digitalWrite(MIDI_LED, LOW);
}
}

Did anyone ever face this issue?
Thanks in advance for your help!
 
Status
Not open for further replies.
Back
Top