[SOLVED] What have i gone and done ?! (Bootloading a new ATMega 328 chip)

i have been following the steps one-by-one on this Nick Gammon page; Gammon Forum : Electronics : Microprocessors : How to make an Arduino-compatible minimal board

i ran the Atmega_Board_Detector sketch and got;

Atmega chip detector.
Written by Nick Gammon.
Version 1.20
Compiled on Feb  9 2018 at 22:29:50 with Arduino IDE 105.
Attempting to enter ICSP programming mode ...
Entered programming mode OK.
Signature = 0x1E 0x95 0x14 
Processor = ATmega328
Flash memory size = 32768 bytes.
LFuse = 0x62 
HFuse = 0xD9 
EFuse = 0xFF 
Lock byte = 0xFF 
Clock calibration = 0xB3 
Bootloader in use: No
EEPROM preserved through erase: No
Watchdog timer always on: No
Bootloader is 4096 bytes starting at 7000

Bootloader:

7000: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x07 
7010: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFE 0xFF 0xFF 0xFF 
7020: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 
<< deleted to not exceed post limit >>
7420: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFE 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 
7430: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x1B 0xFF 0x1C 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 
7440: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 
<< deleted to not exceed post limit >>
7660: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 
7670: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 
<< deleted to not exceed post limit >>
7AA0: 0xFF 0x50 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 
7AB0: 0xFF 0xFF 0xFF 0xFF 0xFE 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 
7AC0: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x67 0xFF 
7AD0: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 
7AE0: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x74 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 
<< deleted to not exceed post limit >>
7FE0: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 
7FF0: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 

MD5 sum of bootloader = 0x56 0x93 0x4B 0x2E 0x4A 0xED 0x3C 0x55 0xD0 0x45 0xBB 0xAB 0x3D 0x97 0x97 0xA3 
Bootloader MD5 sum not known.

First 256 bytes of program memory:

00: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x06 0x07 0xFF 
<< deleted to not exceed post limit >>
E0: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x74 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 
F0: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x7C 0x7D 0xFF 0xFF 0xFF 0xFF 0xFF 

Programming mode off.

so that was fine, and then i used the Atmega_Board_Programmer sketch; also went fine.

Atmega chip programmer.
Written by Nick Gammon.
Version 1.37
Compiled on Feb  9 2018 at 22:47:24 with Arduino IDE 105.
Attempting to enter ICSP programming mode ...
Entered programming mode OK.
Signature = 0x1E 0x95 0x14 
Processor = ATmega328
Flash memory size = 32768 bytes.
LFuse = 0x62 
HFuse = 0x00 
EFuse = 0xFF 
Lock byte = 0xFF 
Clock calibration = 0xB3
Type 'L' to use Lilypad (8 MHz) loader, or 'U' for Uno (16 MHz) loader ...

---===---
try minimal setup first just to test detector result - haven't got the 16 MHz crystal yet
---===---

Using Lilypad 8 MHz loader.
Bootloader address = 0x7800
Bootloader length = 1932 bytes.
Type 'Q' to quit, 'V' to verify, or 'G' to program the chip with the bootloader ...

---===---

Clearing 'Divide clock by 8' fuse bit.
Fixing low fuse setting ...
Programming mode off.
Attempting to enter ICSP programming mode ...
Entered programming mode OK.
Erasing chip ...
Writing bootloader ...
Committing page starting at 0x7800
Committing page starting at 0x7880
Committing page starting at 0x7900
Committing page starting at 0x7980
Committing page starting at 0x7A00
Committing page starting at 0x7A80
Committing page starting at 0x7B00
Committing page starting at 0x7B80
Committing page starting at 0x7C00
Committing page starting at 0x7C80
Committing page starting at 0x7D00
Committing page starting at 0x7D80
Committing page starting at 0x7E00
Committing page starting at 0x7E80
Committing page starting at 0x7F00
Committing page starting at 0x7F80
Written.
 *** no indication of MD5 sum . . . (i added this line)
Verifying ...
No errors found.
Writing fuses ...
LFuse = 0xE2 
HFuse = 0xDA 
EFuse = 0xFD 
Lock byte = 0xEF 
Clock calibration = 0xB3
Done.
Programming mode off.
Type 'C' when ready to continue with another chip ...

so, now i go back and check the output from the Board Detector sketch;

Atmega chip detector.
Written by Nick Gammon.
Version 1.20
Compiled on Feb  9 2018 at 22:59:31 with Arduino IDE 105.
Attempting to enter ICSP programming mode ...
Entered programming mode OK.
Signature = 0x1E 0x95 0x14 
Processor = ATmega328
Flash memory size = 32768 bytes.
LFuse = 0xE2 
HFuse = 0xDA 
EFuse = 0xFD 
Lock byte = 0xEF 
Clock calibration = 0xB3 
Bootloader in use: Yes
EEPROM preserved through erase: No
Watchdog timer always on: No
Bootloader is 2048 bytes starting at 7800

Bootloader:

7800: 0x0C 0x94 0x34 0x3C 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C 
7810: 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C 0x0C 0x94 0x51 0x3C 
<< deleted to not exceed post limit >>
7C90: 0x90 0x91 0x09 0x02 0x08 0x17 0x19 0x07 0x88 0xF3 0x0E 0x94 0x76 0x3C 0x80 0x32 
7CA0: 0x09 0xF0 0x45 0xCF 0x80 0x91 0x0C 0x02 0x80 0xFF 0xF5 0xC0 0x60 0x91 0x06 0x01 
7CB0: 0x70 0x91 0x07 0x01 0x66 0x0F 0x77 0x1F 0x70 0x93 0x07 0x01 0x60 0x93 0x06 0x01 
7CC0: 0xA0 0x91 0x08 0x02 0xB0 0x91 0x09 0x02 0x10 0x97 0xC9 0xF0 0xE8 0xE0 0xF1 0xE0 
7CD0: 0x9B 0x01 0xAD 0x01 0x4E 0x0F 0x5F 0x1F 0xF9 0x99 0xFE 0xCF 0x32 0xBD 0x21 0xBD 
7CE0: 0x81 0x91 0x80 0xBD 0xFA 0x9A 0xF9 0x9A 0x2F 0x5F 0x3F 0x4F 0xE4 0x17 0xF5 0x07 
7CF0: 0x99 0xF7 0x6A 0x0F 0x7B 0x1F 0x70 0x93 0x07 0x01 0x60 0x93 0x06 0x01 0x80 0x91 
7D00: 0xC0 0x00 0x85 0xFF 0xFC 0xCF 0xF0 0x92 0xC6 0x00 0x80 0x91 0xC0 0x00 0x85 0xFF 
7D10: 0xFC 0xCF 0xB0 0x92 0xC6 0x00 0xE1 0xCE 0x83 0xE0 0x0E 0x94 0xC7 0x3C 0xDD 0xCE 
7D20: 0x82 0xE0 0x0E 0x94 0xC7 0x3C 0xD9 0xCE 0x0E 0x94 0x76 0x3C 0x80 0x93 0x09 0x02 
7D30: 0x0E 0x94 0x76 0x3C 0x80 0x93 0x08 0x02 0x80 0x91 0x06 0x01 0x90 0x91 0x07 0x01 
<< deleted to not exceed post limit >>
7F30: 0x10 0x34 0x98 0xF0 0x11 0x27 0x00 0x91 0x57 0x00 0x01 0x70 0x01 0x30 0xD9 0xF3 
7F40: 0x05 0xE0 0x00 0x93 0x57 0x00 0xE8 0x95 0x00 0x91 0x57 0x00 0x01 0x70 0x01 0x30 
7F50: 0xD9 0xF3 0x01 0xE1 0x00 0x93 0x57 0x00 0xE8 0x95 0x32 0x96 0x02 0x97 0x09 0xF0 
7F60: 0xC7 0xCF 0x10 0x30 0x11 0xF0 0x02 0x96 0xE5 0xCF 0x11 0x24 0x80 0x91 0xC0 0x00 
7F70: 0x85 0xFF 0xC5 0xCE 0xC8 0xCE 0x8E 0xE1 0x0E 0x94 0xC7 0x3C 0xAE 0xCD 0x85 0xE9 
7F80: 0x0E 0x94 0xC7 0x3C 0xAA 0xCD 0xF8 0x94 0xFF 0xCF 0x80 0x00 0xFF 0xFF 0xFF 0xFF 
7F90: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 
<< deleted to not exceed post limit >>
7FF0: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 

MD5 sum of bootloader = 0x27 0xEB 0x87 0x14 0x5D 0x45 0xD4 0xD8 0x41 0x44 0x52 0xCE 0x0A 0x2B 0x8C 0x5F 
Bootloader name: ATmegaBOOT_168_atmega328_pro_8MHz

First 256 bytes of program memory:

00: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 
<< deleted to not exceed post limit >>
F0: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 

Programming mode off.

so that's all fine and dandy - Breadboard Arduino with minmal setup (internal crystal) has been bootloaded.

But then...
(continue next post)

now i try to bootload the chip for the Uno.
(breadboard does NOT have the 16 MHz crystal)

i run the Board Programmer sketch and get;

Atmega chip programmer.
Written by Nick Gammon.
Version 1.37
Compiled on Feb  9 2018 at 23:01:07 with Arduino IDE 105.
Attempting to enter ICSP programming mode ...
Entered programming mode OK.
Signature = 0x1E 0x95 0x14 
Processor = ATmega328
Flash memory size = 32768 bytes.
LFuse = 0xE2 
HFuse = 0xDA 
EFuse = 0xFD 
Lock byte = 0xEF 
Clock calibration = 0xB3 
Type 'L' to use Lilypad (8 MHz) loader, or 'U' for Uno (16 MHz) loader ...

---===---

Using Uno Optiboot 16 MHz loader.
Bootloader address = 0x7E00
Bootloader length = 512 bytes.
Type 'Q' to quit, 'V' to verify, or 'G' to program the chip with the bootloader ...

---===---

Fixing low fuse setting ...
Programming mode off.
Attempting to enter ICSP programming mode ......................................................
Failed to enter programming mode. Double-check wiring!
Programming mode off.
Type 'C' when ready to continue with another chip ...

what did i do to the chip here ?

i assumed (wrongly ?) the sketch would do the chip erasing first.

i tried to just verify and got;

Atmega chip programmer.
Written by Nick Gammon.
Version 1.37
Compiled on Feb  9 2018 at 23:01:07 with Arduino IDE 105.
Attempting to enter ICSP programming mode ......................................................
Failed to enter programming mode. Double-check wiring!
Type 'C' when ready to continue with another chip ...

and even worse, now with the Board Detector sketch...

Atmega chip detector.
Written by Nick Gammon.
Version 1.20
Compiled on Feb  9 2018 at 23:10:46 with Arduino IDE 105.
Attempting to enter ICSP programming mode ......................................................
Failed to enter programming mode. Double-check wiring!
Programming mode off.

the breadboard had not been touched throughout this whole process.
(one difference from the layout on Nick Gammon's page is that i haven't put in the decoupling capacitors - haven't got the 0.1 uF yet)

i did unplug the USB cable before the 2nd attempt of Board Programmer (when just verifying)

have i gone and ruined the ATMega328 chip already ??!!

So you bootloaded it as an Uno. That involves setting it to use an external 16mhz crystal.

If it's set to use an external crystal or clock source, but none is connected, the chip has no clock and cannot be reprogrammed via ISP until you connect a clock source to it.

Also - there's no "internal crystal" - it's an internal oscillator, and it's much shittier than a crystal in terms of voltage and temperature dependence. +/- 10% within the mfg specified operating temperature and voltage range (note that serial requires it to be within ~2% to work. This is often the case at room temperature and 3.3~5v, but this is in no way guaranteed). A ceramic resonator is typically +/- 1 or 2%, while a crystal's inaccuracy is measured in hundreds of ppm). This is why even the 8mhz arduino boards use an external resonator instead of the internal oscillator.

DrAzzy:
So you bootloaded it as an Uno. That involves setting it to use an external 16mhz crystal.

i tried to bootload it as an Uno, after succesfully bootloading it as a Lilypad.

this is the key moment if you don't want to read through all the various outputs;

Atmega chip programmer.
Written by Nick Gammon.
Version 1.37
Compiled on Feb  9 2018 at 23:01:07 with Arduino IDE 105.
Attempting to enter ICSP programming mode ...
Entered programming mode OK.
Signature = 0x1E 0x95 0x14 
Processor = ATmega328
Flash memory size = 32768 bytes.
LFuse = 0xE2 
HFuse = 0xDA 
EFuse = 0xFD 
Lock byte = 0xEF 
Clock calibration = 0xB3 
Type 'L' to use Lilypad (8 MHz) loader, or 'U' for Uno (16 MHz) loader ...

---===---

Using Uno Optiboot 16 MHz loader.
Bootloader address = 0x7E00
Bootloader length = 512 bytes.
Type 'Q' to quit, 'V' to verify, or 'G' to program the chip with the bootloader ...

---===---

Fixing low fuse setting ...
Programming mode off.
Attempting to enter ICSP programming mode ......................................................
Failed to enter programming mode. Double-check wiring!
Programming mode off.
Type 'C' when ready to continue with another chip ...

it doesn't look like the Uno bootloader got through.

or has it actually done so, but now i just can't detect it without the 16 MHz crystal in place.

DrAzzy:
If it's set to use an external crystal or clock source, but none is connected, the chip has no clock and cannot be reprogrammed via ISP until you connect a clock source to it.

ahh okay - i followed the part on the Nick Gammon page with Alternate clock source using the programming board clock via connecting D9 and it's all fine.

crisis averted !

Thanks DrAzzy !