avrdude is giving me trouble.

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
SteveBaker
 
Posts: 59
Joined: Thu Jan 01, 2009 2:08 am

avrdude is giving me trouble.

Post by SteveBaker »

I'm not using the Arduino package - just the raw AVR toolset. Things have been going well until today.

I'm using this command to send my "main.hex" program to the Arduino (A Duemilanove board):

avrdude -V -F -p atmega168 -C ../lib/avrdude.conf
-P /dev/ttyUSB0 -c stk500v1 -b 19200
-U flash:w:main.hex

...at the beginning, I'd hit the reset button on the Arduino and hit RETURN to start avrdude running,
but as my program has grown larger, it's taking more time for avrdude to get started and the old
program that's in the Arduino starts running before avrdude talks to the boot loader to tell it to
start uploading.

Are there other ways to do this...it's getting so that it's taking half dozen tries to get the program loaded.

Very annoying!

Any help would be greatly appreciated.

Thnx.

jarv
 
Posts: 49
Joined: Tue Jan 02, 2007 5:48 pm

Re: avrdude is giving me trouble.

Post by jarv »

The way the arduino IDE gets around this (I think) is to pulse DTR on the serial line which resets the device.

If your development box is linux or if you install perl for windows this one-liner will work:
(will need to install the device::serialport module)

perl -MDevice::SerialPort -e 'Device::SerialPort->new("/dev/ttyUSB0")->pulse_dtr_on(100)'

I'm setup to execute that immediately before I call avrdude.

SteveBaker
 
Posts: 59
Joined: Thu Jan 01, 2009 2:08 am

Re: avrdude is giving me trouble.

Post by SteveBaker »

Yeah - I'm using Linux (SuSE 11.0 64bit as it happens).

I don't know any perl - and your command does this:

% perl -MDevice::SerialPort -e 'Device::SerialPort->new("/dev/ttyUSB0")->pulse_dtr_on(100)'
Can't locate Device/SerialPort.pm in @INC (@INC contains: /usr/lib/perl5/5.10.0/x86_64-linux-thread-multi
/usr/lib/perl5/5.10.0 /usr/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.10.0
/usr/lib/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.10.0
/usr/lib/perl5/vendor_perl .).
BEGIN failed--compilation aborted.

...is there some kind of Perl library that I need maybe? I guess "-MDevice::SerialPort" is directing perl to
find a library of some kind?

jarv
 
Posts: 49
Joined: Tue Jan 02, 2007 5:48 pm

Re: avrdude is giving me trouble.

Post by jarv »

yup, all you need is lib, look for the perl-device-serialport rpm.

SteveBaker
 
Posts: 59
Joined: Thu Jan 01, 2009 2:08 am

Re: avrdude is giving me trouble.

Post by SteveBaker »

Well - that got me a little further - now it says:

% perl -MDevice::SerialPort -e 'Device::SerialPort->new("/dev/ttyUSB0")->pulse_dtr_on(100)'
Can't call method "pulse_dtr_on" on an undefined value at -e line 1.

(Sorry to be so helpless - I just never got into Perl!)

SteveBaker
 
Posts: 59
Joined: Thu Jan 01, 2009 2:08 am

Re: avrdude is giving me trouble.

Post by SteveBaker »

Hmmm - putting the '-e' stuff into a file seems to make it work. Weird.

If I create wiggledtr.pl with:

Device::SerialPort->new("/dev/ttyS0")->pulse_dtr_on(100);

...then run

perl -MDevice::SerialPort wiggledtr.pl

...then it works just fine. OK - well - I'm not going to worry about it - everything's going OK now. Many thanks.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”