Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload fails in subsequent windows with Serial Monitor open #726

Closed
per1234 opened this issue Dec 28, 2021 · 8 comments · Fixed by #982
Closed

Upload fails in subsequent windows with Serial Monitor open #726

per1234 opened this issue Dec 28, 2021 · 8 comments · Fixed by #982
Assignees
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself topic: serial monitor Related to the Serial Monitor type: imperfection Perceived defect in any part of project

Comments

@per1234
Copy link
Contributor

per1234 commented Dec 28, 2021

Describe the bug

The Arduino IDE uses the serial ports of Arduino boards 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

🐛 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 #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.
  2. Select the appropriate board and port.
  3. Select Tools > Serial Monitor from the Arduino IDE menus to open Serial Monitor.
  4. Select Sketch > Upload from the Arduino IDE menus.
    🙂 Upload succeeds as expected.
  5. Select Tools > Serial Monitor from the Arduino IDE menus to close Serial Monitor.
    This is necessary to avoid Upload fails if port is open in Serial Monitor of another window #586
  6. Select File > New from the Arduino IDE menus.
  7. Select Tools > Serial Monitor from the Arduino IDE menus in the new window.
    🐛 Note that there is an unexpected banner in Serial Monitor:

    Not connected. Select a board and a port to connect automatically.

  8. Select Sketch > Upload from the Arduino IDE menus.
    🐛 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 767b09d (it does not occur at 8839793).


Originally reported at https://forum.arduino.cc/t/upload-failed-when-serial-monitor-is-open/940255

@per1234
Copy link
Contributor Author

per1234 commented Jun 8, 2022

Closing as fixed by #982

@per1234 per1234 closed this as completed Jun 8, 2022
@per1234 per1234 added the conclusion: resolved Issue was resolved label Jun 8, 2022
@ProxyPlayerHD
Copy link

why is this closed? this is still an issue in rc9.2.
If you don't manually close the "Serial Monitor" tab at the bottom before trying to upload a sketch, it just gives you the:
Failed uploading: uploading error: exit status 1avrdude: ser_open(): can't open device "\\.\COM#": Access Denied
error

@per1234
Copy link
Contributor Author

per1234 commented Aug 14, 2022

Hi @ProxyPlayerHD. Thanks for your report.

The issue is closed because the bug was fixed for me and the majority of the other users who reported being affected by it after the changes made in #982.

We are tracking one other report of continued failing uploads at #1306, but it is not certain that it has the same cause and we have not even been able to determine how the developers can reproduce that issue.

Please provide more information:

  • Which Arduino board are you using?
  • Does the problem occur consistently, or intermittently?
  • Does the problem persist after you restart your computer?
  • Does the problem also occur when using Arduino IDE 2.0.0-rc9 or older (download links for 2.0.0-rc9 listed here, or 1.8.19 here)

@ProxyPlayerHD
Copy link

ProxyPlayerHD commented Aug 14, 2022

hmm, i hate it when it does this... aparently the issues seems to have fixed itself out of nowhere. but now a different issue emerged where the Serial Monitor doesn't display anything from my Arduino Mega 2560 but works fine for other board i tested it with (Nucleo 144, and RaspPi Pico).
i just have a looping "Hello World!" program on the Arduino and i can see the sending LED constantly being lit up but nothing appears in the IDE. I can send stuff from the Serial Monitor to the Arduino and see the receiving LED light up shortly when i do it, so clearly it has a working connection.
power cycling/reconnecting the Arduino or restarting the IDE doesn't fix it. (reuploading the sketch while the Serial Monitor is open makes it print a few garbled "Hello World"'s)
i can also use some other terminal software like Teraterm to connect to the Arduino and it works perfectly fine there.

this is probably enough to open a seperate issue, but i'll restart my PC to see if that maybe fixes it
EDIT: nope that didn't fix it. swaping board again it's really oly the Mega that doesn't want to display stuff in the Serial Monitor...

@chrisAS12
Copy link

chrisAS12 commented Mar 10, 2023

Still am having this issue, it does not seem to be fixed. Using the newest version: Arduino IDE 2.0.5-nightly-20230305

@per1234
Copy link
Contributor Author

per1234 commented Mar 10, 2023

Hi @chrisAS12 which Arduino board are you attempting to upload to?

@chrisAS12
Copy link

It's a custom PCB, but it's compatible with Arduino Uno. Using FTDI adapter for uploading.

@per1234
Copy link
Contributor Author

per1234 commented Mar 10, 2023

Using FTDI adapter for uploading.

Thanks! That's the exact information I was angling for. We are tracking the bug here:
#1783

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself topic: serial monitor Related to the Serial Monitor type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants