Pages: [1]   Go Down
Author Topic: What Causes "Serial port 'COM#" already in use"  (Read 2155 times)
0 Members and 1 Guest are viewing this topic.
Surrey BC
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

I have been building line following bots with my engineering 9-12 class for a few years. We are using a motor shield I developed. Previously 1 in 10 of the student made boards would have the "Serial port COM# already in use" issue and I put it off as student error.  The current semester class is having the "Serial port COM# already in use" with almost every board and for the life of me I cannot figure it out.

The issue is as soon as you plug in the board to the uno the error comes up when you try to upload a new sketch. The uno will run the any previous sketches uploaded to it but it will not allow a new sketch to be uploaded. I know I can get around this by unplugging the boards uploading the sketch and putting them back together but that makes trouble shooting 30 student projects very time consuming.

My question is what could be feeding back to the arduino to cause the "Serial port COM# already in use" problem? And what could I do to stop it from happening?

Thank you,


Logged

High School Engineering Teacher

South Texas
Offline Offline
Edison Member
*
Karma: 8
Posts: 1023
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are the computers shut down between sessions? I find this happens when I shut down one Arduino Window when the Serial Monitor is open. Also sometimes turns up when I have reconnected the Arduino several times in close succession. I think the problem is in the Java side of things, that some internal variable gets stuck.
Logged

Surrey BC
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The problem occurs only with the motor shield on. when it is off and the Arduino is unpluged and pluged back in every thing is back to normal, untill the motor shield goes back on. I think it has to be some sort of feed back issue.
Logged

High School Engineering Teacher

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Operating system?
Logged

Surrey BC
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

we are using windows xp
Logged

High School Engineering Teacher

Dallas, Texas
Offline Offline
God Member
*****
Karma: 3
Posts: 717
Old, decrepit curmugeon
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

At a guess the motor shield is probably introducing electrical noise into the power system (very common) which is causing unexpected behavior...maybe causing the arduino to change one of the status pins...

What model Arduino and motor shield are you using? Is it being powered from the USB or from an external power supply?
Logged

New true random number library available at: http://code.google.com/p/avr-hardware-random-number-generation/

Current version 0.7.2

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


@nobikes: You left out an important detail.  The student attempts an upload, gets impatient because nothing happens, and then tries again. The error is because the first instance of avrdude is still trying to communicate with the board.

In other words, both @kf2qd and @wanderson are essentially correct.  The problem is a combination of: motor shield with a serious problem (hardware), impatient students (user), bug in the IDE that allows a new upload to start before a pending one completes (software).

Logged

Surrey BC
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The issue is defiantly not impatient students, i try to do it with their boards and i get the same error. My money is on Wandersons conclusion of electrical noise. The question is what can be done to stop the electrical noise? and what pins would most likely cause the com port in use problem if they were exposed to the electrical noise?

Motor shield files

https://sites.google.com/a/theprojectinventory.com/envertech/enver-creek-engineering/scamatics/motorshieldarduino2.sch?attredirects=0&d=1

https://sites.google.com/a/theprojectinventory.com/envertech/enver-creek-engineering/scamatics/motorshieldarduino2.brd?attredirects=0&d=1
Logged

High School Engineering Teacher

Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ive had the same problem using a ping and sabertooth motorcontroller most of the time if you unplug, hold reset, plug back in, and let go of reset it uploads after that.
Logged

Dallas, Texas
Offline Offline
God Member
*****
Karma: 3
Posts: 717
Old, decrepit curmugeon
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The issue is defiantly not impatient students, i try to do it with their boards and i get the same error. My money is on Wandersons conclusion of electrical noise. The question is what can be done to stop the electrical noise? and what pins would most likely cause the com port in use problem if they were exposed to the electrical noise?

Motor shield files

https://sites.google.com/a/theprojectinventory.com/envertech/enver-creek-engineering/scamatics/motorshieldarduino2.sch?attredirects=0&d=1

https://sites.google.com/a/theprojectinventory.com/envertech/enver-creek-engineering/scamatics/motorshieldarduino2.brd?attredirects=0&d=1
If your using a usb connection there are only four pins (2 data and power).  The electrical noise generated by motors affects everything in the circuit....  The best solution is to isolate the motor shield in particular isolate the motors power supply. A separate regularltor works best but lc filters can help as well.
« Last Edit: June 08, 2012, 08:48:12 pm by wanderson » Logged

New true random number library available at: http://code.google.com/p/avr-hardware-random-number-generation/

Current version 0.7.2

Offline Offline
Newbie
*
Karma: 0
Posts: 36
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


I have had this error frequently

It happens when you have several megas or unos with different com port designations

Usually you have to close the arduino window and restart the program -- it doesn't matter what is hooked to the arduino -- I get it with no shields hooked up -- just doing the blink program for example

Sometimes going into the tools/serial port and selecting the correct com will work



Logged

UK
Offline Offline
Shannon Member
****
Karma: 184
Posts: 11179
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If the problem goes away when you remove the shield, that does point to it being an Arduino electrical problem rather than an IDE/USB configuration issue on the PC side. Does the shield do anything when the reset line is pulled down at the start of uploading? Does it do anything to the serial send/receive pins? If it has a separate power supply and/or external electrical connections to motors etc, does it make any difference if you disconnect all that and just leave the shield itself connected?
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Surrey BC
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

the shield is not using the serial pins. It plugs into 5 volts (l293d only), ground, and pins 6,9,10,11. On the shields with the error problem the error occurs when the shield is plugged in to the arduino and without the secondary power hooked up. Holding down reset at the start of the upload does not seem to do anything, but i will test that on some of the other boards during the class today.
Logged

High School Engineering Teacher

UK
Offline Offline
Shannon Member
****
Karma: 184
Posts: 11179
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I didn't really mean to suggest that you held the reset button down.

I was thinking more along the lines of the shield doing something when the PC triggers the reset at the start of uploading. Either by being connected to the reset line and affecting the timing of the reset somehow, or doing something internally because of the reset that might affect the Arduino. (I'm thinking of hardware initialisation leaving the inputs/outputs in an undefined state that causes a transient brown-out on the supply, something like that.)
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Surrey BC
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I have been testing this shield with the Leonardo for a month now. i have never lost the COM port while using it. The UNO still has the problem and it boggles my mind, but with the Leonardo working i have a solution.
Logged

High School Engineering Teacher

Pages: [1]   Go Up
Jump to: