SparkFun’s FTDI Basic Breakout as an AVR programmer

screenshot1

Start by following my instructions for setting up AVRDUDE 5.8 with FTDI bitbanging support.

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 3×2 ISCP 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

Edit 2010-04-18:

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
This entry was posted in Electronics, Programming. Bookmark the permalink.

4 Responses to SparkFun’s FTDI Basic Breakout as an AVR programmer

  1. Pingback: AVRDUDE 5.8 with FTDI bitbang patch on Linux | Doswa

  2. Pingback: problems uploading to mignon gamekit arduino // kaotec

  3. Pingback: Kaoss Guitar - Day 1 | Doswa

  4. antoine says:

    Thanks a lot for the tutorial. After a bit of tinkering, I got it to work. My problem was that I was programming an ATmega328p on a breadboard so it was (until I figured it out) missing a pull-up resistor on the RESET line.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">