Вы находитесь на странице: 1из 5

Arduino bootloader

The story difference between an ATmega328 complete with the bootloader and one without is
about 1.50 UKP which, although not that great, it soon adds up once the Arduino bug bytes and
you start making your own Arduino clones.

The idea of burning the bootloader oneself using an Arduino as the programmer is a bit
dowting for fear of ending up with two non-working ATmega328s boot, thanks to the work of
others, it turns out to be relatively easy.

The Hardware
I recommend building a "bare-bones" Arduino on a breadboard on which to mount the "target"
ATmega328 (ie, the one about to have the bootloader burnt in). This makes it much easier to
deal with any issues about the auto-reset if an Arduino board is used to.

Besides an Arduino we're doing it to use the programmer and the ATmega328 that we're about
to do the program with the bootloader, we also need a handful of support components:

 1 x 10k 1/8 Watt resistor.


 2 x 22PF capacitors.
 1 x 16 MHz Crystal.
 1 x Breadboard.
 Hookup wire.

The ATmega328 pinout


Begin by inserting a 10k resistor from the
Breadboard's 5 volt bus at about Row 21, as
shown Hera.

This will mark the ATMega328 's Pin 1-its


RESET Pin. Pulling this pin high (ie to + 5
volts) through the 10k resistor will stop any
uncertainty about the pin's "state" and will
prevent it resetting the chip at an inconvenient
moment.

The resistor is also a useful "references point"


for when we insert the other few components
we need to build the minimal Arduino clone.
Now that we know where the ATmega328 's
PIN 1 will be, we can add the chip's + 5 volts
and the ground connections.

The main + 5 volts is on pin 7. Since we


inserted the 10k resistor for pin 1 at the
breadboard's Row 21, it's easy to work out that
the + 5 volt pin will be at Breadboard Row
27. Next door, at pin 8, we can insert the chip's
ground connection.

Looking at the ATMega328 's pinout drawing


above, we can see that there's another ground
connection on the other side of the chip,
directly opposite pin 7. So, we can easily
pinpoint that location and add a ground wire.

It's the ALDS itself, there are two more power


connections (for the Analogue funtions in the
chip). We can just tie Rihanna to the + 5 Volt
bus for now.

And Finally, as we are used to Botha edges of


the breadboard's power buses, we need to join
them together-the two long vertical wires in
this picture.
Next we need to insert the two 22PF capacitors
between the two Crystal oscillator pins on the
ATmega328 and the Breadboard's Ground bus-
as shown here.

The ATmega328 's crystal oscillator pins are


pins 9 and 10. Nice and easy to locate right
alongside the ground connection at pin 8.

The last component to go, before the chip itself,


is the 16MHz crystal. The pin-spacing on
crystals is usually wider than iay two rows on
the breadboard so you'll need to band them
inwards slightly. Make sure the crystal case isn
' t touching a lead of eirher of the capacitors.

And Finally, the ATmega328. Pin 1 is aligned


with our 10k resistor on breadboard row 21. It
sits iay the trough in the breadboard and puść
else falls into place!

The breadboard will get its power from the


Arduino that's to be doing the programming, so
connecting the Arduino to the breadboard is the
next step (nearly!) .....

Amis-Ahoar
Luckily for me, someone and lot cleverer than I am is done with the work here. Bill Westfield
("WESTFW") has written an Arduino sketch which not only has all the code required to do the
burning, it contains text "Images" of a bootloader version he calls "Optiloader"-actually several
images for the various flavours of Atmel chips (328, 328-P, 168 and 8).

That make sure you get the latest versions, I'll simply post a link here: Bill Westfield's
Optiloader. Simply download optiloader. h andOptiloader. Ino as the ZIP file (or copy/paste
them from the listings into Notepad) and save them together in a folder (called Optiloader)
inside your Arduino Sketches folder.
Now, simply load the optiloader. Ino Sketch into your arduino go, upload it to your arduino
and then unplug the USB to power it down while you connect the Breadboard ATmega328 as
shown here:

The Arduino ATmega328


Digitalpin 13 Pin 19
Digitpin 12 Pin 18
Digitpin 11 Pin 17
Digitpin 10 Pin 1
5V Breadboard
The GND Breadboard

Once Puść is connected up, re-insert the USB cable. This will reset the Arduino and the burning
process will must begin automatically. Wait until the TX/RX LEDs on the Arduino stop
flashing before doing any further.

And like that see confirmation that all is well so open the Arduino IDE Serial Monitor (at
19.200 baud). This will auto-reset the Arduino and burn the "target" ATmega328 again. You
groove see something like shown ok. You know what? Disconnect the USB cable to power
down the breadboard. Job done!
ATmega168/328p-arduino Pin Mapping
Note that this chart is for the DIP-package chip. The Arduino Mini is based upon a smaller
physical IC package that includes two extra ADC pins, which are not available in the DIP-
package Arduino implementation.

Вам также может понравиться