-
-
Notifications
You must be signed in to change notification settings - Fork 397
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
"Access is denied" error when uploading to board w/ FT232 USB chip with Serial Monitor/Plotter open #1783
Comments
Not sure if it's actuality related to your problem, but I got this after I had changed the COM port in device manager. After rebooting the computer I could use the COM port normally again. Is this still happening for you? |
Yes, I can work for several hours on 1.8 without a single issue, and this problem occurs immediately after switching to 2.0 |
Hi @maciejmiklas. Thanks for your report. Does the error still occur if you close the Serial Monitor tab in the bottom panel of the Arduino IDE window before uploading? You can do that by clicking the X icon on the tab: Arduino IDE automatically closes the port in Serial Monitor and Serial Plotter when uploading, so this should not be necessary. I'm only trying to determine the exact conditions the fault occurs under. |
I did that and have had no problems so far. |
Thanks for checking @maciejmiklas. I am able to reproduce this fault, but only under specific conditions (FT232 chip, Windows, using Serial Monitor/Plotter) and I wanted to make sure the fault you are experiencing also depends on those conditions. Knowing the required conditions and being able to reproduce it should make the preparation and validation of a fix for the bug much easier. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
I just spent an evening helping a non-technical person (cosplayer) finding a solution to this problem. Closing the Serial Monitor or installing an older version of the IDE does the trick. This person was on Win 11 using Arduino 2.1.0 IDE with an original Arduino Nano. This is a very common setup, so this will affect many users. It puzzles me a bit that this bug still has not been assigned to a milestone given that it was reported 6+ months ago. Are there problems reproducing it? Anything I can do to help resolve it? |
I investigated, and the problem cannot be fixed without CLI changes/support. IDE2 creates a gRPC bidirectional stream via the BeforeIDE2 does an upload, all related monitor connections are closed. IDE2 closes the monitor connection by ending the bidirectional stream and waiting for the OK signal:
I see a race condition; if I put a breakpoint into the code after closing the bidirectional stream (and let the OS clean up the resources), I do not have the
monitor_access_is_denied.mp4CLI should provide a way to terminate the monitor connection gracefully. Calling this API and receiving an OK ack means the port is free. This is what is happening:
This is what should happen:
This is just one of the possible solutions, but the main idea is that IDE2 or any other CLI client might need this way of terminating the monitor. |
Thanks for taking the time to make an investigation @kittaakos! I am sorry it wasn't so simple as I had hoped. Since you are now most familiar with the problem and the work that will be required to resolve it, would you mind reporting this to the Arduino CLI developers by submitting an issue to their repo when you get the time? If work is needed in both the Arduino IDE and Arduino CLI codebases, then I would suggest we keep this one here to track the Arduino IDE work and create a separate one in the Arduino CLI repo to track the work needed on that codebase. |
@kittaakos , I agree with @per1234 Please, report to the CLI team and let's do things right even if it shifts development a little. |
Closes #1783 Signed-off-by: Akos Kitta <[email protected]>
Describe the problem
In order to upload to an Arduino board via a serial port, the upload tool (e.g., AVRDUDE) must be able to open the port. This is not possible if another process already has control of the port.
Arduino IDE's "Serial Monitor" and and "Serial Plotter" components also use the serial port of the board. Arduino IDE handles this potential conflict of port usage automagically by closing the port in Serial Monitor/Plotter when an upload process is triggered, then opening it again after the upload is finished. This means no special action is needed from the user to upload while Serial Monitor/Plotter is open.
🐛 The upload fails with an "
Access is denied
" error under the following conditions:I've been using Arduino IDE 2.0.3 with Nano without issues when uploading on Ubuntu. Now I've tried it on Windows 11, and most of the time, it gives me this error:
But I can see logs from the serial monitor in Arduino IDE -> serial monitor.
To reproduce
Equipment
A board or other device that has an FTDI FT232R USB chip
The classic Arduino Nano is a common board that uses this chip.
FT232R modules (example) or cables (example) are also often used to upload to boards such as the Arduino Pro Mini that don't have an integrated USB chip.
The fault can be reproduced even if the FT232R-based device is not an Arduino board. In this case, the upload is expected to fail, but it would fail with a "
not in sync
" error instead of "Access is denied
".Steps
🐛 The upload fails:
🙂 The upload is successful.
🐛 The upload fails:
🐛 The upload fails:
Expected behavior
Serial Monitor and Serial Plotter do not interfere with upload process.
Arduino IDE version
Original report
2.0.3
Last verified with
2.3.3
Operating system
Windows
Operating system version
Edition Windows 11 Pro
Version 22H2
Installed on 07/11/2022
OS build 22621.963
Experience Windows Feature Experience Pack 1000.22638.1000.0
Additional context
I bisected the introduction of the fault to df8658e
Logs generated from an upload that fails with this fault using the build for 053574b with the
arduino.cli.daemon.debug
advanced setting set totrue
:2023-08-16_log.log
I have no problems uploading sketches on Arduino IDE 1.8.19 from Microsoft Store on the same system. I can quit 2.0.3, start 1.8.19, and it's working immediately.
I cannot reproduce the fault on Linux (Ubuntu 22.04) or macOS (Ventura).
I cannot reproduce the fault when using native USB boards (e.g., Leonardo, MKR) or boards that use other models of dedicated USB chip (e.g., ATmega16U2 on Uno and Mega, WCH CH340 on derivative boards).
Workaround
Serial Monitor
Serial Plotter
ⓘ We must do an open/close cycle on Serial Monitor as a workaround for a bug in Serial Plotter
Additional reports
Related
Issue checklist
The text was updated successfully, but these errors were encountered: