Confused over ISP Programmer

I've got a sketch I developed on a Uno which I then uploaded to a atmega328 on my breadboard which is running with a 8mhz xtal - all working fine. Now I've build my project on pcb and find out I now need to reflash the atmega with some new code. Instead of taking the chip out each time to reprogram I would like to use the isp.

This is where I'm not sure of how it works. I want to use my Uno to program the atmega328 on my pcb via isp. I can so this right?

I've connect sck, reset, miso, mosi from the atmega to my Uno (From this http://arduino.cc/en/uploads/Tutorial/BreadboardAVR.png)

I then tried to program the chip by setting programmer/arduino as isp and programming.

Am I supposed to be following these instructions?

To use your Arduino board to burn a bootloader onto an AVR, you need to follow a few simple steps.
Upload the ArduinoISP firmware (in Examples) to your Arduino board.
Wire your Arduino board to the target as shown in the diagram below.
Select the item in the Tools > Board menu that corresponds to the board on which you want to burn the bootloader (not the board that you're using as the programmer). See the board descriptions on the environment page for details.
Use the Burn Bootloader > Arduino as ISP command.

What am I missing? It says "to burn the bootloader" - I'm not burning the bootloader though?

What error are you getting?

avrdude: stk500_getsync(): not in sync: resp=0x00

On your Arduino that you are using as the ISP do you have a 120Ohm resistor between +5 and reset?
There is another option using a capacitor to ground, but I am using my Arduino board as an ISP with the resistor.

Problem is this, you have to disable the Reset on the Arduino board, otherwise it resets and doesn't run the ArduinoISP at the proper time and AVRDude doesnt get the responces from the chip you are trying to program.

Thanks - no, don't have that resistor in place. I'll add it in and report back.

you might have to change or add an entry to boards.txt to use avrisp or arduinoisp, or you can get the hex file and just use avrdude

Should you be able to use arduino to program it? I've added the resistor and get the same error.

When I program the code should I be using the upload button, or the program bootloader button.

Also should the atmega328 be in the the Uno when I program it. I've tried it with it in and when I program using the upload but I think its flashing the atmega on the Uno rather than on my PCB.

I havent tried with an UNO but you will upload a sketch to the arduino (which is included) that makes it into an avrisp programmer, you hook that up to your target and program though the arduino to your second board/chip

Anyone successfully used the Uno to do isp? Just can't seem to get it working.

Yes, you can use the Uno as ISP. You need to disable the auto reset using either the resistor or the capacitor (both work). However, the ArduinoISP sketch as shipped with Arduino 1.0 doesn't work under Arduino 1.0 (it did under Arduino-0022). I now use TinyISP (kindly supplied by CodingBadly) instead. I've heard that the latest version of ArduinoISP hosted on github also works, but I can't confirm that.

Ahh thanks. After reading your statement I think I'm confusing myself. You program the Uno with ArduinoISP/TinyISP and then I presume to use that to program your code to the atmega328 on my PCB. So I have to have the ISP code running on the Uno.

What I"m looking for is the following. I want to do development work on my Uno and test my code each time by uploading it to the atmega on my PCB. With the above I would need to keep on re-loading the ISP sketch and then program my code?

With the above I would need to keep on re-loading the ISP sketch...?

No. Once you have the ISP code installed on your Uno and auto-reset properly disabled your Uno will act as a programmer indefinitely. There is no need to re-load the ISP sketch.

When you are ready to do something else with your Uno, simply remove the resistor / capacitor (re-enable auto-reset).

Cool - thanks.

Where can I get a copy of your TinyISP referenced above? I'm using Arduino 1.0

Send me a Personal Message with your email address.

This is driving me absolutely mental!

I've uploaded Coding Badly's TinyISP to my Uno. Then on the Uno I've put a 120R between the 5V and Reset pins and a 10uF from Reset to GND. Then I've wired it up to my atmega328 using this:

On my Arduino 1.0 I've set the programmer to Arduino as ISP and set to the board to Arduino Deimilanove /w atmega328 (Also tried Arduino Uno) and clicked on "upload using programmer" (I only just discovered that!)

I now get this error:

Binary sketch size: 1026 bytes (of a 32256 byte maximum)
avrdude: stk500_program_enable(): protocol error, expect=0x14, resp=0x50
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.

avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

AAgghhhh!!!!!

try upping the resistor, 120ohm sounds a bit low, and the image you show has a 1k

often I dont even bother with the resistor, the reset pin very weakly pulls itself up, but that is not good practice as its so weakly pulled up, a bird farting outside of your window could cause it to toggle heh

The pullup on the breadboard is a 10k.

The 120R is recommended as per this article:
http://arduino.cc/playground/Main/DisablingAutoResetOnSerialConnection

are you using windows or other?

Windows 7.

I've also tried cutting the Reset-EN track on the Uno - doesnt make any difference. Also tried the latest ArduinoISP code from github. Also managed to turn on verbose mode if this helps:

Binary sketch size: 1026 bytes (of a 30720 byte maximum)
C:\Electronics\arduino-1.0\hardware/tools/avr/bin/avrdude -CC:\Electronics\arduino-1.0\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -cstk500v1 -P\.\COM3 -b19200 -Uflash:w:C:\Users\Greg\AppData\Local\Temp\build9174164316540479171.tmp\Blink.cpp.hex:i

avrdude: Version 5.11, compiled on Sep 2 2011 at 19:38:36
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch

System wide configuration file is "C:\Electronics\arduino-1.0\hardware/tools/avr/etc/avrdude.conf"

Using Port : \.\COM3
Using Programmer : stk500v1
Overriding Baud Rate : 19200
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
AVR Part : ATMEGA328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :

Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00

Programmer Type : STK500
Description : Atmel STK500 Version 1.x firmware
avrdude: Send: A [41] . [80] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [02]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [81] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [01]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [82] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [12]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [98] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
Hardware Version: 2
Firmware Version: 1.18
Topcard : Unknown
avrdude: Send: A [41] . [84] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [85] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [86] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [87] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [89] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us

avrdude: Send: A [41] . [81] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [01]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [82] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [12]
avrdude: Recv: . [10]
avrdude: Send: B [42] . [86] . [00] . [00] . [01] . [01] . [01] . [01] . [03] . [ff] . [ff] . [ff] . [ff] . [00] . [80] . [04] . [00] . [00] . [00] . [80] . [00] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: Send: E [45] . [05] . [04] . [d7] . [c2] . [00] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: Send: P [50] [20]
avrdude: Recv:
avrdude: stk500_program_enable(): protocol error, expect=0x14, resp=0x50
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.

avrdude: Send: Q [51] [20]
avrdude: Recv:
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

avrdude done. Thank you.

Does an LED (with series resistor) on pin 9 display a "heartbeat"?