Port monitor and Serial error

Hello! I keep getting the error: Port monitor error: command 'open' failed: Invalid serial port. Could not connect to COM6 serial port.

I have tried

  1. Installing and uninstalling CH341
  2. Closing all background apps
  3. Changing the port number.

Any idea where something could have gone wrong? Thanks!

I moved your topic to an appropriate forum category @waltrobinson.

In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.

This is an important part of responsible forum usage, as explained in the "How to get the best out of this forum" guide. The guide contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

Hi @waltrobinson.

There were some previous reports of this "Invalid serial port" error occurring specifically when using boards that have the CH340 USB chip. It seems that a driver upgrade included in a recent Windows update is the cause of this problem.

The affected users have found that uninstalling and reinstalling the CH340 device fixed the problem. I'll share the instructions you can follow to do that:

  1. Close Arduino IDE if it is running.
  2. Connect the Arduino board to your computer with a USB cable.
  3. Open the Windows Device Manager.
  4. Select View > Devices by type from the Device Manager menus.
  5. Open the "View" menu.
  6. If there is a to the left of the "Show hidden devices" menu item, click on "Show hidden devices" to disable it.
  7. Open the "Ports (COM & LPT)" section of the Device Manager tree.
  8. You should see a port identified as "USB-SERIAL CH340 (COM_n_)" under the "Ports (COM & LPT)" section (where "COM_n_" is some serial port e.g., COM4). Right click on that item.
    A context menu will open.
  9. Select "Uninstall device" from the context menu.
    An "Uninstall Device" dialog will open.
  10. Check the box next to "☐ Attempt to remove the driver for this device" in the "Uninstall Device" dialog.
  11. Click the "Uninstall" button.
  12. Wait for the uninstallation process to finish.
  13. Unplug the USB cable of the Arduino board from your computer.
  14. Wait for the Device Manager tree to reload.
  15. Connect the USB cable of the Arduino board to your computer.
  16. Wait for the "USB-SERIAL CH340 (COM_n_)" port to reappear under the "Ports (COM & LPT)" section of the Device Manager tree.

My experience is that the device will be reinstalled automatically by Windows after you plug the board back into the computer, as indicated by the "USB-SERIAL CH340 (COM_n_)" port reappearing in the last step of those instructions. However, it is maybe possible that the complete driver removal will actually have been accomplished by the above instructions, in which case it would be necessary to reinstall the driver. If this happens to you, please let me know and I'll provide instructions you can follow to install the driver.

Once the port has reappeared in Device Manager, start Arduino IDE again and repeat whatever you were doing before when you encountered that error. Please reply here to let us know whether the error still occurs.

fixed thankyou!

You are welcome. I'm glad it is working now.

Regards,
Per

Hi, my arduino has stopped working again, showing the same error Port monitor error: command 'open' failed: Invalid serial port. Could not connect to COM4 serial port.

I followed the steps above, and the resulting device name is USB-SERIAL CH340. Could you suggest some fixes? Thanks!

I'm sorry to hear that. Some of the users who experienced these errors reported that doing a "roll back" to an older version of the driver was an effective workaround. You can give that a try I'll provide instructions:

  1. Close Arduino IDE if it is running.
  2. Connect the Arduino board to your computer with a USB cable.
  3. Open the Windows Device Manager.
  4. Select View > Devices by type from the Device Manager menus.
  5. Open the "View" menu.
  6. If there is a to the left of the "Show hidden devices" menu item, click on "Show hidden devices" to disable it.
  7. Open the "Ports (COM & LPT)" section of the Device Manager tree.
  8. You should see a port identified as "USB-SERIAL CH340 (COM_n_)" under the "Ports (COM & LPT)" section (where "COM_n_" is some serial port e.g., COM4). Right click on that item.
    A context menu will open.
  9. Select "Update driver" from the context menu.
    An "Update Drivers Device - USB-SERIAL CH340 (COM_n_)" dialog will open.
  10. Click on "Search automatically for drivers" in the "Update Drivers Device - USB-SERIAL CH340 (COM_n_)" dialog.
  11. You should now see the driver installation wizard update the driver. Wait for the update to finish, as indicated by the message "Windows has successfully updated your drivers" in the dialog.
    :exclamation: It is possible you will instead see the message: "The best drivers are already installed". If so, please stop following the instructions here and reply on the forum thread to let me know. I'll provide alternative instructions you can follow.
  12. Click the "Close" button in the "Update Drivers Device - USB-SERIAL CH340 (COM_n_)" dialog.
  13. As before, you should see a port identified as "USB-SERIAL CH340 (COM_n_)" under the "Ports (COM & LPT)" (where "COM_n_" is some serial port e.g., COM4) section of the Device Manager window. Double click on that item.
    The "USB-SERIAL CH340 (COM_n_) Properties" dialog will open.
  14. Select the "Drivers" tab of the "USB-SERIAL CH340 (COM_n_) Properties" dialog.
  15. Click the "Roll Back Driver" button.
    The "Driver Package rollback" dialog will open.
  16. Click the radio button next to "My apps don't work with this driver" in the "Driver Package rollback" dialog .
  17. Click the "Yes" button.
  18. Click the "Close" button in the "USB-SERIAL CH340 (COM_n_) Properties" dialog.

Now start Arduino IDE again and repeat whatever you were doing before when you encountered that error. Please reply here to let us know whether the error still occurs.

Hi, i see the message, The best drivers are already installed. What should i do then?

OK. I suspected that might happen. Please follow these instructions:

  1. Open this tutorial from SparkFun in your browser:
    https://learn.sparkfun.com/tutorials/how-to-install-ch340-drivers/all#drivers-if-you-need-them
    We are using this tutorial as a source for an older version of the CH340 drivers. Generally I recommend only obtaining drivers from the manufacturer of the device but WCH does not provide older versions of their drivers and SparkFun is trustworthy.
  2. Click the "Windows (EXE)" link you see in red under the "Drivers (If You Need Them)" section of the tutorial.
  3. Wait for the download to finish.
  4. Run the downloaded CH341SER.EXE file.
  5. A "User Account Control" dialog may now appear asking "Do you want to allow this app to make changes to your device?". Click the "Yes" button.
  6. A "DriverSetup(X64)" dialog will appear. Click the "INSTALL" button in the dialog.
  7. Wait for the driver installation to finish, as indicated by the appearance of a "Driver install success!" dialog.
  8. Click the "OK" button in the "Driver install success!" dialog.
  9. Click the X icon at the top right of the "DriverSetup(X64)" dialog to close it.
  10. Close Arduino IDE if it is running.
  11. Connect the Arduino board to your computer with a USB cable.
  12. Open the Windows Device Manager.
  13. Select View > Devices by type from the Device Manager menus.
  14. Open the "View" menu.
  15. If there is a to the left of the "Show hidden devices" menu item, click on "Show hidden devices" to disable it.
  16. Open the "Ports (COM & LPT)" section of the Device Manager tree.
  17. You should see a port identified as "USB-SERIAL CH340 (COM_n_)" under the "Ports (COM & LPT)" section (where "COM_n_" is some serial port e.g., COM4). Right click on that item.
    A context menu will open.
  18. Select the "Drivers" tab of the "USB-SERIAL CH340 (COM_n_) Properties" dialog.
  19. You will see a "Roll Back Driver" button in the dialog. If it is not clickable, perform the following instructions:
    1. Select "Update driver" from the context menu.
      An "Update Drivers Device - USB-SERIAL CH340 (COM_n_)" dialog will open.
    2. Click on "Search automatically for drivers" in the "Update Drivers Device - USB-SERIAL CH340 (COM_n_)" dialog.
    3. You should now see the driver installation wizard update the driver. Wait for the update to finish, as indicated by the message "Windows has successfully updated your drivers" in the dialog.
      :exclamation: It is possible you will instead see the message "The best drivers are already installed". If so, please stop following the instructions here and reply on the forum thread to let me know. I'll provide alternative instructions you can follow.
    4. Click the "Close" button in the "Update Drivers Device - USB-SERIAL CH340 (COM_n_)" dialog.
  20. Click the "Roll Back Driver" button in the "USB-SERIAL CH340 (COM_n_) Properties" dialog.
    The "Driver Package rollback" dialog will open.
  21. Click the radio button next to "My apps don't work with this driver" in the "Driver Package rollback" dialog .
  22. Click the "Yes" button.
  23. Click the "Close" button in the "USB-SERIAL CH340 (COM_n_) Properties" dialog.

Now start Arduino IDE again and repeat whatever you were doing before when you encountered that error. Please reply here to let us know whether the error still occurs.

Hi, i still get the error: avrdude: ser_open(): can't open device "\.\COM4": Access is denied.

Failed uploading: uploading error: exit status 1. Any help would be appreciated

There is a known bug in Arduino IDE 2.x that can cause uploads to fail with this "Access is denied" error if you try uploading to certain boards while Serial Monitor or Serial Plotter is open. A port can only be used by one process at a time, so Arduino IDE automatically closes the port in Serial Monitor and Serial Plotter during an upload, automatically opening it again after. For some reason, that juggling of the port control is not working for certain boards.

The workaround is to manually close the port in Serial Monitor/Serial Plotter before doing an upload. Please give that a try and then let me know if you still have the error while uploading:

Serial Monitor

  1. Click the X icon on the "Serial Monitor" tab in the bottom panel of the Arduino IDE window to close the tab:
    image
  2. Upload the sketch.
  3. Open Serial Monitor again if needed (by clicking the icon on the IDE toolbar or the Tools > Serial Monitor menu item) after the upload is finished.

Serial Plotter

If you have the "Serial Plotter" window open, the procedure is a bit different from closing the Serial Monitor connection:

  1. Close the "Serial Plotter" window.
  2. If the "Serial Monitor" view is not already open, select Tools > Serial Monitor from the Arduino IDE menus to open it.
    We must do an open/close cycle on Serial Monitor as a workaround for a bug in Serial Plotter
  3. Click the X icon on the "Serial Monitor" tab in the bottom panel of the Arduino IDE window to close the tab:
    image
  4. Upload the sketch.
  5. Open Serial Monitor and/or Serial Plotter again if needed after the upload is finished.

Please let me know if you have any questions or problems while following those instructions.

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