Problem with my port

I can upload my code to my Arduino and i can reset it. But when i want to use the serial monitor this error pops up:

Port monitor error: command 'open' failed: Invalid serial port. Could not connect to COM7 serial port.

what should i do

Select the correct serial port.

Some Arduinos have two serial ports, one for the serial monitor and one for uploading, but you forgot to tell us which Arduino you have.

1 Like

I'm sorry my bad. I'm using a Arduino UNO and also running the first example code. The one that uses a potentiometer.

The Uno has only one port. Your PC should report what it is.

As i said earlier, the error is :Port monitor error: command 'open' failed: Invalid serial port. Could not connect to COM7 serial port.

So what should i do

Use the CORRECT port.

If you unplug the Uno, can you select any port? When you plug the Uno back in, what port appears?

Topic moved to correct category.

@parhamzz , I suggest that you do a search; you're not the only one who is experiencing it with IDE 2.x

Hi @parhamzz. Please tell us which USB to serial adapter chip your Arduino board has. This is a black chip near the USB socket.

The chip will usually be identified by writing on the top. This might say something like "Atmel MEGA16U2" or "WCH CH340G" or "SILABS CP2102".

Examples:

Microchip ATmega16U2

ATmega16U2

📷

MakeMagazinDE - CC BY-SA 4.0 (cropped)

WCH CH340

CH340

📷

SparkFun - CC BY-SA 4.0 (cropped)


If it isn't clear, alternatively you can provide the link to where you bought the board from and we'll see if we can determine the chip from the product listing.

Thank you.

If i'm not mistaking , It is a
Atmel
MEGA 328P
Can't read the third line
354A3P
1942T6A

You are looking at the wrong chip. You need to look at the one that is next to the USB socket on the board.

For example, on the official Arduino UNO, the chip is here:

image

while plugged:
I can select the cord COM7

while unplugged:
I can see the COM7, but i can't select it

And when i connect it back, i can select the COM7

Mine looks a bit different.
I think because they don't support our country, i have a copy.

There were some previous reports of this "Port monitor error: command 'open' failed: Invalid serial port. Could not connect to COM_n_ serial port." error occurring specifically when Serial Monitor is opened in Arduino IDE while the port of a board like yours that uses the WCH CH340 USB chip (and apparently only specific batches of those chips). The problem only occurs when using the latest version of the CH340 driver.

The affected users have 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. 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 (COMn)" under the "Ports (COM & LPT)" section (where "COMn" is some serial port e.g., COM4). Double click on that item.
    The "USB-SERIAL CH340 (COMn) Properties" dialog will open.
  18. Select the "Drivers" tab of the "USB-SERIAL CH340 (COMn) Properties" dialog.
  19. You will see a "Roll Back Driver" button in the dialog. If it is not clickable, perform the following instructions:
    1. Click the "Update driver" button.
      An "Update Drivers Device - USB-SERIAL CH340 (COMn)" dialog will open.
    2. Click on "Search automatically for drivers" in the "Update Drivers Device - USB-SERIAL CH340 (COMn)" 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 (COMn)" dialog.
  20. Click the "Roll Back Driver" button in the "USB-SERIAL CH340 (COMn) 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 (COMn) Properties" dialog.

Now start Arduino IDE again and repeat whatever you were doing before when you encountered that error before. Hopefully this time you will not encounter that "Port monitor error: command 'open' failed: Invalid serial port. Could not connect to COM_n_ serial port." error.

Thank you so much, I can't do it right now but i will tell you the progress.

Thank you, it fixed.

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

Regards,
Per

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