Uploding with avrdude

Hello,

thanks for this DTR pulse tip! Here is a slightly enhanced version of the Perl code, that automatically determines the serial port from the -P avrdude parameter and calls the avrdude program after the DTR pulse. Rename the original avrdude to avrdude.org and store the Perl script under the name avrdude. Don't forget to make it executable.

Now programming with the Eclipse AVR-plugin always works without any problems. Another advantage: if no Arduino is connected to USB, the script immediately returns with an error (instead of having avrdude waiting for a timeout).

#!/usr/bin/perl -w
use Device::SerialPort;
use FindBin qw($Bin);
foreach (@ARGV)
{
    if ($_ =~ /-P(\/dev\/.+USB.+)/)
    {
        print (STDERR "Resetting DTR on " . $1 . "\n");
        Device::SerialPort->new($1)->pulse_dtr_on(100);
        last;
    }
}
select(undef, undef, undef, 0.1);
print (STDERR "Executing avrdude\n");
system($Bin . "/avrdude.org " . join(" ", @ARGV));