Can't Program ATMEGA With ICSP

For a project I've been working on, I've re-designed a working PCB schematic so that it uses all SMD components and now features an ICSP header. The board is essentially an LED driver controlled by an ATMEGA168. It is Arduino compatible and the PTH version works fine.

I've assembled the new board, but I cannot seem to program it using my AVRISPMkII. Since this is the first time I've done anything like this, I'm struggling to figure out where to start when it comes to debugging the board. When I'm trying to communicate with the board, I get one of two error messages. These are:

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

and

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

As far as I'm aware, this fault is due to not being able to communicate with the board. I was wondering if this could be because I've damaged the ATMEGA while soldering, messed up the circuit design or something else? How can I debug this sort of thing?

[Edit - removed the link to my schematic for privacy, now the problem is solved]

1 Answer

Yes that error is because there is no communication between the the board and your computer. Unfortunately this is difficult to debug as there is almost an infinite number of issues that can cause this. All I can recommended is this:

You need to troubleshoot both ends:

On the board:

1) Check your voltages. Are they correct? If possible do so with an oscilloscope. Not all programmers provide a voltage, your board may need to. Usually the STK500 does provide 5V. You should only provide voltage from one source; the programmer or the board - NOT BOTH.

2) Check that your ICSP header is mating correctly with pin 1 on the header going to pin 1 on the programmer. In the past I have made mistakes by flipping a part or rotating it during layout in such a way that the pinout was reflected and no longer mater correctly.

3) Where does your reset net go? I can't find a button or anything. If it's tied to GND your holding the MEGA in reset.

4) Do you have the boot-loader loaded onto the ATMEGA? Arduino IDE will not work without it.

5) The ICSP may be disabled on the board. You may have done this by accident, or it came from the factory with ICSP disabled. If you can upload software through it any other way, it's still possible that ICSP is disabled. So if ICSP is disabled, what can you do? We're going to need to reset the chip. Read more here

On the computer:

1) Is the correct Serial Port selected?

2) Is the correct driver installed?

3) Can you program a regular Arduino using this method? If you can something is wrong with your board.

• Thanks for the pointers - I'll go through them and see if I can come up with something. Reset is pulled high from the ATMEGA to +5v through a 10k resistor, this is something I've done before in the past as I didn't want to have a reset button on this board. I haven't been able to get the bootloader onto the ATMEGA yet because of these ICSP problems. – edcs Dec 1 '13 at 20:25
• AVRISPMkII is ok with 10k resistor, but if you use lower value the programmer may be not able to pull reset low enough. – x4mer Dec 1 '13 at 20:31
• I'm beginning to wonder if the AVRISPMkII I bought is working or not. I'm not getting a different error message which says: avrdude: stk500_recv(): programmer is not responding when I'm trying to program my Arduino Mega 2560 board (which I know is working). – edcs Dec 1 '13 at 20:56
• Your pinnouts look correct. If the chip has power and an oscillator, it should program. I would try another chip like you have or on a breadboard and see if the programmer can talk tot hat. – BrianK Dec 2 '13 at 19:26
• After some debugging (thanks for the tips again!) I ended replacing my AVRISP clone with a genuine one. It arrived today and after a bit of testing I got some good news: avrdude: AVR device initialized and ready to accept instructions - thanks for the help! – edcs Dec 3 '13 at 20:39