Arduino as ISP programming the Arduino, not the connected ATmega328P

arduinoatmegaisp

I am trying to program an ATmega328P with an Arduino Uno R3. When I click 'Upload to Programmer' in the Arduino IDE (version 1.0.5), the Arduino programs itself and not the chip. Stranger still, the ArduinoISP sketch continues to run on the Arduino as well as the program that should've been burned to the chip. Here are the steps I take:

ArduinoISP sketch is open

  1. Tools > Boards > Arduino UNO
  2. Tools > Programmer > AVRISP mkII
  3. File > Upload

Upload successfully completes

  1. File > Examples > 01.Basics > Blink
  2. Tools > Boards > Arduino Nano w/ ATmega328
  3. Tools > Programmer > Arduino as ISP
  4. File > Upload Using Programmer

No AVRDUDE errors, upload appears to have successfully completed

After I take these steps, the Arduino still has the ArduinoISP heartbeat LED beating, but the pin 13 'L' LED is also blinking on and off, just like in the Blink sketch. This persists even if the Arduino is manually reset; it's as if the Arduino has 2 sketches running at once. The LED connected to pin 13 on the ATmega328P does not blink.

Here is my wiring:

Wiring

NOTE: There is also a 10uF electrolyte capacitor the Uno's between RESET (+) and GND (-) which was missed off the above diagram.

Can anybody help me program this ATmega328P? I have tried 2 different chips, and both have had the same issue.

Best Answer

If your target AVR is an Atmega328P, why are you using "Tools > Boards > Arduino Nano w/ ATmega328" and not "Tools > Boards > Arduino UNO"? If you have the ArduinoISP sketch uploaded and running on the UNO and "Arduino as ISP" selected as the programmer, it should all work.

An Arduino R3 should not need the 10uF capacitor on its RESET pin but it does no harm but remember, if you leave the capacitor in place, you can't upload to the UNO. I suggest that you start with a fresh upload of the ArduinoISP sketch to the UNO, attach the capacitor to prevent the UNO resetting and then just upload the Blink sketch to the target using "Upload using programmer" with "Arduino as ISP" selected. Make sure that the COM port is the COM port for your UNO though!

I know you have done this but it is important to use the "Arduino UNO" board type. Oh, by the way, it's a good idea to put a 10K resistor connected to VCC on the RESET pin of the target AVR.