FortySevenEffects / arduino_midi_library

MIDI for Arduino
MIT License
1.56k stars 252 forks source link

ESP32S3 Hairless MIDI on Serial #343

Closed copych closed 3 months ago

copych commented 3 months ago

Context

Please answer a few questions to help us understand your problem better and guide you to a solution:

Describe your project and what you expect to happen:

I have tried all the ways of starting a MIDI IN on a Serial 115200 for Hairless MIDI. But no luck. Now I use the current version of the library downloaded from here.

Describe your problem (what does not work):

Steps to reproduce

for example, this code won't compile, nevertheless I have tried variants that compile but MIDI.read() kept quiet.

struct CustomBaudRateSettings : public MIDI_NAMESPACE::DefaultSerialSettings {
  static const long BaudRate = 115200;
};

#if defined(ARDUINO_SAM_DUE) || defined(USBCON) || defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MKL26Z64__)
    // Leonardo, Due and other USB boards use Serial1 by default.
    MIDI_NAMESPACE::SerialMIDI<HardwareSerial, CustomBaudRateSettings> serialMIDI(Serial1);
    MIDI_NAMESPACE::MidiInterface<MIDI_NAMESPACE::SerialMIDI<HardwareSerial, CustomBaudRateSettings>> MIDI((MIDI_NAMESPACE::SerialMIDI<HardwareSerial, CustomBaudRateSettings>&)serialMIDI);
#else
    MIDI_NAMESPACE::SerialMIDI<HardwareSerial, CustomBaudRateSettings> serialMIDI(Serial);
    MIDI_NAMESPACE::MidiInterface<MIDI_NAMESPACE::SerialMIDI<HardwareSerial, CustomBaudRateSettings>> MIDI((MIDI_NAMESPACE::SerialMIDI<HardwareSerial, CustomBaudRateSettings>&)serialMIDI);
#endif

I try to receive midi data from the PC to the ESP32S3 via Hairless MIDI as I used to some time ago, but I can't. I only manage to run classical MIDI IN on a selected RX pin, so I also have to run some kind of a media convertor on a Arduino Micro Pro, which is actually is an unneeded extra in my case.

lathoub commented 3 months ago

You are probably using the Release version (Arduino Lib manager). Using custom baud rates require the latest code (either fork or download the latest)

copych commented 3 months ago

I use the version downloaded from this repo, from the master branch. Is there a 100% working code for an ESP32S3 Hairless Midi on Serial that someone has successfully run on certain versions of IDE and ESP Arduino core? I would reproduce the environment and see if it works for me. BTW, what is the correct Serial name for ESP32s3 board? When I use 'Serial' it ruins during compilation. The best that I could imagine was 'Serial0', this way it compiles but no events received (((

copych commented 3 months ago

@lathoub Update: I have finally managed to run Hairless MIDI. The problem is somewhere in the board definition file(s). I haven't investigated it deeply, but as I have changed the board from the "LOLIN S3 Pro" to the generic "ESP32S3 Dev Module", everything worked fine. Sorry for bothering.