HOWTO avrdude+linux+diecimila

This short howto covers uploading from a terminal without using the arduino software at all.

  1. howto reset diecimila, then upload with avrdude just like arduino software

stty 19200 raw ignbrk hup < /dev/arduino && avrdude -cstk500 -b19200 -pm168 -P/dev/arduino

The key here is the 'hup' attribute which tells linux to toggle the DTR pin when the port is opened and closed. The DTR pin going low when the port is opened is what causes the diecimila to reset, so this is perfect.

NOTE: some linux kernels in the 2.6.22+ range had a bug in the ft232 driver where DTR is never de-asserted on close. Symptoms are, even with above code, diecimila only resets the first time you program after plugging in. patch is available at LKML: Bernardo Innocenti: [PATCH] ftdi_sio: fix FT232RL support for TIOCMGET if you are affected.

I put both of the above in a script for easy reference. Replace /dev/arduino with /dev/ttyUSB0 or whatever it is on your system, or continue reading

  1. howto ask udev to create a /dev/arduino symlink for you

I added

SUBSYSTEMS=="usb", ATTRS{product}=="FT232R USB UART", ATTRS{idProduct}=="6001", ATTRS{idVendor}=="0403", NAME="%k", SYMLINK+="arduino", MODE="0660"

to /etc/udev/rules.d/10-local.rules

If you'd like it to create particular symlinks for particular arduinos, run

udevinfo -a -p /sys/bus/usb/drivers/ftdi_sio/* | grep serial

and add the first line to the above udev rule with appropriate commas. The rule might look like:
SUBSYSTEMS=="usb", ATTRS{product}=="FT232R USB UART", ATTRS{serial}=="A1001Ncz", NAME="%k", SYMLINK+="arduino_1", MODE="0660"

which will create a /dev/arduino_1 symlink only for ft232R chips with that serial number.

Just wanted to say thanks for posting this info.

Just thought I'd add that I successfully reprogrammed the FT232RL on my diecimila to request 500mA from my USB port. See MProg tool from ftdichip.com. Unfortunately, I had to run it in virtualbox, ftdi_eeprom appariently doesn't support ft232R yet due to insufficient documentation from ftdi :frowning: