Burning a Bootloader
(Arduino 1.6.1 running on MacBook Pro w/ OS X 10.10.2)
ISP Arduino: Arduino Diecimila w/ATmega168 (didn't have a second ATmega328P available)
Target chip in breadboard: ATmega328P (has UNO bootloader and no crystal)
Connect the USB cable to the PC and ISP Arduino
Install the ArduinoISP sketch in the ISP Arduino.
File->Examples->ArduinoISP
Tools->Board->Arduino Duemilanove or Diecimila
Tools->Processor->ATmega168
Tools->Port->(serial port for ISP Arduino)
File->Upload
Go to Preferences... and check the box for "Show verbose output during: [ ] compilation [X] upload"
Install the breadboard wiring:
Target Pin |
Arduino Pin |
Target Pin |
Arduino Pin |
1 |
Pin 10 |
28 |
|
2 |
|
27 |
|
3 |
|
26 |
|
4 |
|
25 |
|
5 |
|
24 |
|
6 |
|
23 |
|
7 |
+5V |
22 |
GND |
8 |
GND |
21 |
|
9 |
|
20 |
+5V |
10 |
|
19 |
Pin 13 |
11 |
|
18 |
Pin 12 |
12 |
|
17 |
Pin 11 |
13 |
|
16 |
|
14 |
|
15 |
|
Attempt to burn bootloader without disabling auto-reset on ISP Ardiuino.
Tools->Board->Arduino UNO
Tools->Port->(serial port for ISP Arduino)
Tools->Programmer->Arduino as ISP
Tools->Burn Bootloader.
Reading | Error while burning bootloader.
################################################## | 100% 0.05s
avrdude: Device signature = 0x1e9406
avrdude: Expected signature for ATmega328P is 1E 95 0F
Double check chip, or use -F to override this check.
Note: If the ISP Arduino had an ATmega328P processor this check would have passed and an error would occur further into the process. Here is what happens if I put an ATmega168 into the breadboard and try to burn a Diecimila 168 bootloader to it:
avrdude: Device signature = 0x1e9406
avrdude: erasing chip
avrdude: reading input file "0x3F"
avrdude: writing lock (1 bytes):
Writing | ***failed;
################################################## | 100% 0.13s
avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x3F:
avrdude: load data lock data from input file 0x3F:
avrdude: input file 0x3F contains 1 bytes
avrdude: reading on-chip lock data:
Error while burning bootloader.
Reading | ################################################## | 100% 0.02s
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
0x00 != 0x3f
avrdude: verification error; content mismatch
Added a 10 uF capacitor to the ISP Arduino with the positive side of the capacitor going to Reset and the negative side of the capacitor going to Ground.
Now attempt to burn a bootloader. If the chip is not set to expect a crystal or external clock then this should be successful. If the chip came with (or has had burned) an Arduino bootloader it will fail like this:
Tools->Burn Bootloader.
avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check..
This is a symptom of the target chip's clock not running. An ATmega that is expecting a crystal won't accept serial programming without a crystal or ceramic resonator between pins 9 and 10, or an external clock injected into pin 9. I found a crystal between 8 MHz and 20 MHz (14.3180 MHz in my case) in my 'salvaged parts' box and plugged it into the breadboard between pins 9 and 10.
Attempt to burn bootloader again: Tools->Burn Bootloader.
avrdude: verifying ...
avrdude: 1 bytes of lock verified
avrdude done. Thank you.
SUCCESS!