USB COM port keeps changing

I am fairly new to Arduino so there may be a simple answer to this.

I am connecting a Nano 33 BLE to a PC via USB for build / upload / debug etc, and it shows up on COM7.

However, frequently when I do a compile and upload, at the end of the upload, the COM port switches to COM8 all on its own. The serial monitor then won't work.

It is a simple enough matter to change it back to COM7 (the COM port selection recognises that is where the Arduino is), but it is irritating as it keeps happening (not all the time). There is a COM8 with a USB driver on it that gets used for something else (not currently plugged in), and presumably the IDE is getting confused.

Is there any way to say in the IDE setup "use COM7 and don't change it"?

Your post was MOVED to its current location as it is more suitable.

Could you also take a few moments to Learn How To Use The Forum.

Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

You will also notice that two com ports is standard for some boards.

The Arduino Nano 33 BLE and IoT use native USB. That means the USB stack runs on the same processor. To write a new sketch the device needs to switch to bootloader mode and when it is done the device needs to switch back. In both cases the device will reset and therefore loose the USB connection. The two modes have different USB endpoint configuration which Windows detects and therefore assign a different COM port.

On older Arduinos there is a separate chip that can stay connected the whole time. This has the advantage that the COM ports never changes. On the other hand, native USB is faster and allows some additional applications e.g., USB keyboard and mouse.

The IDE can handle the switch most of the time automatically. I try to confirm the port is set before I upload a new sketch. Sometimes I forget and must click upload a second time.

Thanks, I realise that. Not clear however why it makes the wrong decision when COM8 does not show up in the available port list.

You just need to be patient. Close the Serial Monitor before you upload a new sketch and check the COM port setting. Once upload is done check the port again and open the Serial Monitor if you need it. If you stick with the procedure, you will be fine most of the time.

I am sure this is not easy to program in the IDE. There are many uncertainties, Windows is not real-time, the hardware is different from one PC to another, different drivers, and the Arduino is connecting and disconnecting the USB port.

Yes, thanks, I do all that as a workround.

However it does not alter the fact that the IDE appears to get confused over ports, other applications that connect in similar ways - also running on the same Windows system - don't, so I am forced to the conclusion that there is a bug / implementation issue in the IDE.

My question really therefore is whether this is a known issue with a known fix / workround - apart from the above.

After programming my 33 BLE with the Arduino IDE i've have changed from Arduino IDE to Atmel Studio and programm with the Arduino plugin.
Since i've change i haven't the port-problem again.
It could work for you :wink:

And: I like Atmel Studio much more :smiley:

Thanks, interesting. Didn't know there was that alternative.