Port disappears when restoring board after using IDE debugger

Continuing the discussion from Debugging on the new Nano ESP32:

I tried following the debugging guide, but it does not reliably work on my setup (Ubuntu 23.04, Arduino IDE 2.2.1, Arduino ESP32 Boards 2.0.12).

First time trying to upload with the programmer gives an error and the "cube" port disappears.

Sketch uses 867937 bytes (27%) of program storage space. Maximum is 3145728 bytes.
Global variables use 45900 bytes (14%) of dynamic memory, leaving 281780 bytes for local variables. Maximum is 327680 bytes.
esptool.py v4.5.1
Serial port /dev/ttyACM0
Connecting.............

A serial exception error occurred: write failed: [Errno 19] No such device
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

Trying to upload with the programmer again works.

Once I succeeded in uploading using the programmer and launched the debugger, I got the message:

Open On-Chip Debugger v0.11.0-esp32-20221026 (2022-10-26-14:47)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
CDRTOSConfigure
Info : only one transport option; autoselect 'jtag'
Info : esp_usb_jtag: VID set to 0x303a and PID to 0x1001
Info : esp_usb_jtag: capabilities descriptor set to 0x2000
Warn : Transport "jtag" was already selected
Info : Listening on port 50001 for tcl connections
Info : Listening on port 50002 for telnet connections
Error: libusb_open() failed with LIBUSB_ERROR_ACCESS
Error: esp_usb_jtag: could not find or open device!

Pressing the button twice does not place the device in the mode that displays the two port options (DFU mode).

Getting back to normal uploading I first have to select "Tools -> USB Mode -> Normal mode" then upload again using the programmer. After that upload the "cube" port appears again and the board can be programmed with the normal upload.

Hello @calint and welcome to the forums!

That is because before an "Upload using programmer" you should do the "short B1 with GND, press RESET" dance. If you don't do that then this can happen - it's harmless but annoying :slight_smile:

Thank you, this is an important addition for the debug document. The device is now a generic ESP32-S3 and your Linux user may not have the authorization to connect.
To fix this, you can copy this file in your /etc/udev/rules.d/ folder (as root) and try again.

This is strange! Easiest advice: try double-tapping a little slower - to be effective, the second press should arrive while the lights are fading.

Thank you. It works a lot better now, and debugging is possible. But there are some issues.

The "double click" seems to be a bit tricky because the second click has to be after the LED turns from reddish to fading green. If done right, the board sets the LED to green.

The first step, "Upload using programmer", is still problematic. The first try fails, but the second try works.

The debugging step works, but I have to start the debugger from the debugger pane because the round button is grayed out, saying no board is selected (although it is).

Returning from the debugger mode to regular upload works when the tricky double click is applied.

Kind regards!

If you are using the Nano ESP in a breadboard then try bringing the Boot (B1) and Reset pins out to push buttons connected to ground. This makes all of the button pushing required much easier.

Thanks for the tip!

I don't have a breadboard.

The tricky double tap is reliable once knowing how to do it.

Kind regards!