Unable to Debug Nano ESP32

I've followed the official debug guide and tried two different boards, but cannot get them to debug. The error I get is:

A serial exception error occurred: Cannot configure port, something went wrong. Original message: PermissionError(13, 'A device attached to the system is not functioning.', None, 31)
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

Environment:

  • Arduino IDE 2.3.4,
  • Windows 11 Pro,
  • Arduino ESP32 boards 2.0.18-arduino.5 (which doesn't seem to exist on Github?!).

There have been some results after a search regarding USB drivers, but mentions ESP8266. Any one managed to get it to work?

On further investigation, it seems the only way to get the device to show 'USB TAG/serial debug unit' is using Method 1 using a cable. Method 2, never works even though slow green fading is happening on the device.

Unfortunately, now when I run Blinky, it's not possible to get a breakpoint to work. When starting the debug session the following happens:

  • PAUSED ON ATTACH,
  • Press 'run',
  • PAUSED ON USER REQUEST - I'm assuming this is the main() function, but it seems to be unable to resolve this,
  • Press 'run',
  • Nothing happens, just runs continuously. Doesn't hit breakpoints in either #setup() or #loop().

Any ideas?

Hello @dansiviter.

Note that "Method 1" or "Method 2" only refer to loading a sketch. After loading, you must press RESET once to re-identify the board via USB; if the sketch was compiled with 'Debug mode (Hardware CDC)' selected in the Tools > USB Mode menu of the IDE, it must now be identified as a USB/JTAG device.

It's indeed recognized like when using Method 1, but now the sketch is running (and the LED blinking). Debug information (i.e. proper breakpoints!) should then also be available.

Let me know if this helps!

@lburelli Thanks, the reset button sorted it. I've wrongly assumed that when the log says Hard resetting via RTS pin... it doesn't actually do anything and a press of the RESET is still required.