Could not connect to COM3 serial port. avrdude done

I was working on a project and Arduino Yun worked normally. I tried to change something in code and it doesn't let me upload any code anymore(I tried using the codes that worked previously). Im geting error listed below. I had the same error before I think where it doesn't let me upload the code on the board (or upload takes very long and then fails) - I managed to fix it with CH341 driver if I remember correctly. But now nothing works.

I tried:
-changing usb cable
-trying to run the code on different PC (where it worked before aswell)

  • installing CH341 again
    -reinstalling "Arduino AVR Boards" - Im using latest 1.8.6 version
  • changing ports in device manager - port in device manager and in arduino ide is the same (I selected the right port in arduino ide), I choosed the correct board in tools --> board, Programmer is set as Arduino as ISP (ATmega32U4) which is used by Arduino Yun board
    -reinstalling Arduino IDE
    USB(white) and ON(green) LEDs are on, sometimes the TX LED is turned on when Im verifying and uploading the code.
    I'm using Arduino IDE 2.1.1.

avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

     System wide configuration file is "C:\Users\mlade\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

     Using Port                    : COM3
     Using Programmer              : avr109
     Overriding Baud Rate          : 57600

avrdude: ser_open(): can't open device "\.\COM3": Access is denied.

avrdude done. Thank you.

Failed uploading: uploading error: exit status 1

Another error Im getting:




2 Arduino Yuns??

Hi @mmden. The "Access is denied" error happens when the port is open in another application. Only one application can have a serial port open at a time so Arduino IDE can't perform an upload under these conditions.

Check to see whether you have any applications running on your computer that might use the port. If they are, close them and then try the upload again.

If the error still occurs, restart your computer and then try uploading once again. In rare occasions, a glitch causes the port to get stuck open. This is one possible cause of the "Access is denied" error. Restarting your computer restores the port to the normal working state and so fixes that particular cause of the error.

When you select a port and a board in Arduino IDE, the IDE remembers which board you selected for the port. After that, you can quickly select both simply by selecting the board+port from the "board selector" menu on the IDE toolbar. It is fairly easy to accidentally create such an association, which you appear to have done with COM1. I can see from your screenshot of the Tools > Port menu that COM3 is the true port of your Yun board, so you are correct to select that port, as I see you have been doing.

Even if it might be a little confusing, this incorrect board association for COM1 is not the cause of the "Access is denied" error so you can simply disregard COM1.

Thanks for the reply.

UPDATE (FIX):
After trying everything to make this work I finally found the solution.

I wrote some simple code in ONLINE Arduino editor Arduino Cloud and code uploaded on the board with no problems. Before using Online editor you need to install Arduino Create Agent (thats probably the thing that solved the problem).
Now I tried writing code back on Arduino IDE installed on PC and it works there too.

I'm glad it is working now. Thanks for taking the time to post an update.

Regards,
Per

1 Like

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