Nano ESP32 Errno71 Protocol error

I am trying to upload a sketch on a brand new Arduino Nano ESP32 board. The first time I try to upload some sketch, the upload works, but from the second time on I get the following error:

Traceback (most recent call last):
  File "/home/ciccio/.arduino15/packages/esp32/tools/esptool_py/4.5.1/esptool.py", line 34, in <module>
    esptool._main()
  File "/home/ciccio/.arduino15/packages/esp32/tools/esptool_py/4.5.1/esptool/__init__.py", line 1032, in _main
    main()
  File "/home/ciccio/.arduino15/packages/esp32/tools/esptool_py/4.5.1/esptool/__init__.py", line 674, in main

    esp = esp or get_default_connected_device(
  File "/home/ciccio/.arduino15/packages/esp32/tools/esptool_py/4.5.1/esptool/__init__.py", line 921, in get_default_connected_device
    _esp.connect(before, connect_attempts)
  File "/home/ciccio/.arduino15/packages/esp32/tools/esptool_py/4.5.1/esptool/loader.py", line 640, in connect
    last_error = self._connect_attempt(reset_strategy, mode)
  File "/home/ciccio/.arduino15/packages/esp32/tools/esptool_py/4.5.1/esptool/loader.py", line 525, in _connect_attempt
    reset_strategy()  # Reset the chip to bootloader (download mode)
  File "/home/ciccio/.arduino15/packages/esp32/tools/esptool_py/4.5.1/esptool/reset.py", line 83, in __call__
    self._setDTRandRTS(False, False)
  File "/home/ciccio/.arduino15/packages/esp32/tools/esptool_py/4.5.1/esptool/reset.py", line 58, in _setDTRandRTS
    fcntl.ioctl(self.port.fileno(), TIOCMSET, struct.pack("I", status))
OSError: [Errno 71] Protocol error
Failed chip erase: uploading error: exit status 1

Some things to take into account:

  • The code is uploaded using Programmer (CTRL+Shift+U), as uploading it normally resulted in the dfu-util: Failed to retrieve language identifiers dfu-util: Cannot set alternate interface: LIBUSB_ERROR_OTHER Failed uploading: uploading error: exit status 74 error;
  • This happens with brand-new boards, as well as with boards I've already been using for a long time before and didn't give me this error with any of the sketched I've tried uploading;
  • This happens with both different USB cables and different USB ports;

How could this problem be addressed? Any help in solving it will be appreciated!!

Thanks in advance :slight_smile:

Francesco

Have a look at this:
Reset the Arduino bootloader on the Nano ESP32 – Arduino Help Center

In particular, see the section “If the board is only recognized once or requires a double-press reset to upload a sketch.” Since your first upload works and subsequent uploads fail, the recommended full bootloader recovery procedure, including Tools → Burn Bootloader, seems worth trying.

Your best bet is to fix the original error.

This seems to indicate that you're using Espressif's ESP32 board package.
Have you tried with the Arduino ESP32 board package?

Are you trying to load non-compatible code again? Nano ESP32 on bootloop after uploading sketch - #17 by jim-p