Board connection lost - upload failed

In IDE 2.0 RC5 I have problem with board connections.

  • When starting the IDE I might see the board as connected or not. The problem might get resolved by unplugging/plugging the USB cable.
  • During development this might happen at random and then unplug/plug does not always resolve the issue.
  • During upload I might lose connection and am unable to resolve problem unless I reboot my PC
  • Serial monitor does interfere with connection but this seems to be rather random, it might fail one time and work the next. The message related to Serial monitor connections are not consistent and do not always reflect what the system sees (No connection but showing output).

Problems related to whether the port of your board is correctly shown in the related menus (Board Selector dropdown menu, "Select Board" dialog, Tools > Port menu) are likely related to the low level serial-discovery tool used by the Arduino development software to find ports.

If you would like to do some troubleshooting, you can check whether that tool is behaving and able to see the port of your board.

:exclamation: NOTE: This will not solve the problem. This is only intended to possibly gather some more information about the problem, which might provide a clue that leads to a solution.

I'll provide the instructions here:

I seem to remember you are using Windows, so I have provided the Windows-specific instructions. If I misremembered, let me know and I'll provide the instructions for your OS.

During all this, keep an eye out for anything that doesn't match the expected behavior as described at each step.

  1. Open the following folder in Windows "File Explorer":
    C:\Users\<username>\AppData\Local\Arduino15\packages\builtin\tools\serial-discovery
    
    Note that the AppData folder is hidden by default in "File Explorer". You can make it visible by opening the "View" menu, then checking the box next to "☐ Hidden items".
  2. The serial-discovery folder will contain a subfolder for each of the versions of serial-discovery which are installed on your computer.
    For example:
    serial-discovery/
    ├── 1.3.0/
    ├── 1.3.0-rc1/
    └── 1.3.2/
    
  3. Hold the Shift key while clicking the right hand button on the mouse on the folder with the highest version (1.3.2 in the example above).
  4. From the context menu, click "Open PowerShell window here".
    PowerShell will now open.
  5. Type the following command:
    serial-discovery
    
  6. Press the Enter key.
    serial-discovery will now start. There won't be any obvious sign of this other than that there is no longer a command prompt at the cursor in the terminal.
  7. Type the following command:
    HELLO 1 "arduino-cli 0.20.2"
    
  8. Press the Enter key.
    You should now see a response printed exactly like this:
    {
      "eventType": "hello",
      "protocolVersion": 1,
      "message": "OK"
    }
    
  9. Unplug your Arduino board from your computer if you have it plugged in.
  10. Type the following command:
    START_SYNC
    
  11. Press the Enter key.
    You should now see a response printed exactly like this:
    {
      "eventType": "start_sync",
      "message": "OK"
    }
    
    You might also see some additional objects in the output depending on which serial ports are available on your computer.
  12. Plug your Arduino board into your computer
    You should now see a response printed that looks something like this:
    {
      "eventType": "add",
      "port": {
        "address": "COM42",
        "label": "COM42",
        "protocol": "serial",
        "protocolLabel": "Serial Port (USB)",
        "properties": {
          "pid": "0x804e",
          "vid": "0x2341",
          "serialNumber": "EBEABFD6514D32364E202020FF10181E"
        }
      }
    }
    
    This is only an example of what you might see. The output will be different depending on the board you connected.
  13. Unplug your Arduino board from your computer
    You should now see a response printed that looks something like this:
    {
      "eventType": "remove",
      "port": {
        "address": "COM42",
        "protocol": "serial"
      }
    }
    
    This is only an example of what you might see. The address field value should be the same as the "add" event you saw when you plugged the board in.

You should continue to see the same results if you repeat steps (12) and (13).

Once you are done with your experiments with the "serial-discovery" tool, follow these instructions to exit:

  1. Type the following command:
    STOP
    
  2. Press the Enter key.
    You should now see a response printed exactly like this:
    {
      "eventType": "stop",
      "message": "OK"
    }
    
  3. Type the following command:
    QUIT
    
  4. Press the Enter key.
    You should now see a response printed exactly like this:
    {
      "eventType": "quit",
      "message": "OK"
    }
    
    You should now be back at the shell command line.

Is it this one?

I'm sure it is this bug:

I ran the commands as requested, they all show similar requests as yours.
I started arduino and all looks fine. I restart arduino and get:
image

No board connected while the monitor shows:
image

unplug /plug while Arduino is running results in:

{
  "eventType": "remove",
  "port": {
    "address": "COM5",
    "protocol": "serial"
  }
}
{
  "eventType": "add",
  "port": {
    "address": "COM5",
    "label": "COM5",
    "protocol": "serial",
    "protocolLabel": "Serial Port (USB)",
    "properties": {
      "pid": "0xEA60",
      "serialNumber": "0001",
      "vid": "0x10C4"
    }
  }

and arduino shows:
image

I hope this helps.

The :x: indicates that you have a board selected, but no port selected.

The :warning: indicates you have a board and port selected, but that the Arduino IDE is not able to verify that the port selection is correct for that board based on its USB VID/PID.

Since the ESP32 boards use the non-unique VID/PID provided by the manufacturer of their general purpose USB to serial adapter chip (e.g., WCH CH340, Silicon Labs CP2102), there is no way for the IDE to know what board is using that VID/PID, and so this :warning: icon is normal and expected for your ESP32 board.

Just make sure you have selected the correct port from the Tools > Port menu in the Arduino IDE.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.