Description: This is an adaptation of the work by Kimio Kosaka, Nate Phillips, and Massimo. It allows you to use AVRDUDE with an FTDI chip (like the one on the Arduino boards or SparkFun’s FTDI Basic Breakout). This can be useful if you manage to brick your Arduino and you have no programmer.
—————————
If you’re on Ubuntu or Debian, install the prerequisites with:
sudo apt-get install patch build-essential libreadline-dev libncurses-dev libusb-dev sudo apt-get build-dep avrdude avrdude-doc
—
Start by grabbing a copy of AVRDUDE 5.8, untarring it in the directory, and switching to that directory:
wget http://download.savannah.gnu.org/releases-noredirect/avrdude/avrdude-5.8.tar.gz tar xzf avrdude-5.8.tar.gz cd avrdude-5.8
—
Now get a copy of the FTDI bitbang patch files:
for i in 8 7 6 5 4 3 2 1 0; do wget -O patch-$i.diff http://savannah.nongnu.org/patch/download.php?file_id=1851$i; done
—
Apply the patches:
for file in patch-*.diff; do patch -p0 < $file; done
—
Also get a copy of the FTDI driver. For 32-bit:
wget http://www.ftdichip.com/Drivers/D2XX/Linux/libftd2xx0.4.16.tar.gz
For 64-bit:
wget http://www.ftdichip.com/Drivers/D2XX/Linux/libftd2xx0.4.16_x86_64.tar.gz
—
Extract the FTDI driver and copy over the needed files:
tar xzf libftd2xx*.tar.gz cp libftd2xx*/static_lib/* . cp libftd2xx*/*.h . cp libftd2xx*/*.cfg .
—
Generate your makefile:
./configure—
Open Makefile in a text editor and perform the following operations:
- Find the line
CFLAGS = -g -O2and replace it withCFLAGS = -g -O2 -DHAVE_LIBUSB -DSUPPORT_FT245R. - Find the line
LIBS = -lreadline -lncurses -ltermcapand replace it withLIBS = -lreadline -lncurses -ltermcap ./libftd2xx.a.0.4.16 -lrt.
—
Now to actually compile it:
make—
From here, you can follow the instructions at http://www.geocities.jp/arduino_diecimila/bootloader/index_old_en.html starting at step 5. Note that you’ll need to modify the commands a little bit. Instead of:
avrdude -c diecimila -P ft0 -p m168
you should write:
sudo ./avrdude -C avrdude.conf -c duemilanove -P ft0 -p m168
(Note: you can still use it on a Diecimila, just specify the programmer as `-c duemilanove` and it should work.)
If you’d like to use SparkFun’s FTDI Basic Breakout as a programmer, try these instructions.
Pingback: SparkFun’s FTDI Basic Breakout as an AVR programmer | Doswa
This is great, David!
I’ll have to give it a go when I get some free time after the holidays. Thanks for the update!
Hi there. since a couple of days im trying to run stk500v2 with avrdude under ubuntu. its a disaster! could you tell me where can i find some instructions to follow that could help me?
ive instaled nearly milion packages ;) with drivers software etc.
after:
$ avrdude -p 2313 -P /dev/ttyUSB3 -c stk500v2 -Uflash:w:a.hex
goes:
avrdude: stk500v2_command(): command failed
avrdude: stk500v2_command(): unknown status 0xc9
avrdude: stk500v2_program_enable(): cannot get connection status
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
any idea whats wrong? cheers
ps. dont want to come back to s@#% vista :(
sorry but forgot to write:
after sudo ./avrdude -C avrdude.conf -c duemilanove -P ft0 -p m168
there comes the same thing
Hi Tomek,
These directions are actually for the FT232R chip from FTDI. It’s not related to STK500v2.
Anyway, it looks like the AVR isn’t responding to your programmer. What device are you trying to program? To AVRDUDE, `2313` means AT90S2313. Did you mean to program the ATtiny2313? If so, you should pass `t3213` to AVRDUDE instead.
Failing that, the people at AVR Freaks might be able to help you if you ask nicely and include the “-vvv” (short for very, very verbose) flag in your AVRDUDE command.
David
thank you very much for respond. im pretty messed up all of that ;) stk500v2 uses FT232R am i wrong? ive installed any driver, anyone claimed that is necessary but i still think, the problem is lack of right communication between the computer and ft232r. thanks for answer, ill try to search avr freaks – its impossible im the first one who has such a problem ;)
cheers
Great stuff, patched into avrdude 5.10 – works fine!
I burned arduino 2009 with ATmega168.
Hi,
I’ve struggled with the FedoraCore10 and libusb and libftdi to get things working without sudoing the application that uses libftdi. My problem is that kernel does load ftdi_sio module and set up permissions for /dev/ttyUSB0 and /dev/bus/usb/*/* outside the /etc/udev descriptions. So the access rights description coming with libftdi do not work.
I made special file “/etc/udev/rules.d/local.rules” and wrote there
KERNEL==”*”, MODE=”0660″, BUS==”usb”, SYSFS{idVendor}==”0403″, GROUP=”ftdi”
The users that need to use the usb device are in group “ftdi” in this case. Now the /dev/ttyUSB0 and /dev/bus/usb/004/003 are with correct permissions.
Hi,
I have tested your method with the latest avrdude (5.10) on Ubuntu 9.10 64bit and it works great. Thanks.
Works great.
Used Ubuntu 9.10, 32bit w/ avrdude 5.8 running in Virtual Box on a Snow Leopard MacBook Pro (avrdude via macports segfaulted on write).
FTDI is TTL-232R-3V3 from Digikey (part no. 768-1015-ND). Tested w/ ATMega644P w/ 16Mhz ceramic resonator (Digikey part no. X908-ND).
Used FTDI cable to microcontroller pin mapping from http://exmrclean.blogspot.com/2009/05/burning-avr-boot-loader-with-usb-ttl.html
Thanks!
Anyone who got this working under MacOS? I am stuck with the configure script, stating that my gcc cannot produce executables (though I’m not sure that’s the actual error)
@lundnul
I believe a friend of mine got it working under Mac OS X. I’ll talk to him and see if he can help you out.
Awesome! All I had laying around was a few FT232R chips and I needed an AVR ISP for an ATmega8L and this worked just great. Thank you.
@lundnul
I talked to my friend and he said he’s using the serjtag variant of the avrdude package from MacPorts.
http://www.macports.org/ports.php?by=variant&substr=serjtag