Platform Information
Hardware
Board: Arduino Nano ESP32, Chip: ESP32-S3
Linux OS
PRETTY_NAME = "Ubuntu 24.04 LTS"
NAME = "Ubuntu"
VERSION_ID = "24.04"
VERSION = "24.04 LTS (Noble Numbat)"
Arduino SW Version
>> arduino-cli version
arduino-cli Version: 0.35.3 Commit: 95cfd654 Date: 2024-02-19T13:24:24Z
Problem
I am having trouble uploading code to an Arduino Nano ESP32 using arduino-cli. At some point I was able to upload code but it stopped working, I don't know what I did to make this not work. Currently, it has a simple blink code loaded on to the board.
When it is working, it will display what I believe is the correct board in the board list. However, I'm unsure of the USB DFU listing (In the past I was getting an error associated with USB DFU, maybe it's related).
>> arduino-cli board list
Port Protocol Type Board Name FQBN Core
1-2.3 dfu USB DFU Arduino Nano ESP32 esp32:esp32:nano_nora esp32:esp32
/dev/ttyACM1 serial Serial Port (USB) Arduino Nano ESP32 esp32:esp32:nano_nora esp32:esp32
When I try to upload new code I get this error:
esptool.py v4.5.1
Serial port /dev/ttyACM1
Connecting.............
A serial exception error occurred: Could not configure port: (5, 'Input/output error')
Note: This error originates from pySerial. It is likely not a problem with esptool, but with the hardware connection or drivers.
For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html
Failed programming: uploading error: exit status 1
After the failed upload, the board listed changes from nano_nora to lolin_c3_mini:
>> arduino-cli board list
Port Protocol Type Board Name FQBN Core
/dev/ttyACM1 serial Serial Port (USB) LOLIN C3 Mini esp32:esp32:lolin_c3_mini esp32:esp32
If I try uploading again (without pressing reset button), I get this error where it can't find the port:
esptool.py v4.5.1
Serial port /dev/ttyACM1
A fatal error occurred: Could not open /dev/ttyACM1, the port doesn't exist
Failed programming: uploading error: exit status 2
The port /dev/ttyACM1 exists in /dev/:
>> ls /dev/ttyA*
/dev/ttyACM1
When I push the reset button on the board, the code begins running again (a blinking light and serial print), and the arduino-cli board lists nano_nora again.
Things I've tried
-
Changing USB Cable.
-
Pressing the reset button on the board.
-
Pressing reset button on board while
Connecting...is displayed on console. -
Completely un- and re-installing
arduino-cli(including removing~/.arduino15directory). -
Un- and re- installing
esp32:esp32forcing the post_install after run:arduino-cli board install esp32:esp32 --run-post-install -
Updating
arduino-clicores (was already up to date)>> arduino-cli core upgrade All the cores are already at the latest version
My simple program
#include <Arduino.h>
#include <Wire.h>
int out_pin0 = 5;
int out_pin1 = 6;
void setup()
{
pinMode(out_pin0, OUTPUT);
pinMode(out_pin1, OUTPUT);
}
void loop()
{
Serial.println("blink!");
digitalWrite(out_pin0, 1);
digitalWrite(out_pin1, 0);
delay(250);
digitalWrite(out_pin0, 0);
digitalWrite(out_pin1, 1);
delay(250);
}