Pages: [1]   Go Down
Author Topic: Unreliable programming with new Arduinos  (Read 1256 times)
0 Members and 1 Guest are viewing this topic.
Near Frankfurt, Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 22
I made it. I can fix it.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi!

In an attempt to get up to date with the current state of Arduino, I ordered two Micros and two Leonardos. Unfortunately, I'm having a bit of an issue trying to upload sketches to both. About 4 in 5 uploads fail with the following error:

Code:
processing.app.SerialException: Serial port '/dev/tty.usbmodem24111' already in use. Try quitting any programs that may be using it.
at processing.app.Serial.touchPort(Serial.java:119)
at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:201)
at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:67)
at processing.app.Sketch.upload(Sketch.java:1671)
at processing.app.Sketch.exportApplet(Sketch.java:1627)
at processing.app.Sketch.exportApplet(Sketch.java:1599)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2380)
at java.lang.Thread.run(Thread.java:680)
My workaround right now is to repeatedly click Upload until it succeeds. Any idea what this is? Uploads to my Duemilanove (FTDI-Interface) with Optiboot work without error. This is on Mac OS 10.7. Happens with the cable directly on my laptop and on the USB hub.
Logged

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


At the first occurrence of the error, are one or more instances of avrdude running?
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Please don't be insulted if I am mentioning things that you already knew, but since I don't know all the details, I'll try to cover it.

1. Is one arduino the only thing plugged in besides a mouse and keyboard?
2. How sure are you that you're on the right port? If you're using more than one arduino they might assign different ports when plugged in. Iv'e even seen the serial ports change when plugging into a different USB port.
3. Did you select the correct board?
4. Are you using the latest Arduino IDE release?
5. Is the terminal window open? (Close it)
6. Did you try to reboot?
7. Can you try force quitting any apps that have nothing to do with the arduino other than the finder (or whatever Mac OSX calls the user interface)?
8. Do you use any other devices that could be using a serial interface (modem, terminal emulator, usb to serial cable) ?

« Last Edit: January 19, 2013, 03:36:01 pm by stonent » Logged

Offline Offline
Faraday Member
**
Karma: 61
Posts: 2898
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I get similar problems to this,   and it has been a problem ever since I got the Arduino.

First it says the COM port is busy.   Then it says the COM port doesn't exist.   It is an endless
run-around of plugging and unplugging the USB cable,  using the external wall-wart power, or not,
restarting the IDE incessantly,  rebooting the computer.....

A lot of the time,  it appears to be trying to upload the compiled arduino sketch to my mouse.

Sometimes it works,  sometimes it takes a few tries to get it to work,   sometimes it progresses
to hours of window-smashing frustration.   

I would really like to know what is the REAL problem here,   because whatever the various error
messages are,  they are not the real problem.
Logged

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

I get similar problems to this...

There is a question in reply #1.  You failed to answer the question.  If you don't answer questions no one will be able to help.
Logged

Offline Offline
Faraday Member
**
Karma: 61
Posts: 2898
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
C:\Users\Robert\AppData\Local\Temp\build4428593973120486394.tmp\MyBlink.cpp.hex
Binary sketch size: 1,624 bytes (of a 258,048 byte maximum)
processing.app.SerialException: Serial port 'COM4' already in use. Try quiting any programs that may be using it.
at processing.app.Serial.<init>(Serial.java:171)
at processing.app.Serial.<init>(Serial.java:77)
at processing.app.debug.Uploader.flushSerialBuffer(Uploader.java:77)
at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:172)
at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:67)
at processing.app.Sketch.upload(Sketch.java:1706)
at processing.app.Sketch.exportApplet(Sketch.java:1662)
at processing.app.Sketch.exportApplet(Sketch.java:1634)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2346)
at java.lang.Thread.run(Thread.java:619)
processing.app.debug.RunnerException: Serial port 'COM4' already in use. Try quiting any programs that may be using it.
at processing.app.debug.Uploader.flushSerialBuffer(Uploader.java:101)
at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:172)
at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:67)
at processing.app.Sketch.upload(Sketch.java:1706)
at processing.app.Sketch.exportApplet(Sketch.java:1662)
at processing.app.Sketch.exportApplet(Sketch.java:1634)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2346)
at java.lang.Thread.run(Thread.java:619)

This is the error message I am getting today.    according to windows task manager,  there is one instance of avrdude.exe running.
Logged

Offline Offline
Faraday Member
**
Karma: 61
Posts: 2898
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
Binary sketch size: 1,624 bytes (of a 258,048 byte maximum)
C:\Users\Robert\Java\Arduino\arduino-1.0.1\hardware/tools/avr/bin/avrdude -CC:\Users\Robert\Java\Arduino\arduino-1.0.1\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega2560 -cstk500v2 -P\\.\COM4 -b115200 -D -Uflash:w:C:\Users\Robert\AppData\Local\Temp\build5232822757627304353.tmp\MyBlink.cpp.hex:i

avrdude: Version 5.11, compiled on Sep  2 2011 at 19:38:36
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\Users\Robert\Java\Arduino\arduino-1.0.1\hardware/tools/avr/etc/avrdude.conf"

         Using Port                    : \\.\COM4
         Using Programmer              : stk500v2
         Overriding Baud Rate          : 115200
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14]
avrdude: Recv:
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14]

And then,  sometimes,  I get crap like this.   Which works no better.
Logged

Offline Offline
Faraday Member
**
Karma: 61
Posts: 2898
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

And then,  on about the 17th reboot of the IDE,  it works.
Logged

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

processing.app.SerialException: Serial port 'COM4' already in use. Try quiting any programs that may be using it.
This is the error message I am getting today.    according to windows task manager,  there is one instance of avrdude.exe running.

That happens if you try to upload while an upload is still in-progress.  Wait for an upload to finish or timeout before trying again.  You can use Task Manager to kill running instances of avrdude to speed the recovery process.
Logged

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

avrdude: Recv:
avrdude: stk500v2_ReceiveMessage(): timeout
And then,  sometimes,  I get crap like this.   Which works no better.

I don't have an Arduino Mega 2560 so I can't help much with that problem.

Does the problem persist with nothing except a USB cable connected to the board?

Did you have this problem with the board when you first got it?
Logged

Offline Offline
Faraday Member
**
Karma: 61
Posts: 2898
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have had this problem intermittently ever since I got both of the Mega 2560 which I have.

I have had this problem with IDE version 22 and 23  and 1.01

I have had this problem with three different Windows 7 computers.

The sequence of restarts and unpluggings and reboots which works one time,   does not work the next time.
Logged

Offline Offline
Faraday Member
**
Karma: 61
Posts: 2898
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

And another thing:

How come, when I start the IDE,  it sometimes comes up with the last sketch I used,   and sometimes comes up with a useless new blank sketch,  which I then have to delete.

Why does it do this ?

If it is supposed to be saving the name of the last sketch I used,   in some config file or registry entry somewhere,   why doesn't this happen every time ?   It would not surprise me if this bogus behaviour is somehow linked to the COM port conflict.
Logged

Offline Offline
Faraday Member
**
Karma: 61
Posts: 2898
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

At what point in the upload process,   should it be expected that the sketch already running on the Arduino should stop ?

If the sketch already running on the Arduino is writing stuff to the computer through the serial/USB connection,   does this interfere with the process of uploading the new sketch ?

If you write a sketch which writes serial data to the computer,  like this one:
Code:
#include <Arduino.h>

#define LEDPIN (13)

void setup() {               
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(LEDPIN, OUTPUT);     
  Serial.begin(9600);
}

void loop()
{
  int cyc=500 ;
  digitalWrite(LEDPIN, HIGH);   // set the LED on
  delay(cyc);              // wait for a second
  digitalWrite(LEDPIN, LOW);    // set the LED off
  delay(cyc);              // wait for a second
  Serial.println("tick");
}

And then I start the serial monitor, set the speed to 9600,  and I see   
tick
tick
tick

and then I close the serial monitor,  and start the serial monitor again,    then I don't see any tick.
Should I expect not to see any tick,   the second ( third, fourth ) time I start the serial monitor ?

Logged

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

Quote
I have had this problem with three different Windows 7 computers.

Is the operating system up-to-date?  Have you tried updating the driver?

At what point in the upload process,   should it be expected that the sketch already running on the Arduino should stop ?

Immediately after compiling.  I believe, at the point the message "Uploading..." is displayed, the board should reset.

Quote
If the sketch already running on the Arduino is writing stuff to the computer through the serial/USB connection,   does this interfere with the process of uploading the new sketch ?

It can.  But not with the sketch you posted.

Quote
If you write a sketch which writes serial data to the computer,  like this one ... And then I start the serial monitor, set the speed to 9600,  and I see ... and then I close the serial monitor,  and start the serial monitor again,    then I don't see any tick.

Does the pin 13 LED continue to blink?

Have you tried a different USB cable?
Logged

Pages: [1]   Go Up
Jump to: