I'm trying to do MIDI in and out on an ESP32 (Wemos mini esp32, with the Arduino SDK). This fails: I'm not receiving any data and also transmitted data is not accepted by any MIDI device (it won't even show up on a Linux device with "amidi -p ... --dump").
The weird thing is, that the some of this setup works fine on an ESP8266 mcu (wemos d1 mini: midi in with the pc817 optocoupler and midi out with a level shifter).
These are the schematics:
Now MIDI in works fine on the ESP8266. I just do Serial.begin(31250, SWSERIAL_8N1); and I can receive all data. This does not work on the ESP32, nothing comes in.
MIDI out I only got to work on the ESP8266 by using a level shifter (like one of these) (and of course 220 ohm resistors as it then uses regular 5v). I then use SoftwareSerial on D5/D6 (D6 connected to the level shifter).
On the ESP32 I tried the schematic shown above, a level shifter and I also tried a transistor. None of them got any data out of it. I tried Serial2.begin(31250, SERIAL_8N1, 16, 17, false); and .begin(31250, SERIAL_8N1, 16, 17, true);