Waveshare ESP32S3 MIDI issue on power-up

I've built a very simple project that outputs MIDI CC via a 5 Pin DIN based on a Waveshare ESP32S3. There's another ESP32C3 which has four buttons attached and which sends data to this board via ESP-NOW.

It works perfectly once powered on - no issues. However, when it first powers on it sends a bunch of what MIDI-OX shows as random MIDI messages. For this reason, I power it on before connecting to my TC Electronic Plethora X3 (multi-effect pedal.) This garbage happens without the other ESP32C3 device turned on so it's definitely originating just from this device.


The only connections to the ESP32S3 board are:

  • power in to 5v (a 3.7v LiPo)
  • 3.3v pin out to DIN pin 4 via 220ohm resistor
  • TX pin to DIN pin 5 via 220ohm resistor
  • Ground pin to DIN pin 2 and battery negative

My code is attached as well as a photo of the gadget.

Receiver.ino (1.9 KB)

What am I doing wrong to get this "MIDI garbage" (as I've heard it called) on power-up? Is this normal behaviour that could be remedied by using a relay to only connect the MIDI data line after a delay or should I somehow be clearing the serial buffer?

Espressif chips print some information to the UART when they first start up. You'll have to use a different UART, or map Serial to a different GPIO pin in your setup.

Thanks PieterP! Very helpful.

However, I can not get this thing to send MIDI on anything other than the TX pin. I've tried 17, 13 and 1 and no joy. Am I using the right code?

#define MIDI_TX_PIN 13
MIDI_CREATE_INSTANCE(HardwareSerial, Serial2, MIDI, MIDI_TX_PIN);

void setup() {
 MIDI.begin(MIDI_CHANNEL_OMNI);
}

void loop() {
 //Just an example, I'm not actually this code here!
 MIDI.sendControlChange(94, 127, 1);
}

Right, joy of joys, it turns out that the pins are mislabelled on this board. The following code (simplified here just to show it works) works fine with the MIDI data wire physically connected to pin 2 whilst being defined as pin 4 in the code.

#include <MIDI.h>

// Define UART1 pins based on your ESP32-S3 Mini pinout
#define UART1_TX_PIN 4
#define UART1_RX_PIN 2

// Create a MIDI instance for UART1
MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, MIDI);

void setup() {
  Serial1.begin(31250, SERIAL_8N1, UART1_TX_PIN, UART1_RX_PIN);
  MIDI.begin();
}

void loop() {
  MIDI.sendControlChange(93, 127, 1);
  delay(1000);
}

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