IDE v2 RC5
Windows 10 / 64 Pro
I'm using an FDTI board to program my Pro mini. After many times uploading code I found the IDE would not upload when the serial monitor was "open" (i.e. in a tab next to the output tab).
If I shutdown the IDE and restart it now will upload code with the serial monitor "open". This is what I consider "normal" behavior.
I realize I've not given enough detail to troubleshoot but I figured mentioning it might be seen by others who have experienced this.
Sketch uses 11420 bytes (37%) of program storage space. Maximum is 30720 bytes.
Global variables use 622 bytes (30%) of dynamic memory, leaving 1426 bytes for local variables. Maximum is 2048 bytes.
Compilation complete.
avrdude: ser_open(): can't open device "\.\COM5": Access is denied.
Upload error: Failed uploading: uploading error: exit status 1
Hi @JohnRob . There are a couple of known bugs that would cause this to happen if you had Serial Monitor open in a previous IDE window:
opened 02:16PM - 31 Oct 21 UTC
closed 05:55AM - 08 Jun 22 UTC
topic: documentation
conclusion: resolved
topic: code
type: imperfection
topic: serial monitor
criticality: medium
## Describe the bug
It is not uncommon for a user to have multiple windows opโฆ en with the same port selected in each. If the Serial Monitor is open in one of those windows, uploads from the other window will fail.
## To Reproduce
1. Connect any Arduino board to your computer.
1. Select the board and port in the Arduino IDE menus.
1. Open Serial Monitor (e.g., **Tools > Serial Monitor**).
1. Select **File > New** from the Arduino IDE menus.
1. Select **Sketch > Upload** from the Arduino IDE menus.
๐ Note that the upload has failed with an error something like "`avrdude: ser_open(): can't open device "\\.\COM7": Access is denied.`"
## Expected behavior
Handle sharing port usage between windows automagically.
**OR**
More effectively communicate the cause of the upload failure and the required action to the user.
**OR**
Clearly document the cause of the upload failure and the required action (https://github.com/arduino/arduino-ide/issues/271).
I would recommend taking the approach of *"so you have x problem, here is the solution ..."* rather than *"here is how to upload/use Serial Monitor properly ..."*. The reason is that the user is much more likely to go searching for a specific solution once they have the problem than to proactively study the documentation in advance of doing an upload.
With this approach, the appropriate location for the documentation would be [the Help Center](https://support.arduino.cc/hc/en-us/sections/360003198300). The [classic Arduino IDE points the user there](https://github.com/arduino/Arduino/blob/1.8.16/arduino-core/src/cc/arduino/packages/Uploader.java#L179) in the event of a failed upload.
The article should be titled with the unique components of the various common error messages that occur when attempting to upload to an open port. It should also take into account that there are multiple possible causes of this error.
## Desktop
- OS: Windows 10
- Version: 2.0.0-beta.12-nightly.20211028
Date: 2021-10-28T03:03:25.353Z
CLI Version: 0.19.1 alpha [718bbbf2]
## Additional context
Originally reported at https://github.com/arduino/arduino-ide/issues/271#issue-840803269
### Comparison to classic Arduino IDE
This is not usually a problem in the classic Arduino IDE because all windows share the same Serial Monitor and are able to juggle the control of the port between the upload process and Serial Monitor automagically.
The exception is when the user has opened multiple instances of the Arduino IDE, in which case it behaves the same as Arduino IDE 2.x in that each instance has its own Serial Monitor and can not control the Serial Monitor of the other instance. However, this multiple instance usage is not very common, and more often employed by advanced users who are easily able to identify the cause of the upload failure that results from these conditions.
opened 04:15PM - 28 Dec 21 UTC
closed 05:31PM - 08 Jun 22 UTC
conclusion: resolved
topic: code
type: imperfection
topic: serial monitor
## Describe the bug
The Arduino IDE uses the serial ports of Arduino boards iโฆ n two different ways:
- Uploading sketches
- Communication via Serial Monitor
The port can not be used for both of these things simultaneously. The IDE handles the condition of Serial Monitor being open when an upload is started automagically like so:
1. Close port in Serial Monitor
1. Complete upload process
1. Reopen port in Serial Monitor
:bug: This works as expected in the first IDE window you open, but it no longer works in subsequent windows.
***NOTE***: although similar, this is different from https://github.com/arduino/arduino-ide/issues/586 because it occurs even when the port is not open in a Serial Monitor/Serial Plotter of another IDE window.
## To Reproduce
1. Connect an Arduino board to your computer.
1. Select the appropriate board and port.
1. Select **Tools > Serial Monitor** from the Arduino IDE menus to open Serial Monitor.
1. Select **Sketch > Upload** from the Arduino IDE menus.
:slightly_smiling_face: Upload succeeds as expected.
1. Select **Tools > Serial Monitor** from the Arduino IDE menus to close Serial Monitor.
This is necessary to avoid https://github.com/arduino/arduino-ide/issues/586
1. Select **File > New** from the Arduino IDE menus.
1. Select **Tools > Serial Monitor** from the Arduino IDE menus in the new window.
:bug: Note that there is an unexpected banner in Serial Monitor:
> Not connected. Select a board and a port to connect automatically.
1. Select **Sketch > Upload** from the Arduino IDE menus.
:bug: Upload fails with an error something like "avrdude: ser_open(): can't open device "\\.\COM7": Access is denied."
## Expected behavior
Upload with Serial Monitor open in the same IDE window to always be handled automagically.
## Desktop
- OS: Windows 10
- Version: 2.0.0-rc3
Date: 2021-12-22T15:46:56.004Z
CLI Version: 0.20.2 [13783819]
## Additional context
It is not necessary to leave the original window open to reproduce the bug. It occurs even if that window is closed.
---
I bisected the issue to https://github.com/arduino/arduino-ide/commit/767b09d2f10cab78b07754039ebb749d55b45d8d (it does not occur at https://github.com/arduino/arduino-ide/commit/88397931c5b704516e881959f6e7ce106094d14d).
---
Originally reported at https://forum.arduino.cc/t/upload-failed-when-serial-monitor-is-open/940255
The only upload problem I'm aware of that would occur if you only ever had Serial Monitor open in a single IDE window during the session is timing specific:
opened 11:10AM - 28 Oct 21 UTC
closed 01:57AM - 03 Aug 22 UTC
conclusion: resolved
topic: code
type: imperfection
topic: serial monitor
### Describe the problem
The Arduino IDE uses the serial ports of Arduino boaโฆ rds in two different ways:
- Uploading sketches
- Communication via **Serial Monitor**
The port can not be used for both of these things simultaneously. The IDE handles the condition of **Serial Monitor** being open when an upload is started automagically like so:
1. Close port in **Serial Monitor**
2. Complete upload process
3. Reopen port in **Serial Monitor**
๐ It does not currently handle the reverse, where the **Serial Monitor** is opened while an upload is in progress. This results in a confusing upload failure.
### To reproduce
1. Close **Serial Monitor** if it is already open.
1. Start an upload to an Arduino board.
NOTE: because it is timing sensitive, the issue will be difficult to reproduce with a minimal sketch that compiles very quickly, especially on a subsequent compilation when the libraries have already been cached. Use a larger sketch to accurately simulate real world conditions.
1. While the compilation process that occurs before the actual upload starts is still in progress, select **Tools > Serial Monitor** from the Arduino IDE windows.
The board's port is now opened in **Serial Monitor**.
1. Wait for the upload process to finish.
๐ Note that the upload has failed with an error something like:
```text
avrdude: ser_open(): can't open device "\\.\COM7": Access is denied.
```
### Expected behavior
Don't allow user to break upload by opening **Serial Monitor**.
Arduino IDE 1.x allows **Serial Monitor** to be opened during upload, but it is in a disabled state where the opening of the port is deferred until after the upload finishes, behaving just the same as when an upload is started with **Serial Monitor** already open:

### Arduino IDE version
2.0.0-beta.12-nightly.20211028
### Operating system
Windows
### Operating system version
10
### Additional context
Originally reported at https://github.com/arduino/arduino-ide/issues/271#issuecomment-812899242
### Issue checklist
- [X] I searched for previous reports in [the issue tracker](https://github.com/arduino/arduino-ide/issues?q=)
- [X] I verified the problem still occurs when using the latest [nightly build](https://github.com/arduino/arduino-ide#nightly-builds)
- [X] My report contains all necessary details
If you are able to determine that the problem you had is not one of these known bugs, please let us know here on the forum or via an issue report on GitHub if you prefer.
1 Like
I believe I experienced " Upload fails in subsequent windows with Serial Monitor open "
Thank you.
can you tell me the difference between File/Quit and File/close editor ?
It seems the File/close editor does nothing. I ask because I tried the close editor sometime during the session with the serial monitor (above) problem.
Thanks for checking.
I was also puzzled by this unfamiliar "File" menu item. It turns out that "Editor" is referring to what we normally call a "tab" in the Arduino world.
This menu item will often have no effect because the primary source files of the sketch are always open. However, it is possible to open other editors. For example, if you right click on some code from a library in your sketch and then select "Go to Definition " from the context menu, the file containing the definition will open in a tab. Since this file is not part of the sketch project, its tab (or "editor") is closable and so you will find that selecting File > Close Editor from the Arduino IDE menus does close that tab.
But you can also close the tab via the more intuitive and convenient "X " icon on the tab, so I have proposed that this menu item be removed:
opened 03:57AM - 03 Dec 21 UTC
closed 12:18PM - 26 Aug 22 UTC
type: enhancement
conclusion: resolved
topic: code
## Describe the current behavior
A new menu item **File > Close Editor** was โฆ introduced recently. This closes the currently selected editor.
The code files in the root of an Arduino sketch are always opened in the Arduino IDE editors. It is very rare for users to have any other editors open in the IDE. **File > Close Editor** has no effect when a sketch tab is selected. Its purpose is not clear from the title since we have never used the term "editor" to refer to an individual tab (we call them "tabs"). When a non-sketch file is open in an editor, the **X** on the right side of its tab will be the obvious method for closing it (with an alternative of using the "**View: Close Tab in Main Area**" keyboard shortcut).
My opinion is that this **File > Close Editor** will only cause confusion and add unnecessary complexity to the Arduino IDE's primary UI. I suspect that its introduction was unplanned.
## To reproduce
1. Select **File > Close Editor** from the Arduino IDE menus
Note that it doesn't do anything.
## Describe the request
Evaluate the need for **File > Close Editor**. If it doesn't offer anything of value to the users, remove it.
## Desktop
- OS: Windows 10
- Version: 2.0.0-rc1-snapshot.f0d9894
Date: 2021-11-30T16:25:41.414Z
CLI Version: 0.20.1 [abb21449]
Thanks for the reply.
Would it also be possible to "close" a sketch but have arduino IDE open?
Now to change projects I have to OPEN the 'new' one then close what was the current project.
My intuition is to close the old one then open another.
system
Closed
October 4, 2022, 2:12pm
6
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.