Go Down

Topic: Arduino GUI Works but not Command Line (Read 1 time) previous topic - next topic

aut0pilot101

Hi all!

I just got my new Duemilanove in the mail, and I just uploaded and ran my first program using the provided Java GUI.  However, I'm kind of a VI/command-line control freak and I'd like to be able to code and run my programs from the command line.

Anyway, to try and reverse engineer how the GUI was burning the code to the uC, I put it into verbose mode.  This is the command it used:

Code: [Select]
hardware/tools/avrdude -Chardware/tools/avrdude.conf -v -v -v -v -pm328p -cstk500v1 -P/dev/ttyUSB0 -b57600 -D -Uflash:w:/raid/Programming/uC/arduino/examples/Digital/Blink/applet/Blink.hex:i

Then the program dumps all the serial communication to the screen, avrdude thanks me for playing, and I get to watch my uC blink itself into oblivion (hooray!).  But when I try the exact same call directly from the command line...

Code: [Select]
hardware/tools/avrdude -Chardware/tools/avrdude.conf -v -v -v -v -pm328p -cstk500v1 -P/dev/ttyUSB0 -b57600 -D -Uflash:w:/raid/Programming/uC/arduino/examples/Digital/Blink/applet/Blink.hex:i

...I get the following output:

Code: [Select]
avrdude: Version 5.4-arduino, compiled on Oct 22 2007 at 13:15:12
        Copyright (c) 2000-2005 Brian Dean, <<url omitted>>

        System wide configuration file is "hardware/tools/avrdude.conf"
        User configuration file is "/home/bumbleskunk/.avrduderc"
        User configuration file does not exist or is not a regular file, skipping

        Using Port            : /dev/ttyUSB0
        Using Programmer      : stk500v1
        Overriding Baud Rate  : 57600
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: Send: Q [51]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding


I'm guessing that there is some setting or environment variable that the GUI tweaks behind the scenes that I don't know about...  I guess that's where you guys come in.

I know this is all pretty nitpicky, but I'd really like to automate the compile/upload process.  All comments/suggestions are appreciated!

jvanoort

#1
Apr 29, 2009, 11:25 pm Last Edit: Apr 29, 2009, 11:25 pm by jvanoort Reason: 1
Hi,

I'm not an expert on this by any measure, but the source to the IDE is freely available, so perhaps you can try and find this out by poking around in the code?

Just my 2 cts...

Jesse

aut0pilot101

Yeah, I tried to.  I managed to find the .java file that calls avr-dude and stepped my way through the program, but I couldn't find anything suspect.

I was honestly hoping one of the developers would know what I'm doing wrong (or not doing right).

Not a critical problem, I guess.  It's just that Linux compatibility is the main reason I went with Arduino.  It was a sad day when it turned out I couldn't program it from the command-line. :(

The Clever Monkey

Take a look in the Makefile shipped with Arduino package.  It has all the options it passes to avrdude.  The one I started with is hardware/cores/arduino/Makefile.

I posted elsewhere on this forum how I build sketches from the command line (i.e., have the Makefile create a proper C++ file from the stub of the sketch.)

This is a bit of hack, though.  Once you start adding libraries you have to tweak the Makefile so it can find headers and such.  And a Makefile won't automagically make any third-party libs you drop into the Arduino dev tools tree like the IDE does.

But if you are familiar with Make, then you should be able to figure this out.
I yield() for co-routines.

bohne

The makefile in the hardware core directory can be used to build the sketches... simply copy the makefile to your sketch directory and call "make" on your shell... but the makefile does something different than the UI... for the UI you should have a look here:
http://code.google.com/p/arduino/source/browse/tags/0015/app/AvrdudeUploader.java

I am not sure about the status of the makefile, some bugfixes were added with the 0015 release I guess. But since I don't use 0015 I can't really say something about the makefile. Oh and when I write makefile I mean this one:
http://code.google.com/p/arduino/source/browse/tags/0015/hardware/cores/arduino/Makefile
http://www.dorkbot.de
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1236434254
http://www.luminet.cc

aut0pilot101

The fact of the matter is, once I have a .hex file I should only have to make one call to avrdude before I'm up and running.  And I know the call and its arguments are correct because they're identical to the ones used by the UI, which uploads without any problems.

Something strange must be going on inside the UI's code, right?  Either it's not reporting the right avrdude command or it's manipulating serial communication behind the scenes.

aut0pilot101

By the way, the makefile shipped with version 0015 has broken links.  The arduino project's directory structure changed and the changes weren't reflected in the makefile.  I've updated my makefile's references so that it no longer complains when I call 'make', but avrdude still fails.

The Clever Monkey

Do you see any TX/RX activity on the device when you try to upload via avrdude?  Is something else using ttyusb0?  Looks to me that avrdude can't get a serial connection, or the stk500 protocol it is expecting is not correct.
I yield() for co-routines.

mellis

The IDE resets the board just before uploading.  You'll need to press the reset button on the board a second or so before the upload starts.

Go Up