AVRDude reports that serial port not found #7

Closed
jbernardis opened this Issue Feb 25, 2012 · 12 comments

Comments

Projects
None yet
4 participants

Ubuntu
Eclipse Indigo
Arduino IDE 1.0
Plugin version 1.2.0

When I try to upload to my arduino, I get a dialog box that states that the port doesn't exist. I dismiss the dialog box, and then the upload happens normally. It asks me if I've chosen the correct port on the properties page. When I go to the properties page, the port DOES appear to be a drop-down list, but the drop-down button is disabled. So I just enter my port name: /dev/ttyACM0 - this is the same port name as is used by the arduino IDE.

I noticed that the port name appears in two places - on the project properties page for Arduino, and under each configuration for AVRDUDE. If I remove the port name from the arduino page, I get the same result. If I remove the port name from the avrdude configuration, I get a different error and it seems to be trying to use an alternate port name.

I guess since it ultimately works, this isn't really a bug, but I thought I should bring it to your attention.

BTW - this is a GREAT plugin. I'm so happy that there is a professional alternative to the Arduino IDE.

Owner

jantje commented Feb 25, 2012

jbernardis
Thanks for logging this issue.
To pinpoint the issue I need the stack trace. Go to windows->show view -> others; there under general select "error log". Now you should have an extra window called error log containing all error that happened after startup.
There are probably several errors logged there. If you keep an eye on it you'll see that there is an error logged when you open project properties->arduino->arduino. Also an error should be logged when the dialog box appears.
If you double click on the error you should see the error stack trace. I need this to investigate why you get the dialog box.
Are you using a 32 bit or a 64 bit Ubuntu?
Best regards
Jantje

Jantje

Thanks for looking into this.

Nothing appears in the error log when I choose
Properties->arduino->arduino, however, when I try to upload a binary to the
arduino, I get 3 messages in the log.

I get the following error twice:

Serial port /dev/ttyACM0 not found.  Did you select the right one from

the project->properties->Arduino->Arduino?

An exception stack trace is not available

And the I get this warning:

Failed to handle Com port properly

java.lang.NullPointerException
    at it.baeyens.arduino.arduino.Serial.setDTR(Serial.java:503)
    at it.baeyens.arduino.common.Common.ResetArduino(Common.java:332)
    at

it.baeyens.avreclipse.ui.actions.UploadProjectAction$UploadJob.run(UploadProjectAction.java:409)
at org.eclipse.code.internal.jobs.Worker.run(Worker.java:54)

Here is the information that appears at the bottom of the details windows.
It appears to be the same for all three messages:

eclipse.buildid=M20110909-1335
java.version=1.6.0_23
java.vendor=Sun Microsystems Inc.
Bootloader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US
Framework arguments: -product org.eclipse.epp.package.cpp.product
Command-line arguments: -os linux -ws gtk -arch x86 -product

org.eclipse.epp.package.cpp.product

Incidentally, I am running 32 Bit Ubuntu - I can't remember the version
number, but it's fully up to date - 11.10 I believe, but I could be wrong
and I can't see where to find out.

Jeff

On Sat, Feb 25, 2012 at 1:50 PM, jantje <
reply@reply.github.com

wrote:

jbernardis
Thanks for logging this issue.
To pinpoint the issue I need the stack trace. Go to windows->show view ->
others; there under general select "error log". Now you should have an
extra window called error log containing all error that happened after
startup.
There are probably several errors logged there. If you keep an eye on it
you'll see that there is an error logged when you open project
properties->arduino->arduino. Also an error should be logged when the
dialog box appears.
If you double click on the error you should see the error stack trace. I
need this to investigate why you get the dialog box.
Are you using a 32 bit or a 64 bit Ubuntu?
Best regards
Jantje


Reply to this email directly or view it on GitHub:

jantje#7 (comment)

Owner

jantje commented Feb 28, 2012

Jeff
I've investigated this issue and now I understand what is going on. it is difficult to explain because several things are at play.
To understand the picture you need to know that the rxtx code I use (the same as arduino) uses a library called "librtxserial.so" on Linux. In 1.2.0 I added this code to reset the arduino before upload (Like the arduino IDE does)
However because I'm uncertain about the code I surrounded it with a try catch e exception. Which basically means: "if something is wrong log an error and continue"
In your case there are no errors on loading the library. So it seems like the library is loaded. However you do not see comports in project settings-> arduino->arduino and you do not get errors. For instance "could not load library"
So it seems the library gets loaded but the library doesn't find the com ports.
When you upload the sketch the plugin wants to reset Arduino. Therefore it starts the rxtx library with the "librtxserial.so" which works and then loops over the "available com ports" to find the port that is used. However the library doesn't find the name and therefore it logs an error (pops up a dialog box as well as this is really an error situation) and continues with asking avrdude to do the upload. Which works.

So there must be something wrong with the library I deliver or some configuration (I know it took me a long time to get it to work with suse).
Can you remember doing something special for this with the arduino IDE?
Can you replace the library I deliver with the one Arduino IDE delivers? Maybe this will make it work.
Please keep me posted.
best regards
Jantje

Jantje

I did nothing to set this port up. In fact I did not even know what
the device name would be. I just loaded up the Arduino IDE, went to
choose the port, and it was there.

I tried changing to the arduino library, and still the same result.
To be clear, I copied the librxtxSerial.so from ~/arduino-1.0/lib into
~/eclipse/configuration/org.eclipse.osgi/bundles/314/1/.cp. These
were the only directories I could find this file in (except for
processing directories which I ignored). I even tried rebooting
after the copy thinking that the old image might still be in memory.

If there is anything you want me to try, I just want to let you know
that I am not intimidated by doing any of these things. I am a
professional software developer with over 30 years of experience, and
I use eclipse at work for java development and at home for perl and
python. I am somewhat new to c++, but the basics are the same.
Although this is a nuisance more than an issue, if you want to track
it down, I'm more than happy to work with you.

Jeff

P.S. thanks for the other tips regarding the indexer settings. It is
much more accepatble with these settings, so we'll see how it goes.

On Tue, Feb 28, 2012 at 3:59 PM, jantje
reply@reply.github.com
wrote:

Jeff
I've investigated this issue and now I understand what is going on. it is difficult to explain because several things are at play.
To understand the picture you need to know that the rxtx code I use (the same as arduino) uses a library called "librtxserial.so" on Linux. In 1.2.0 I added this code to reset the arduino before upload (Like the arduino IDE does)
However because I'm uncertain about the code I surrounded it with a try catch e exception. Which basically means: "if something is wrong log an error and continue"
In your case there are no errors on loading the library. So it seems like the library is loaded. However you do not see comports in project settings-> arduino->arduino and you do not get errors. For instance "could not load library"
So it seems the library gets loaded but the library doesn't find the com ports.
When you upload the sketch the plugin wants to reset Arduino. Therefore it starts the rxtx library with the "librtxserial.so" which works and then loops over the "available com ports" to find the port that is used. However the library doesn't find the name and therefore it logs an error (pops up a dialog box as well as this is really an error situation) and continues with asking avrdude to do the upload. Which works.

So there must be something wrong with the library I deliver or some configuration (I know it took me a long time to get it to work with suse).
Can you remember doing something special for this with the arduino IDE?
Can you replace the library I deliver with the one Arduino IDE delivers? Maybe this will make it work.
Please keep me posted.
best regards
Jantje


Reply to this email directly or view it on GitHub:
jantje#7 (comment)

Owner

jantje commented Mar 4, 2012

If you're not scared you may download the code and see what is going wrong on your computer.
Afterall the plugin is java and not C++
for the upload you could set a breakpoint in the project it.baeyens.arduino.common in the file src/it.baeyens.arduino/common/Common.java in the method "ResteArduino"
For the listing of comports you could set a breakpoint in the same file at listComPorts
I hope you can fix it and tell me what needs to be done.
Best regards
Jantje

OK - I solved it through configuration alone.

I editted the eclipse.ini file (in the eclipse directory) as follows:

openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Dgnu.io.rxtx.SerialPorts=/dev/ttyACM0 <==== Added this line
-XX:MaxPermSize=256m
-Xms40m
-Xmx384m

Now /dev/ttyACM0 shows up in the drop down list and the upload works
without error. The only caveat is that
the Arduino needs to be physically connected. If it is not connected,
the port doesn't exist. I don't know what happens in that case, but
at the worst, I'd have to exit eclipse and re-enter.

Jeff

On Mon, Mar 5, 2012 at 12:16 PM, jeff bernardis
jeff.bernardis@gmail.com wrote:

Jantje,

I'm not certain aboiut this, but I think I have isolated where the problem is.

RXTXCommDriver.java, near line 530, limits Serial Ports under Linux to
those beginning with ttyS, ttySA, or ttyUSB.  On my Ubuntu system, my
port is ttyACM0 - it does not confirm to any of these.  Even if we
were to use the osname Linux-all-ports, we would not match the device
name.

I think this can be changed via a system property named
gnu.io.rxtx.SerialPorts, but I'm not sure how to do this.  The logic
for loading this (same file ~line 836) looks like it is looking for a
.properties file in java.ext.dirs.  When I get home this evening, I am
going to search for this file and see if I can figure out how to
modify it.

Jeff

On Sun, Mar 4, 2012 at 3:13 PM, jantje
reply@reply.github.com
wrote:

If you're not scared you may download the code and see what is going wrong on your computer.
Afterall the plugin is java and not C++
for the upload you could set a breakpoint in the project it.baeyens.arduino.common in the file src/it.baeyens.arduino/common/Common.java in the method "ResteArduino"
For the listing of comports you could set a breakpoint in the same file at listComPorts
I hope you can fix it and tell me what needs to be done.
Best regards
Jantje


Reply to this email directly or view it on GitHub:
jantje#7 (comment)

Owner

jantje commented Mar 6, 2012

jeff
It starts to make sense. it looks like /dev/ttyA* is not a valid pattern for ubuntu.
By adding the command line to eclipse ini you specify the com port as "valid" which make it pass the pattern validation.
There should be no drawback. but as always
In theory there is no difference between theory and practice
in practice there is
best regards
Jantje

aguegu commented May 16, 2012

I add "-Dgnu.io.rxtx.SerialPorts=/dev/ttyACM0" to eclipse.ini
It really works, and no more error prompt.

In my case, I have several arduino boards plugged at the same time, like /dev/ttyACM0 and /dev/ttyUSB0. How could I set the value to the Dgnu.io,rxtx.SerialPorts ?

I have tried space, ",", ";". do not work..

Owner

jantje commented May 16, 2012

Guan
I really don't know
Best regards
Jantje

On 16-May-12 12:09, Weihong Guan wrote:

I add "-Dgnu.io.rxtx.SerialPorts=/dev/ttyACM0" to eclipse.ini
It really works, and no more error prompt.

In my case, I have several arduino boards plugged at the same time, like /dev/ttyACM0 and /dev/ttyUSB0. How could I set the value to the Dgnu.io,rxtx.SerialPorts ?

I have tried space, ",", ";". do not work..


Reply to this email directly or view it on GitHub:
jantje#7 (comment)

aguegu commented May 23, 2012

As my further test, I believe this issue happens to UNO, which uses ATmega8u2 as the USB-to-Serial translator. In the case of older boards, which use classic USB-to-Serial chip, like max232, pl2303, cp2102, the serial detector in plugin works just fine.

Owner

jantje commented Sep 15, 2013

This is fixed by Michael pull request #36

jantje closed this Sep 15, 2013

fabdrol commented Aug 6, 2014

@jantje et al; this is not fixed for me, using v2.3 on ubuntu 14.04 x86_64. Tried with Arduino 1.5.2 and Arduino 1.5.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment