Midi Out over Din-5 and Serial Midi BAUD Problem

I have a "Simple" Midi Controller Setup that works with an Ardu Mega and spits out
Midi CC messages over USB Serial Midi. - everything fine

but I wish I could have a Din Midi Port connected at TX for Midi Output and use the
Serial Out too.

My main concern is now that Midi over Din runs at a Baudrate 31250 and the Serial
USB at 115000 or whatever I set the Serial to.

Is there a way to set this up without using a second microcontroller that handles the
one and the Mega handles the other?

cheerz
de Heavy

On a Mega you have 4 serial ports. They can be set to different baud rates.

Steve

Hello Steve, that sounds interesting... how do I do that?
and how do I output that ?
is there anything more to read about?

If I could see your code I might be able to help you with what to add and where. But basically for the DIN MIDI connection use Serial1 instead of Serial. Connect the MIDI circuit to pins 19 and 18 instead of 0 and 1. You'll finfd information about the serial ports at Serial - Arduino Reference Follow the begin() link down the page for a simple example showing using the various serial ports on a Mega.

Steve

Thanx Steve, it's exactly what I was missing.

I have to test this and change my circuit - 18 and 19 are blocked by some LEDs at the moment but I can change that.

I 'll come back If I encounter some problems.

Thanx for your time and help.
Cheerz de Heavy

Hey Steve,
I would like to inform you that everything worked great - thx again for your help.

cheerz
de Heavy

To clarify what I said in our private conversation, you can use two MIDI interfaces, one USBSerialMIDI_Interface to communicate over USB using the “Serial” object, and one HardwareSerialMIDI_Interface to output over DIN.
Then connect them both to Control Surface using a MIDI pipe, as shown in the [Dual-MIDI-Interface.ino[/tt] example:

#include <Control_Surface.h>
 
// Create two MIDI interfaces
USBSerialMIDI_Interface usbmidi {115200};
HardwareSerialMIDI_Interface dinmidi {Serial1, MIDI_BAUD};
 
// Create a MIDI pipe factory to connect the MIDI interfaces to Control Surface
BidirectionalMIDI_PipeFactory<2> pipes;
 
// Add some MIDI elements to show that the MIDI interfaces actually work
CCPotentiometer pot = {A0, MIDI_CC::General_Purpose_Controller_1};
NoteValueLED led = {LED_BUILTIN, 0x3C};
 
void setup() {
  // Manually connect the MIDI interfaces to Control Surface
  Control_Surface | pipes | usbmidi;
  Control_Surface | pipes | dinmidi;
  // Initialize Control Surface _after_ connecting the interfaces
  Control_Surface.begin();
}
 
void loop() {
  Control_Surface.loop();
}

Pieter](Control Surface: Dual-MIDI-Interface.ino)

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.