Trying to use Arduino as ISP

I'm trying to use the Arduino Duemilanove ATmega328 as an ISP. I'm using a MAC with OSX 10.11.3.

I've followed the instructions here Arduino ISP and built the circuit on a breadboard. I added the following to the 'boards.txt' file:

################################################################

atmsa168.name=ATmega in Stand Alone (w/ Arduino as ISP)

atmsa168.upload.tool=avrdude
atmsa168.upload.protocol= arduino
atmsa16.upload.using=arduino:arduinoisp

atmsa168.bootloader.tool=avrdude
atmsa168.bootloader.unlock_bits=0x3F
atmsa168.bootloader.lock_bits=0x0F

atmsa168.build.f_cpu=8000000L
atmsa168.build.board=AVR_LILYPAD
atmsa168.build.core=arduino
atmsa168.build.variant=standard


atmsa168.menu.cpu.atmega168=ATmega168

atmsa168.menu.cpu.atmega168.upload.maximum_size=14336
atmsa168.menu.cpu.atmega168.upload.maximum_data_size=1024
atmsa168.menu.cpu.atmega168.upload.speed=19200

atmsa168.menu.cpu.atmega168.bootloader.low_fuses=0xe2
atmsa168.menu.cpu.atmega168.bootloader.high_fuses=0xdd
atmsa168.menu.cpu.atmega168.bootloader.extended_fuses=0x00
atmsa168.menu.cpu.atmega168.bootloader.file=lilypad/LilyPadBOOT_168.hex

atmsa168.menu.cpu.atmega168.build.mcu=atmega168

As the CPU on the breadboard is a ATmega168PU, that I want to set the clock speed to 8MHz and eventually set the flash memory to 16K (I haven't set that yet).

When I load the sketch 'ArduinoISP' and try to upload it I get the following:

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
... etc

I would appreciate some advice on how I can successfully change the ATmega168PU clock speed to use the internal 8MHz clock then this CPU can be used stand-alone without the need for a 16MHz crystal and 2 x 22pF caps.

Check your fuse settings:
atmsa168.menu.cpu.atmega168.bootloader.low_fuses=0xe2 << 2 indicates internal 8 MHz
atmsa168.menu.cpu.atmega168.bootloader.high_fuses=0xdd
atmsa168.menu.cpu.atmega168.bootloader.extended_fuses=0x00 << this is a reserved # for brownout detection.
Valid choices are:
0b00000111 (brownout disabled), 0x07
0b00000110 (1.8V), 0x06.
0b00000101 (2.7V) 0x05
Upper 5 bits are not used and may read back as 1s.
0b00000100 (4.3V)

The lower nibble of the Low Fuse byte looks correct for internal 8 MHz:

Calibrated Internal RC Oscillator 0010

I think you want “Arduino as ISP”, not “ArduinoISP”, which is this board:
https://www.arduino.cc/en/Main/ArduinoISP

Thanks for your help. I changed the boards.txt to:

atmsa168.name=ATmega in Stand Alone (w/ Arduino as ISP)

atmsa168.upload.tool=avrdude
atmsa168.upload.protocol= arduino
atmsa16.upload.using=arduino:arduinoisp

atmsa168.bootloader.tool=avrdude
atmsa168.bootloader.unlock_bits=0x3F
atmsa168.bootloader.lock_bits=0x0F

atmsa168.build.f_cpu=8000000L
atmsa168.build.board=AVR_LILYPAD
atmsa168.build.core=arduino
atmsa168.build.variant=standard


atmsa168.menu.cpu.atmega168=ATmega168

atmsa168.menu.cpu.atmega168.upload.maximum_size=14336
atmsa168.menu.cpu.atmega168.upload.maximum_data_size=1024
atmsa168.menu.cpu.atmega168.upload.speed=19200

atmsa168.menu.cpu.atmega168.bootloader.low_fuses=0xe2
atmsa168.menu.cpu.atmega168.bootloader.high_fuses=0xdd
atmsa168.menu.cpu.atmega168.bootloader.extended_fuses=0x05
atmsa168.menu.cpu.atmega168.bootloader.file=lilypad/LilyPadBOOT_168.hex

atmsa168.menu.cpu.atmega168.build.mcu=atmega168

But, when I attempt to upload the 'ArduinoISP' sketch to my board steps 1:4 following:

https://www.arduino.cc/en/Tutorial/ArduinoISP

I still get the same error? I would really appreciate someone advising where I'm going wrong please.

I managed to get it to work.

So, I have successfully written the bootloader to an ATmega168PU. Uploaded the Blink program to it and it will now happily run in a breadboard without the 16MHz crystal.

I've made a shield following these instructions:

https://learn.adafruit.com/arduino-tips-tricks-and-techniques/arduinoisp

Uploaded the ISP program code for it to the host Arduino, plugged an ATmega168PU into the ZIF socket and then set the board as my 'ATmega in Stand Alone (w/ Arduino as ISP)' and on attempting to Burn Bootloader I get:

Arduino: 1.6.8 Hourly Build 2016/02/19 11:12 (Mac OS X), Board: "ATmega in Stand Alone (w/ Arduino as ISP), ATmega168"

avrdude: Yikes!  Invalid device signature.
         Double check connections and try again, or use -F to override
         this check.

Error while burning bootloader.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Any suggestions on how to resolve this?

ATmega168-PU 0x1E 0x94 0x06 ATmega168P-PU 0x1E 0x94 0x0B

Which chip do you have? You may have to cheat and fake the fuse settings.

I have a few ATmega168A-PU and ATmega328P-PU. So, I changed the boards.txt to refer to ATmega168P:

################################################################

atmsa168.name=ATmega in Stand Alone (w/ Arduino as ISP)

atmsa168.upload.tool=avrdude
atmsa168.upload.protocol= arduino
atmsa16.upload.using=arduino:arduinoisp

atmsa168.bootloader.tool=avrdude
atmsa168.bootloader.unlock_bits=0x3F
atmsa168.bootloader.lock_bits=0x0F

atmsa168.build.f_cpu=8000000L
atmsa168.build.board=AVR_LILYPAD
atmsa168.build.core=arduino
atmsa168.build.variant=standard


atmsa168.menu.cpu.atmega168=ATmega168P

atmsa168.menu.cpu.atmega168.upload.maximum_size=14336
atmsa168.menu.cpu.atmega168.upload.maximum_data_size=1024
atmsa168.menu.cpu.atmega168.upload.speed=19200

atmsa168.menu.cpu.atmega168.bootloader.low_fuses=0xe2
atmsa168.menu.cpu.atmega168.bootloader.high_fuses=0xdd
atmsa168.menu.cpu.atmega168.bootloader.extended_fuses=0x05
atmsa168.menu.cpu.atmega168.bootloader.file=lilypad/LilyPadBOOT_168.hex

atmsa168.menu.cpu.atmega168.build.mcu=atmega168P

But, on attempting to burn the bootloader onto the chip in the ZIF socket on the ISP shield I still get the same error?

I've managed to make progress. I can now burn the bootloader onto an ATmega328A-PU chip. I changed the boards.txt file adding these instead of what I had before:

##############################################################

pro328.name=Arduino ATmega328 (3.3V, 8 MHz) w/ Arduino as ISP

pro328.upload.tool=avrdude
pro328.upload.protocol= arduino
pro328.upload.using=arduino:arduinoisp

pro328.upload.protocol=arduino
pro328.upload.maximum_size=30720
pro328.upload.speed=57600

pro328.bootloader.tool=avrdude
pro328.bootloader.low_fuses=0xFF
pro328.bootloader.high_fuses=0xDA
pro328.bootloader.extended_fuses=0x05
pro328.bootloader.path=atmega
pro328.bootloader.file=atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex
pro328.bootloader.unlock_bits=0x3F
pro328.bootloader.lock_bits=0x0F

pro328.build.mcu=atmega328p
pro328.build.f_cpu=8000000L
pro328.build.core=arduino
pro328.build.variant=standard

##############################################################

pro.name=Arduino ATmega168 (3.3V, 8 MHz) w/ Arduino as ISP

pro328.upload.tool=avrdude
pro328.upload.protocol= arduino
pro328.upload.using=arduino:arduinoisp

pro.upload.protocol=arduino
pro.upload.maximum_size=14336
pro.upload.speed=19200

bootloader.tool=avrdude
pro.bootloader.low_fuses=0xc6
pro.bootloader.high_fuses=0xdd
pro.bootloader.extended_fuses=0x00
pro.bootloader.path=atmega
pro.bootloader.file=atmega/ATmegaBOOT_168_pro_8MHz.hex
pro.bootloader.unlock_bits=0x3F
pro.bootloader.lock_bits=0x0F

pro.build.mcu=atmega168
pro.build.f_cpu=8000000L
pro.build.core=arduino
pro.build.variant=standard

I was attempting to load the bootloader onto the ATmega168A-PU and kept getting the error:

avrdude: stk500_recv(): programmer is not responding

I put one of these chips into an Arduino and attempted to upload the Blink sketch. This resulted in the same error, so I'm wondering whether these ATmega168A-PU chips have a problem, or are locked in some way? They are running the Blink sketch already, I just can't seem to write to them?

Although it burns the bootloader to the ATmega328P-PU chip, and uploads the Blink sketch to it. When I put the chip in a breadboard with a 560ohm resistor on pin#19 to the anode of an LED and cathode to ground, the LED doesn't blink, if I add a 16MHz crystal to pins #9 and #10 with 22pF caps, it does blink. So, maybe the fuses are wrong as it doesn't appear to be running on the internal 8MHz. Would appreciate advice.