This guide has been merged into my AVRDUDE 5.10 bitbang guide. Original post follows (left here for reference).
Now open up
avrdude.conf in a text editor. Add this entry by the other programmers:
# FTDI basic breakout programmer id = "ftdi"; desc = "FTDI Basic Breakout"; type = ft245r; miso = 1; # RxD sck = 3; # CTS mosi = 0; # TxD reset = 4; # DTR ;
Now you can attach your FTDI Breakout to the target AVR like this:
FTDI -> MCU (ATmega168 PDIP pin) -------------------------------- DTR -> RESET (1) RXI -> MISO (18) TXO -> MOSI (17) 5V -> VCC (7 & 20) CTS -> SCK (19) GND -> GND (8 & 22)
With the 3x2 ICSP header on the Arduino, that would look like this:
+----------------+ [RXI]--o| 1 MISO +5V 2 |o--[5V] [CTS]--o| 3 SCK MOSI 4 |o--[TXO] [DTR]--o| 5 RESET GND 6 |o--[GND] +----------------+
Note that may need to supply the AVR with an external oscillator or clock source. For virgin ATmega168s, you won't need to (because it initially uses the internal oscillator), but you'll need an external crystal oscillator if you're using one that came out of an Arduino.
From there you can use AVRDUDE like normal using the
-c ftdi switch. For example, to read fuse bytes:
sudo ./avrdude -C avrdude.conf -c ftdi -p m168 -P ft0 -U hfuse:r:-:h -U lfuse:r:-:h -U efuse:r:-:h
I just found out that new AVRs need to have the clock rate adjusted before this will work. This is because AVRs come with the internal clock set to 1 MHz (actually, 8 MHz with the CKDIV8 fuse bit set) instead of the Arduino default 16 MHz. This can be done with AVRDUDE's
-B option. This option determines what clock is fed into the AVR's SCK pin. I recommend starting with a value of
-B 1 and working your way up to a reasonable clock speed. Here is the adjusted command for new AVRs:
sudo ./avrdude -C avrdude.conf -c ftdi -p m168 -P ft0 -U hfuse:r:-:h -U lfuse:r:-:h -U efuse:r:-:h -B 1