I'm trying to use Arduino UNO R3 (which is with atmega328p-pu) as ISP to program atmega328p-pu, but I can't get it to work for some reason... Could someone help me please?
I will explain everything I tried in detail so this will be LONG... (Keep in mind that I'm new to microcontrollers, I don't have any AVR programmer, all I have is arduino)
1)I googled for hours to find a solution before posting this
2)I'm completely sure the chip is atmega328p-pu, I bought it from a local store which is a Farnell distributor
(this is the chip I bought ) so it should be with default settings which means I need to burn the arduino bootloader
3)I use arduino IDE v1.0.1
4)I've set Tools>Programmer>Arduino as ISP and Tools>Board>Arduino Uno
5)I tripple checked all the connections everytime I changed something
Here is what I've tried so far:
1)Upload the ArduinoISP sketch, connected the Arduino like this + 10uF capacitor connected
to reset and ground, the crystal is 16MHz (I also didn't have 10k resistor so I used two 5.1k in series) and I was getting "invalid device signature" error
2)I connected AREF (pin 21 on the chip) to the VCC (5V), still same error
3)I powered the chip with external power supply at 5V, but without common ground with the arduino, at first I got "invalid device signature", I tried to burn the bootloader again and then this error occured:
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
4)I read somewhere that the capacitor is not needed so I removed it and tried again aand same as before, at first try
"invalid device signature" error, at second try the stk500 error
5)I tried all the steps from the beginning but I left AREF unconnected, didn't seem to have any difference
6)I uploaded Blink program to the arduino to make sure it still works and I haven't bricked it or something
7)I uploaded the ArduinoISP sketch, connected the chip like this but with external power supply, no 10uF capacitor,AREF unconnected and without common ground, and tried to UPLOAD to the chip the blink program (LED connected to digital pin 9) and no luck, "invalid device signature" error again
8)I connected a common ground (ground of the supply to the ground of the arduino) and tried again to upload blink to the chip and... it WORKED!! but... the LED was blinking very SLOW, I had to change delay(1000) to delay(100) so it could stay on for around 1 sec... I thought maybe it's becouse I haven't burned the bootloader yet or something else
9)Disconected the LED, and tried to burn the bootloader, again at first signature error, after that stk500 error
10)Added the capacitor between reset and ground, at first stk500 error, at second try "avrdude: stk500_getsync(): not in sync: resp=0x00"
11)Removed commmon ground, "avrdude: stk500_cmd(): programmer is out of sync"
12)Removed capacitor and returned the common ground to see if I can still upload code to the chip, aaand at first stk500 error, at second try "avrdude: stk500_getsync(): not in sync: resp=0x00" , I still can't make it work again...
13)I tried adding the pullup resistor, the crystial with the capacitors, the 10uF capacitor, AREF, common ground, all possible combinations with these, and I keep getting one of these three errors (signature, stk500, and not in sync)
14)I tried using the code I found in this forum and connected digital pin 3 to XTAL1, but without any luck, I tried the code with almost all possible connections of the chip, no luck again
15)I'm out of ideas