Arduino Have a Mercy: Error: Serial port 'COM15' already in use ...

I was saving time whole month for a few precious moments this weekend, so I can develop some code on Arduino, but 2 days in a row I can't get rid of the above error. All of this started yesterday, while I was using several sketches that used Serial communication.

My system: Windows XP with the latest SP + no BlueTooth devices or anything else that should lock the port + Arduino IDE 0022 and 1.0 + Arduino Mega 2560

I tried:

  • unplugging the cable and rebooting. Amazing thing is that after the full reboot, when nothing else had been started, if I go to IDE and try to upload a sketch, it gives me the above error. How can COM port be in use when there is nothing, apart from IDE using it? Arduino IDE locks itself even after clean reboot! IDE locks even when computer is switched off. Amazing!

  • Removed the UART driver and re-installed it again. That moved Arduino from COM2 to COM15. When I rebooted and got into the IDE and tried to upload a sketch, I got the message straight away. Even moving the COM port didn't fool this error.

This problem happens if I run sketches that use serial communication. Sometimes I save the day by just pulling the cable out and reconnecting, but this time nothing helps.

Weird part:

  • I've done the Loop Back test and that worked OK.
  • I've uploaded empty sketch with success: void setup( void ) { } void loop( void ) { }

Can't you modify the COM port number?

Oh, I tried that 100 times. Lock moves with change. I have a COM2 available. If I move COM15 to COM2, lock stays on. Lock is so hard, that even survives reboot.

I think that Arduino IDE is not releasing serial port lock, even if you close the program. Or at least Java classes that IDE is using. This should really be addressed by developers.

Whole weekend ruined.

Does Arduino 0022 or 1.0 IDE use its own Java or Java installed on the operating system.

I am constantly getting this COM port locking. Even if I switch computers, they work fine for few sessions and they get 'COM port already used by other application. Try closing app. that is using port ..."

Moderator edit: Threads merged. (Nick Gammon)

I someone doesn't know the answer to your first query, reposting won't help them know.