Optiloader ATMEGA328p-pu Issue

I have been searching a lot 3guys1laser.com and have also re-checked the wiring multiple times but I am consistently receiving this error:

Target power on! ...
Starting Program Mode - Failed, result = 0x00

Target power OFF!

Can someone please explain the error codes for optiloader?

Is the target chip toast?

I am using an arduino Uno R3 where as the the target chip is an Atmega328p-pu

Is the target chip properly clocked?

Yep, I have a 16.2MHz crystal with 22pf caps. Didn't have an exact 16Mhz crystal.

Are you using the shield from that website or a breadboard?

On a Breadboard

An alternative:

I will give this a try.

Starting Program Mode - Failed, result = 0x00
Can someone please explain the error codes for optiloader?

Each command sent to the AVR being programmed is a 4-byte SPI command. The third and fourth byte sent are supposed to return data as well, and the value printed is the concatenation of those two bytes.
The response on the third byte should be 0x53 for the "Start Programming" command; Getting a value of zero means that either the chip isn't responding at all (The "Start programming" command is the first command issued), and/or that something is wrong with the wiring...

Thanks a lot westfw the wiring seems ok, I will give Nick's one a try, if that doesn't work ( I don't think it will though the chip is probably bricked) I will just try to directly burn the optiboot hex from the superpro programmer in my uni on monday.

I brick chips fairly rarely, although I have my doubts about one of them ...

Does anybody know if samples sent out from Atmel are fused to work without an external clock? I tried flashing it without the crystal and caps and got the same error code as the OP got. Hopefully I didn't brick it. I did check my wiring at least 5 times.

They are normally shipped to run with the internal oscillator with "divide by 8" fuse set.

Try running this if you have a spare Uno or similar:

Looking at that page, if I understand correctly I can wire the Arduino Uno and my ATMEGA328P-PU in the following fashion:

Arduino Uno ATMEGA328P-PU
D10 pin 1
D11 pin 17
D12 pin 18
D13 pin 19
gnd pin 8 (or 22)
+5v pin 7

Is this correct?

Yes, whatever that page said, but that looks right.

The only thing line that shows up on the serial is "Atmega chip detector."

UPDATE: perhaps this is what I need to do.
"As an alternative to a crystal or resonator, the sketch also outputs an 8 MHz clock on pin D9 of the programming board (using Timer 1). Thus you just need to connect D9 on the programming board to XTAL1 of the target board and this will provide a clock signal, enabling this sketch to run."

Yay, this is what I got (it appears that the bootloader did indeed install correctly):

Atmega chip detector.
Entered programming mode OK.
Signature = 1E 95 0F 
Processor = ATmega328P
Flash memory size = 32768
LFuse = FF 
HFuse = DE 
EFuse = FD 
Lock byte = EF 
Clock calibration = 92 
Bootloader in use: Yes
EEPROM preserved through erase: No
Watchdog timer always on: No
Bootloader is 512 bytes starting at 7E00

Bootloader:

7E00: 11 24 84 B7 14 BE 81 FF F0 D0 85 E0 80 93 81 00 
7E10: 82 E0 80 93 C0 00 88 E1 80 93 C1 00 86 E0 80 93 
7E20: C2 00 80 E1 80 93 C4 00 8E E0 C9 D0 25 9A 86 E0 
7E30: 20 E3 3C EF 91 E0 30 93 85 00 20 93 84 00 96 BB 
7E40: B0 9B FE CF 1D 9A A8 95 81 50 A9 F7 CC 24 DD 24 
7E50: 88 24 83 94 B5 E0 AB 2E A1 E1 9A 2E F3 E0 BF 2E 
7E60: A2 D0 81 34 61 F4 9F D0 08 2F AF D0 02 38 11 F0 
7E70: 01 38 11 F4 84 E0 01 C0 83 E0 8D D0 89 C0 82 34 
7E80: 11 F4 84 E1 03 C0 85 34 19 F4 85 E0 A6 D0 80 C0 
7E90: 85 35 79 F4 88 D0 E8 2E FF 24 85 D0 08 2F 10 E0 
7EA0: 10 2F 00 27 0E 29 1F 29 00 0F 11 1F 8E D0 68 01 
7EB0: 6F C0 86 35 21 F4 84 E0 90 D0 80 E0 DE CF 84 36 
7EC0: 09 F0 40 C0 70 D0 6F D0 08 2F 6D D0 80 E0 C8 16 
7ED0: 80 E7 D8 06 18 F4 F6 01 B7 BE E8 95 C0 E0 D1 E0 
7EE0: 62 D0 89 93 0C 17 E1 F7 F0 E0 CF 16 F0 E7 DF 06 
7EF0: 18 F0 F6 01 B7 BE E8 95 68 D0 07 B6 00 FC FD CF 
7F00: A6 01 A0 E0 B1 E0 2C 91 30 E0 11 96 8C 91 11 97 
7F10: 90 E0 98 2F 88 27 82 2B 93 2B 12 96 FA 01 0C 01 
7F20: 87 BE E8 95 11 24 4E 5F 5F 4F F1 E0 A0 38 BF 07 
7F30: 51 F7 F6 01 A7 BE E8 95 07 B6 00 FC FD CF 97 BE 
7F40: E8 95 26 C0 84 37 B1 F4 2E D0 2D D0 F8 2E 2B D0 
7F50: 3C D0 F6 01 EF 2C 8F 01 0F 5F 1F 4F 84 91 1B D0 
7F60: EA 94 F8 01 C1 F7 08 94 C1 1C D1 1C FA 94 CF 0C 
7F70: D1 1C 0E C0 85 37 39 F4 28 D0 8E E1 0C D0 85 E9 
7F80: 0A D0 8F E0 7A CF 81 35 11 F4 88 E0 18 D0 1D D0 
7F90: 80 E1 01 D0 65 CF 98 2F 80 91 C0 00 85 FF FC CF 
7FA0: 90 93 C6 00 08 95 80 91 C0 00 87 FF FC CF 80 91 
7FB0: C0 00 84 FD 01 C0 A8 95 80 91 C6 00 08 95 E0 E6 
7FC0: F0 E0 98 E1 90 83 80 83 08 95 ED DF 80 32 19 F0 
7FD0: 88 E0 F5 DF FF CF 84 E1 DE CF 1F 93 18 2F E3 DF 
7FE0: 11 50 E9 F7 F2 DF 1F 91 08 95 80 E0 E8 DF EE 27 
7FF0: FF 27 09 94 00 00 00 00 00 00 00 00 00 00 04 04 

MD5 sum of bootloader = 84 B7 18 3D 20 49 B8 CF 1B 3C 4E 69 3B 4D 40 3F 

First 256 bytes of program memory:

0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
10: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
20: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
30: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
40: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
50: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
60: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
70: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
80: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
90: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
A0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
B0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
C0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
D0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
E0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
F0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF

Nicknml:
Does anybody know if samples sent out from Atmel are fused to work without an external clock? I tried flashing it without the crystal and caps and got the same error code as the OP got. Hopefully I didn't brick it. I did check my wiring at least 5 times.

It's been stated that AVR chips ship with the fuse bits set for internal R/C 8 Mhz clock enabled and /8 prescaler enabled, so an effective clock rate of 1 Mhz. Once the fuse bits are burned it expects an external resonator then such a resonator must be present for anything useful to happen.

Lefty

The only thing line that shows up on the serial is "Atmega chip detector."

If that is all that shows up the chip has not entered programming mode.

Try what you just said, connect up the clock wire.

Nicknml:
Yay, this is what I got (it appears that the bootloader did indeed install correctly):

That's expecting an external crystal:

http://www.engbedded.com/fusecalc

The bootloader seems to be present, however its MD5 sum does not match any on my page (not that this proves a lot). Either change the fuse, or add a crystal, to make it work.

The reason that I'm flashing the chip is to have a backup should I ever brick the chip on my UNO in the future, so in that case shouldn't the fuse be set to expect an external crystal?