Cannot upload to Arduino nano

I am trying to upload a sketch to a brand new Nano (official, not a knockoff), and I am having trouble connecting to the com port. I have already used windows tools to ensure that the com port is not being blocked by any other programs.

Sketch uses 2332 bytes (7%) of program storage space. Maximum is 30720 bytes.
Global variables use 194 bytes (9%) of dynamic memory, leaving 1854 bytes for local variables. Maximum is 2048 bytes.
"C:\Users\petra\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\Users\petra\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -V -patmega328p -carduino "-PCOM12" -b57600 -D "-Uflash:w:C:\Users\petra\AppData\Local\Temp\arduino\sketches\8E9D1372FB915DCDE682C7A612E90504/watchdog_timer.ino.hex:i"

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\petra\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

     Using Port                    : COM12
     Using Programmer              : arduino
     Overriding Baud Rate          : 57600

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

avrdude done. Thank you.

Failed uploading: uploading error: exit status 1

Hi @dmbook

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.

If that bug is the cause of the problem you are having, the workaround will be 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.

1 Like

That worked great, thanks!

You are welcome. I'm glad you are able to upload with the workaround.

Regards,
Per

Your topic was moved to a more suitable location on the forum.

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