Open sketch "blocks" upload to board for other sketches

In the OLD IDE, if I open a sketch, and select a board and upload to that board, and then open a new sketch, and upload to that same board - it works ok.

When I try to do the same thing with the BETA IDE, I get this error:

avrdude: ser_open(): can't open device "/dev/cu.usbmodem1463201": Resource busy
Upload error: Error: 2 UNKNOWN: uploading error: uploading error: exit status 1

This may be the desired behavior, I am not sure.

For my workflow, I often jump between different sketches, uploading them to the same board, back and forth. This worked fine in the previous IDE, I just clicked upload when I had a new sketch to upload.

Now it seems, I have to go and select a different board, or close the other sketch that I had uploaded to.

I hope this makes sense!

Just a thought.

I am on macOS BigSur and using IDE Version: 2.0.0-beta.7

Do you have Serial Monitor open in the first IDE window?

What IDE are you using and what OS?

I am on macOS BigSur and using IDE Version: 2.0.0-beta.7

Yes, I do have the Serial Monitor open.

I do this all the time with Linux Mint without any problem. Each instance when it starts uses a different USB port. Can you try a different version of the IDE it may be a problem with the beta version you are using.

OK. This is a known deficiency, which is tracked here:

Currently, each Arduino IDE window is an independent instance. This is different from the classic IDE, where each new window is still part of the existing instance. What you're seeing is normal and expected when trying to upload to an open port. You will see the same behavior in the classic Arduino IDE if you open the port in some other application, or even another instance of the classic IDE. However, the classic IDE is able to control the Serial Monitor which belongs to its instance during uploads to close the port, then reopen it after the upload is finished.

So in order for the Arduino IDE 2.x to provide this same automagical port juggling, it will need to have some similar mechanism of one open window being able to control the Serial Monitor of the others.

An unfortunate side effect of the classic IDE's "all windows are in the same instance" system is that when you change the board or port in one window, it changes it in the others as well. This is very inconvenient when you are working with multiple boards at the same time. The workaround is to start a separate instance of the classic IDE for each board. In that usage, you run into the same problem if you try to use the same port simultaneously in multiple instances, because each instance can't control the Serial Monitor of the other. In Arduino IDE 2.x, you can have a separate board or port selected in each window without any need for jumping through hoops.

So I think it will be a bit challenging to get the best of both worlds, but there are some very talented people working on the IDE, and an amazing community of contributors, so I'm sure some solution will be found in time.

2 Likes

Thanks for this reply! It makes sense what you are saying - this is a matter of trade off.

For me, it will likely be an adjustment of my work flow, because more often then not I target the same Arduino board with multiple different sketches. I'll just have to turn off the port selection as I jump around from sketch to sketch.

I can totally see why developers trying to make code work for various Arduino boards would want one sketch, with multiple target boards, and not have to keep selecting different boards and ports.

Thanks again for your reply!