Boot loader and avrdude

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
KirkCharles
 
Posts: 1
Joined: Sun Nov 06, 2011 1:53 am

Boot loader and avrdude

Post by KirkCharles »

Greetings,
I am hoping to use the Arduino Bootloader (on a ATmega168) but not use the Arduino environment. I am running WinAVR-20080430

I am getting nearly nowhere.

Details of what I am trying to do:
* Arduino docs say they use avrdude. Cool
* I can not find the avrdude command line that the Arduino environment invokes.
* According to http://www.ladyada.net/library/arduino/bootloader.html "The bootloader is an 'stk500'-compatible, which means you can use good ol' AVRDUDE to program the arduino"

Details of what I have done:
* I can program the chip in the Arduino environment. No Problems.
*

Code: Select all

avrdude -p atmega168 -P COM12 -c avrisp    -U flash:w:main.hex
avrdude: ser_open(): can't open device "COM12": The system cannot find the file specified.
Rats, Arduino environment can do it. I thought perhaps they have a newer avrdude than WINavr but going to their directory with .\ before the command above gives the same result.
* Change the FTDI chip to COM1 then I get

Code: Select all

avrdude -p atmega168 -P COM1 -c avrisp    -U flash:w:main.hex
avrdude: stk500_getsync(): not in sync: resp=0x00
* OK I forgot the serial rate

Code: Select all

avrdude -p atmega168 -P COM1 -b19200 -c avrisp    -U flash:w:main.hex
avrdude: stk500_getsync(): not in sync: resp=0x18
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51
the frustrating thing id that it seemed to work once. I got the usual loading messages and no errors. Now I just get the errors above.

Any Ideas??

Thanks
Kirk

madworm_de
 
Posts: 99
Joined: Mon Jun 09, 2008 6:56 am

Re: Boot loader and avrdude

Post by madworm_de »

To invoke the bootloader, the chip must be reset (using the DTR / RTS line connected to the reset pin via a 100nF cap).

Get avrdude 5.11 or later and use "-c arduino" as the programmer type.

User avatar
cstratton
 
Posts: 294
Joined: Wed Sep 29, 2010 3:52 pm

Re: Boot loader and avrdude

Post by cstratton »

Rather crude, but when I faced that question, what I did (on a linux box) was rename /usr/bin/avrdude to avrdude-real and then substitute this shell script as the new /usr/bin/avrdude

#!/bin/bash
echo avrdude $@ > /home/my_username/avrdudelast
/usr/bin/avrdude-real $@

That way whatever options the arduino environment issued got logged to a file in my home directory which I could examine.

This was the result:

Code: Select all

avrdude -C/usr/share/arduino/hardware/tools/avrdude.conf -q -q -patmega328p -carduino -P/dev/ttyUSB0 -b57600 -D -Uflash:w:/tmp/build3146639631366612570.tmp/ArduinoISPSST1152200.cpp.hex:i

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

Return to “Arduino”