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:
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:
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.
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:
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.