Howto: bootload an Arduino with a serial port

So the bootloader on my Arduino somehow got corrupt, which I ended up reflashing with a friend's Arduino. Turns out I flashed a buggy bootloader, so now I have to flash a good one. I did not want to wait for access to another Arduino again, so here's what I did:

  1. Install a standalone version of avrdude.
  2. Modify /etc/avrdude.conf and add the following into the file:
programmer
  id    = "arduinofixer";
  desc  = "reset=dtr sck=tx mosi=rts miso=cts";
  type  = serbb;
  reset = 4;
  sck   = 3;
  mosi  = 7;
  miso  = 8;
;
  1. Connect each line (and ground) from the serial cable or adapter to the Arduino ICSP connector through 1k resistors. Also put a 5.1V zener diode to ground on each line on the Arduino side.
  2. Connect power to the Arduino. I used the DC connector, but USB should also work.
  3. Connect the serial cable or adapter to the PC.
  4. Run "avrdude -p atmega328p -c arduinofixer -P /dev/ttyUSB0 -Uflash:w:optiboot_atmega328.hex". That will take about 25 minutes or so.

it kinda takes a looot of time but when you dont have an isp programmer or another arduino which you can use as isp its good

anyway can you post a more detailed description for the connection between the serial cable and the isp port on arduino

The configuration is given in the file entry. There's a 1k resistor in series with each line and a 5.1V zener to ground on the Arduino side of each line. If you're using a FTDI cable instead of a regular RS232 cable or adapter, the zeners and resistors are not necessary and the entry should have a "~" in front of each pin number.

That's very interesting. The FTDI cable doesn't bring out the DTR connection, but it might be ok to manually ground the Reset pin before programming. Are the pin assignments critical? For example, could be the connection be made as Tx to MOSI, Rx to MISO, and RTS to Clock?

Use a full adapter that brings out all of the I/Os. If your PC still has a serial port, you can use it. If not, a FTDI adapter can be obtained for $15 or less.

The next Arduino really should have such functionality built in.

How can you have only one Arduino? :smiley: