Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3.0 couldn't keep the correct serial port with Arduino Nano ESP32 once RST button is pressed #10025

Open
1 task done
riywo opened this issue Jul 14, 2024 · 18 comments
Open
1 task done
Labels

Comments

@riywo
Copy link

riywo commented Jul 14, 2024

Board

Arduino Nano ESP32

Device Description

Vanilla Arduino Nano ESP32

Hardware Configuration

No GPIO

Version

v3.0.2

IDE Name

Arduino IDE

Operating System

Windows 11

Flash frequency

?

PSRAM enabled

no

Upload speed

115200

Description

I tried to use v3.0.2 of esp32 board manager with Arduino Nano ESP32 but it couldn't keep the correct serial port. Let me describe the repro steps (I'm using Arduino IDE):

  1. Enter the ROM Boot Mode (i.e. firmware download mode, see also this doc)
  2. Select COM11 (ESP32 Family Device)
  3. Upload Using Programmer (Esptool) with AnalogReadSerial example sketch
  4. Press RST button
  5. However, the serial port is still COM11 (ESP32 Family Device) and no output is coming

The only way to work with v3.0.2 is entering Bootloader-mode, then COM12 (Arduino Nano ESP32, Arduino Nano ESP32) is showed up. Once I upload the same sketch without Programmer, serial output works. However, when I press RST button, COM12 is gone and COM11 is back. In other words, the workaround is that using Bootloader-mode whenever I reset the board, that is insane.

This behavior only happens with v3.0 of esp32, though. I checked v2.0.17 of esp32, then RST button correctly keeps COM12 and the serial port is working. Same as the Arduino's Arduino ESP32 Boards, RST keeps COM12.

Sketch

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin 0:
  int sensorValue = analogRead(A0);
  // print out the value you read:
  Serial.println(sensorValue);
  delay(1);  // delay in between reads for stability
}

Debug Message

N/A

Other Steps to Reproduce

Note: When I use Blink sketch, LED properly blinks after RST even though the serial port is wrong (COM11).

Note: When the correct port is showed up (i.e. after uploading with Bootloader-mode), physically reconnecting USB cable still remains the correct port (COM12). However, once I press RST button, it never goes back to COM12 even after reconnecting USB cable again. Bootloader-mode is the only way to recover. => Update: The first half isn't true. It sometimes changes to the wrong port by just reconnecting USB cable.

Note: Also, re-uploading a new sketch when the correct port is showed up doesn't change the serial port. Only pressing RST button triggers this problematic behavior.

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@riywo riywo added the Status: Awaiting triage Issue is waiting for triage label Jul 14, 2024
@me-no-dev
Copy link
Member

cc @pillo79

@pillo79
Copy link
Contributor

pillo79 commented Jul 15, 2024

@riywo thanks for the detailed report! We will try to investigate and let you know.

@riywo
Copy link
Author

riywo commented Jul 16, 2024

@pillo79 Please let me know if any more data you need from my board for your further investigation. This issue is pretty annoying to me as I can't run my sketch on Arduino Nano ESP32 without USB serial connection (USB battery won't work). I really want to workaround this issue.

BTW, the reason why I want to use v3.0 is the new I2S library. It's cool!

@riywo
Copy link
Author

riywo commented Jul 16, 2024

Another finding if it helps: I tried to use 5V VIN today.

  • When I powered on the 5V battery, my sketch didn't start
  • Then, when I plugged USB cable with Arduino IDE, my sketch did start automatically
  • Then, once I pressed RST, the port was gone like above (COM11) and my sketch never started
  • Then, I reconnected USB cable and my sketch restarted as well as the port was back normal (COM12)!
  • Then, I unplugged USB cable and my sketch kept running!!

So, by this way, I could use this board without USB serial somehow (Power on 5V VIN, plug USB serial then unplug). Hope this helps the investigation...

@pillo79
Copy link
Contributor

pillo79 commented Jul 16, 2024

Thanks for these updates! I see you are referring to multiple ways of powering the board - does this issue happen also in the simplest case, with a Blink sketch and no electronics attached except for the USB-C cable powering the board?
If this is true I would concentrate on this situation since it is much easier to replicate.

I tried to do so in Linux using IDE 2.3.2, ESP32 core rev 3.0.2 and FQBN esp32:esp32:nano_nora, but I could not: a single "Upload with programmer" here does result in a correct flash and the DFU works just after the first reset (so it would have been detected as your COM12, if I understand correctly).

I am not very skilled in Windows issues. I have escalated this internally so someone can try and replicate on a Windows machine. We haven't yet completed these tests for 3.0, so for the time being we still advise Nano ESP32 users to hold on 2.0.x (2.0.17 will soon be released!) for stability. But thanks for being on the bleeding edge and providing feedback!

@riywo
Copy link
Author

riywo commented Jul 16, 2024

@pillo79 Thank you for your investigation! Yes, it happens with the simplest case:

  • Environment
    • Windows 11
    • Arduino IDE 2.3.2
    • esp32 board manager 3.0.2 (I guess FQBN is esp32:esp32:nano_nora, too)
    • Only USB-C cable is connected (no VIN)
esptool.py v4.6
Serial port COM11
Chip is ESP32-S3 (revision v0.2)
Features: WiFi, BLE
Crystal is 40MHz
  • Symptom
    1. Enter the ROM Boot Mode (i.e. firmware download mode, see also this doc)
    2. Select COM11 (ESP32 Family Device)
    3. Upload Using Programmer (Esptool) with the Blink.ino example sketch
    4. Press RST button
    5. However, the serial port is still COM11 (ESP32 Family Device)
      • Note: Built-in LED is blinking, though

I have Raspberry Pi 5, so let me try Linux later!

@JAndrassy
Copy link
Contributor

and if you then do a normal upload from IDE?

@riywo
Copy link
Author

riywo commented Jul 16, 2024

@JAndrassy Thank you for the suggestion. 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

Screenshot 2024-07-16 102428

@riywo
Copy link
Author

riywo commented Jul 16, 2024

Arduino IDE 2 doesn't support ARM, so I couldn't try Linux on Raspberry Pi. Thus, I tried macOS Apple Silicon instead. In summary, it worked well, so the problem looks like happening only on (my) Windows.

  • Environment
    • macOS 14.5
    • Apple Silicon M1 Pro
    • Arduino IDE 2.3.2
    • esp32 v3.0.2
    • USB-C cable only
  • Symptom
    • Enter the ROM Boot Mode (i.e. firmware download mode, see also this doc)
    • Select /dev/cu.usbmodem112101 (ESP32 Family Device)
    • Upload Using Programmer (Esptool) with the Blink.ino example sketch
    • Press RST button
    • Now, the previous port disappeared and a new one /dev/cu.usbmodem744DBDA24DA42 (Arduino Nano ESP32) showed up
    • Once I switched Arduino IDE to the new port, of course I can normally upload the sketch as well as RST button properly resets and the same serial port remains working well

@JAndrassy
Copy link
Contributor

and on Windows you can do a normal upload to COM12 after you uploaded Blink with esptool?

@riywo
Copy link
Author

riywo commented Jul 16, 2024

Sure as long as COM12 is active. The problem is that whenever I press RST or reconnect USB-C cable, it goes back to COM11 and I need to enable Bootloader-mode (press RST twice) that activates COM12 then I need to re-upload the same sketch again.

@JAndrassy
Copy link
Contributor

after the reset/reconnect normal upload to COM11 doesn't work?

@riywo
Copy link
Author

riywo commented Jul 17, 2024

No, never. COM11 can only work with ROM Boot Mode but normal upload won't work.

@DonWT
Copy link

DonWT commented Aug 31, 2024

I see the same problem on my Win11 computer using the Arduino IDE 2.3.2 and both a Nano ESP32 and a Waveshare clone of the Nano ESP32 (a Waveshare ESP32-S3-Nano) and version 3.0.3 of the Espressif esp32 board manager.

If I configure the board to use the Arduino ESP32 Boards version 2.0.13 board manager then I do not see this problem.

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

  1. Compiles and uploads OK, flashes LED and prints 'Here' every two seconds.

  2. Press reset and the board disconnects briefly then reconnects and works the same as in 1.

  3. Disconnect and reconnect the USB cable and the board restarts and works the same as in 1.

  4. 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

  1. Compiles and (normal) uploads OK, flashes LED and prints 'Here' every two seconds.

  2. 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

  3. (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.

@dquadros
Copy link

Just saying that I got the same problem.

Arduino uses the DFU mode for upload, if you download to the Nano ESP32 a program compiled with the Espresif package, after you unplug and replug the board, there is a "USB JTAG debug unit" instead of the DFU device and the COM port does not work. If you change the USB Mode to Debug Mode (Hardware CDC) the COM port works (but you do not have the DFU device, so normal download cannot be used).

@dquadros
Copy link

I tried to do so in Linux using IDE 2.3.2, ESP32 core rev 3.0.2 and FQBN esp32:esp32:nano_nora, but I could not: a single "Upload with programmer" here does result in a correct flash and the DFU works just after the first reset (so it would have been detected as your COM12, if I understand correctly).

Just tried under Linux Mint 22, IDE 2.3.3. ESP32 core 3.0.5. board "Arduino Nano ESP32" and reproduced the problem: "No DFU" when trying to upload the Blink sketch (after successfully uploading using the "upload with programmer"). Using the "Arduino ESP32 boards" package it worked fine (but I had to set up a udev rule, as stated on https://forum.arduino.cc/t/upload-on-linux-fails-no-dfu-capable-usb-device-available/1252666/3).

I noticed that the VID/PID is different (2341/0070 for Aduino, 303a/1001 for Espressif) and tried a udev rule using the Espressif vid/pid but it made no difference.

@pillo79
Copy link
Contributor

pillo79 commented Sep 26, 2024

Just tried under Linux Mint 22, IDE 2.3.3. ESP32 core 3.0.5. board "Arduino Nano ESP32" and reproduced the problem: "No DFU" when trying to upload the Blink sketch (after successfully uploading using the "upload with programmer").
[...]
I noticed that the VID/PID is different (2341/0070 for Aduino, 303a/1001 for Espressif) and tried a udev rule using the Espressif vid/pid but it made no difference.

@dquadros thanks for the feedback. Did the "Upload using programmer" use esptool or DFU? Also, just to confirm, exactly when is the VID/PID different in your case?

@dquadros
Copy link

@dquadros thanks for the feedback. Did the "Upload using programmer" use esptool or DFU? Also, just to confirm, exactly when is the VID/PID different in your case?

The "Upload using programmer" uses esptool.

There are two packages that support the Arduino Nano ESP32 board:

  • "Arduino ESP32 boards" by Arduino: this is based on a old version of arduino-esp. DFU works when this is used and the board shows up with VID=2341 and PID=0070
  • "esp32" by Espressif: DFU is not available when this is used and the board shows up with VID=303a and PID=1001

Hope this helps to identify the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants