I am buying both a NanoESP32 and an Espressif ESP32-S3 dev board and comparing... The ESP32-S3 is 3/4 the price and no-name ones are less than half....
I like the Teensy 4.1 the best out of all MCUs, but it doesn't have wireless. (BTW support for Teensy seems even a notch up from Arduino to me) I am trying to avoid adding a display screen and buttons on my project. A hot spot that you could connect to with a configuration page seems the cleanest approach. Obviously an all-in-one processor would be best... I could always pair a second MCU with wireless capabilities (older ESP32's are <$9), but that makes upgrading significantly more difficult (either don't provide an update method for the wireless portion, or somehow put two USB ports on the side of the unit...). I guess I could always minimize the functionality in wireless portion and have the Teensy push that over...
Anyway, I greatly appreciate your response. I will probably be trying to get the USB MIDI operational next week on the NanoESP32 and the Espressif ESP32-S3...
@jhaimerl I agree with you about Teensy's support but I really wanted BLE MIDI.
Another board showed up recently based on the ESP32 S3R8 chip, a new chip with a much smaller footprint than the regular ESP32 S3. A Chinese board maker called Waveshare has released an "ESP32-S3-Nano" which they claim to be compatible with the Arduino Nano ESP32, see:
I have not tried one of these but the pinout looks to be the same, it does have a different antenna, not sure about the rest of the board.
My Chinese Arduino Nano ESP32 came a little while ago. I was able to get a couple simple programs working relatively quickly, but I can't get it to work with Adafruit_TinyUSB... Either your code or the example they provide... Keep getting a "CDC" related error on compile... I have tried the other option under the Tools menu ... USB Mode -> Normal Mode (TinyUSB) and Debug Mode (Hardware CDC). Both return same errors... This is the first compiler error in the long string:
/Users/josephhaimerl/Documents/Arduino/libraries/Adafruit_TinyUSB_Library/src/device/usbd.c:120:10: error: 'usbd_class_driver_t' {aka 'const struct '} has no member named 'name'
.name = DRIVER_NAME("CDC"),
I dropped back to Adafruit_TinyUSB 2.40 and used your exact code and NOW it compiles... Also tested that it works with Ableton Live....
Not sure why most recent Adafruit library causes compile errors.
My Chinese Arduino Nano ESP32 came a little while ago.
What did you buy? Was it one of the Waveshare boards?
I dropped back to Adafruit_TinyUSB 2.40 and used your exact code and NOW it compiles... Also tested that it works with Ableton Live....
Not sure why most recent Adafruit library causes compile errors.
I raised this as a bug months ago and it has not been fixed or even acknowledged. The developer was not interested in even trying to compile that tiny program.
@ptillisch The Adafruit TinyUSB library for midi has been broken for months but jhaimerl prompted me to try my Arduino Nano ESP32 on the following code:
When I try to compile this code using the Arduino Nano ESP32 Arduino ESP32 Boards for my board then it fails with:
"Compilation error: USBMIDI.h: No such file or directory"
When I use the Arduino Nano ESP32 esp32 for my board then it compiles and runs correctly.
It would be really good to have a working USB midi board using the Arduino board especially as the TinyUSB library is no longer usable for midi. TinyUSB 2.40 was the last version that I have been able to use on the Arduino Nano ESP32, all of the versions since then have either failed to compile or failed to connect after an upload.
Nice! I see it was added to the "esp32" boards platform in the 3.0.0 release:
The "Arduino ESP32 Boards" platform is a fork of the "esp32" platform, but unfortunately we haven't had the resources to keep it synced with the recent work on the "esp32" platform, so the fork is still at the 2.0.13 point in the "esp32" platform development history, some months behind the time when the USB MIDI support was added to the "esp32" platform.
Fortunately the "esp32" platform also supports the Nano ESP32 board, so the solution you discovered of simply using the latest "esp32" platform instead of the "Arduino ESP32 Boards" platform is perfectly valid.
So I have an ESP32S3-WROOM-1 and a Donner N-25 mini midi keyboard that I found on Amazon. I wanted to replicate your MIDI readings on my windows 10 machine, but when I tried to run your code, I got this message on my serial monitor:
Now, what I did was I plugged in my MIDI keyboard to the left usb c port on the esp32, and I plugged in my COM port on my PC to the right usb c port. Is there anything hardware wise that I have to plug in? Or else, am I replicating your hardware setup correctly?
My main goal is to be able to play notes on my keyboard and process them to the esp32. Then from there, I want the esp32 to connect to a bluetooth speaker and output audio that way. Please let me know if you see any issues with this setup.
I hardly know where to begin in answering your post as what you are trying to do is very different from what I am doing and what my little code sample does.
When you say that you have an ESP32S3-WROOM-1 then I assume that you mean that you have one of the various Chinese development boards that incorporate an ESP32S3-WROOM-1 and that have two USB-C sockets. If so, then these boards are quite difficult to configure but more importantly you cannot connect two midi over USB cables to the two sockets.
One socket is labelled (maybe underneath the board) as COM and the other as USB. Only the port labelled USB can be used for USB midi. With a bit of hardware finagling, and a lot of software finagling, you might be able to add another USB port to the board that could support USB midi, but doing that is way above my pay grade!
I think that my answer so far probably means that you cannot do what you want to do with an ESP32S3-WROOM-1 development board.
You say:
My main goal is to be able to play notes on my keyboard and process them to the esp32. Then from there, I want the esp32 to connect to a bluetooth speaker and output audio that way. Please let me know if you see any issues with this setup.
You would need to implement a midi synthesizer on the ESP32 to achieve this - not a trivial task!
Have you considered simply plugging your keyboard into a phone running a synth app and then getting the phone to output to a bluetooth speaker?
It can't upload through COM11 because "USB DFU" isn't working properly? (I can't see something like "2-5 USB DFU" with COM11 while there is with COM12):
Sketch uses 325557 bytes (10%) of program storage space. Maximum is 3145728 bytes.
Global variables use 30696 bytes (9%) of dynamic memory, leaving 296984 bytes for local variables. Maximum is 327680 bytes.
dfu-util 0.11-arduino4
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
No DFU capable USB device available
Failed uploading: uploading error: exit status 74
If you just do a normal upload via the serial port instead of all that stuff with grounding the B1 pin and doing an "Upload Using Programmer", then there should be no problem.
I just tried it out with the sketch you shared in post #28, with version 3.0.3 of the "esp32" boards platform, and the port number does not change after I reset the Nano ESP32 board. The MIDI messages are sent just as expected.
So are you doing a normal upload to the Nano ESP32 board, or are you using some alternative upload procedure?
@ptillisch I don't think that I am doing anything unusual. I used the standard 'Blink' sketch with an added Serial.println statement:
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(115200);
delay(2000);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
Serial.println("Here");
}
I am using a 'bare' Arduino Nano ESP32 with no additional circuitry. I am using the Arduino IDE 2.3.2 on a Windows 11 computer.
Arduino ESP32 Boards by Arduino:
Compile and (normal) upload with the board set to 'Arduino Nano ESP32' using the 'Arduino ESP32 Boards' version 2.0.13
Compiles and uploads OK, flashes LED and prints 'Here' every two seconds.
Press reset and the board disconnects briefly then reconnects and works the same as in 1.
Disconnect and reconnect the USB cable and the board restarts and works the same as in 1.
Redo the compile and upload without going into boot mode and, again, it works the same as in 1.
All as expected.
esp32 boards by Espressif:
Compile and upload with the board set to 'Arduino Nano ESP32' using the 'esp 32 boards' version 3.0.3
Compiles and (normal) uploads OK, flashes LED and prints 'Here' every two seconds.
Press reset and the board disconnects and stays disconnected, LED flashes but no serial prints. Notifications say: Port monitor error: command 'open' failed: Serial port not found. Could not connect to COM4 serial port.
Compile and upload now fails with: No DFU capable USB device available Failed uploading: uploading error: exit status 74
(I needed to double press the reset button to get it to compile and upload.)
Disconnect and reconnect the USB cable and the board restarts, the LED flashes but, again, it fails to connect so there are no serial prints. Same notifications as in 2. Again, I need to double press the reset button to go into boot mode before I can compile and upload again.
I can live with this for development because I want to use the new midi libraries in the Espressif board manager, but I hope that this behavior does not appear when Arduino migrates to the new Espressif board manager.
Great idea to eliminate the MIDI stuff as a potential factor!
I gave it a try, but was not able to reproduce the fault.
After you do this, if you open Arduino IDE's Tools > Port menu, is there a port listed for the board? If so, is the port labeled as "Arduino Nano ESP32" (e.g., "COM5 (Arduino Nano ESP32)"), or as "ESP32 Family Device" (e.g., "COM5 (ESP32 Family Device)"), or labeled as something else, or not labeled at all (e.g., "COM5")?
COM4 is the device that was connected. I tried connecting to COM7 but it failed with:
Port monitor error: command 'open' failed. Invalid serial port. Could not connect to COM7 serial port
A few days ago I tried to fire up the debugger, which did not work, but I wonder if doing so messed things up in some way. I have Esptool set as my Programmer, but I don't see a way to change this:
Could this be a problem?
I am thinking of reinstalling the IDE, maybe to the earlier version that does support the debugger for the Nano ESP32.
Added later:
I uninstalled 2.3.2 and installed 2.2.1 and get exactly the same results. I noticed that all of the IDE settings I had in 2.3.2 also showed up in 2.2.1 - which surprised me as I expected an uninstall to remove everything.
Also, I can repeatedly compile and upload without having to go into boot mode as long as I do not press reset or disconnect the USB cable.
@ptillisch One further thing I noticed is that Windows has a 'Safely Remove Hardware and Eject Media' icon showing in the taskbar when I reconnect the Nano ESP32. Clicking on this shows:
I am not trying to use the debugger but looking at this post of yours it seems that the IDE thinks that I am in debug mode: