I've been trying to upload a sketch to my standalone atmega328 on a breadboard, using the Mega2560 as an ISP. I think I've seen about all the tutorials out there, but it's still not working.
The chip I bought has already had a bootloader (UNO) burnt to it, so that should be fine. Now all I ought to do is upload the ArduinoISP sketch, connect the 328 and be done with it.
Let's start with my setup, after uploading the sketch, I've connected:
Mega2560 | atmega328
----------+------------
SS [53] | Reset [1]
MISO [50] | MISO [18]
MOSI [51] | MOSI [17]
SCK [52] | SCK [19]
|
5V | VCC [7] and AVCC [20]
GND | GND [8] and GND [22]
Also note that I'm not using the internal oscillator, so I connected a 16MHz crystal and 2 22pF capacitors. And to test for responsiveness, I connected an LED to pin 19, which should start blinking when code is uploaded.
I selected the Arduino Uno as the board, since it has the Uno bootloader, selected "Arduino as ISP" as the programmer, and tried to upload:
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
Various sources report that the auto-reset should be disabled, but they disagree on how this is to be done. I've tried connecting a capacitor from Reset to GND (instructed here), Reset to 5V (instructed here). The various sources also seem to disagree on the value, but as the only one I had was a 100uF, this is what I used (also used in the second link).
However, the error code (0x00) doesn't seem to correspond to this issue, as can be seen here. According to that page, the error that is associated with a reset issue should be 0x15.
To check my connection, I tried burning a new bootloader. This went just fine. The LED started blinking and the arduino IDE reported success....
Any ideas what I could be doing wrong?
EDIT:
Just added a 10K pull-up resistor to pull pin 1 (Reset) of the 328 to 5V, but no difference. Also tried some other bootloaders besides the Uno. All of them result in a blinking LED, after the bootloader has been successfully burnt. However, flashing a sketch still results in an error. The error code is different this time though: 0x1c.