Bootloading the Arduino--Using Only the Arduino!
|Added by||Zach Taylor|
|Short description||Bootload a new ATMega168 or ATMega328 without Buying a Programmer|
|main document (e.g. datasheet)|
|Area of Focus||Physical|
|Additional Keywords||arduino, bootloader|
Why Would I Do This Seemingly Complicated Thing?
All but the very last steps in this tutorial are setup for something you can do again and again--bootload a chip. Once you have the setup done, all you have to do to bootload a chip is plug one cable into some header and enter one or two lines of code in the terminal to bootload a chip. The process at that point is very simple.
The method is adapted from Kimio Kosaka's method.
What Do I Need?
- One Arduino
- A bit of Male Header four Pieces Long
- A Connector to Connect four male pins to four other male pins
What Do I Do?
- Examine your Arduino. Find the four solder-filled holes labelled 1,2,3,4 near the FTDI chip.
- Use solder braid or your preferred solder removal method to remove that solder.
- Install a four pin male header in the now empty holes.
I Really Do That?
- Yep. It's also now possible to use the Arduino as a programmer without the modification, but this way is still the fastest for bootloading chips.
- Also, if you do this modification, your Arduino will be cooler than your friends'.
Finally, With a Computer
1. Download avrdude.
2. Go to the directory where you installed avrdude.
3. Open the file "avrdude.conf" and add the following programmer definition (will also work for a duemilanove):
#arduino diecimila programmer id="diecimila"; desc = "FT232R Synchronous BitBang"; type = ft245r; miso = 3; # CTS X3(1) sck = 5; # DSR X3(2) mosi = 6; # DCD X3(3) reset = 7; # RI X3(4) ;
4. Copy the hex files from your arduino\hardware\bootloaders\atmega directory to the directory where you installed avrdude.
5. Connect the cable to your Arduino to connect the pins as indicated on this page.
6. Plug the Arduino in and run the following lines of code:
For an ATMega168: avrdude -p m168 -P ft0 -c diecimila -Uefuse:w:0x00:m -Uhfuse:w:0xdd:m -Ulfuse:w:0xff:m -Ulock:w:0x0f:m -Uflash:w:ATmegaBOOT_168_diecimila.hex -B 1.0
For an ATMega328 (two lines, which you could shorten to one): avrdude -c diecimila -p m328p -P ft0 -b 19200 -B 1.0 -e -u -U lock:w:0x3f:m -U efuse:w:0x05:m -U hfuse:w:0xDA:m -U lfuse:w:0xFF:m avrdude -c diecimila -p m328p -P ft0 -b 19200 -B 1.0 -U flash:w:ATmegaBOOT_168_atmega328.hex -U lock:w:0x0f:m
Can Someone Else Tell Me How to Do This?
Kimio Kosaka has also written up this process (with lots of pictures!). His version is slightly different from this one, but his original instructions first introduced me to the method I now use.