UNO no longer loading code onto ATMEGA328P

I have an Arduino UNO I'm using with a Macbook Pro.

I'm getting the following error message when attempting to upload my program onto my ATMEGA328P:

"Problem uploading to board.

avrdude: stk500_recv(): programmer is not responding"

I was able to load programs onto it while I was breadboarding a project for school, with jumper wires connecting the pins over to the breadboard. Once I had my coding and breadboarding complete, I created a PCB and soldered all the components onto it. I forgot about needing a crystal and capacitor until after I had completed the entire board. I found this link on using the chip on it's own without needing the crystal or extra capacitors.

Unfortunately, after following the instructions, when I went to upload the sketch, it said "A0 not defined in this scope" highlighting where I defined a variable for a switch hooked up to my A0 pin. After looking online and seeing similar problems, I tried deleting and reinstalling the Arduino Software. Now it won't even reload the sketch on like I was able to previously. I simply get the above error message.

Did I screw with the bootloader or something, and do I now have to reburn it back on; or is there something else going on?

It is possible that the chip has the wrong fuse settings. If the chip fuses are set for external crystal clock (default for Arduino) then the bootloader won't run on your breadboard. Did you start with a brand new atmega328p chip or pull the one off the Arduino and put it on your breadboard? If so that chip needs a clock (crystal). If you bought a new blank chip for your breadboard and still have the working one on the arduino you can use the arduino to flash a new bootloader onto the chip, but if the chip accidently had it's fuses set for external clock you will have to provide the clock to be able to reset the fuses back. I've had problems with getting an external programmer plugged into the arduino ISP socket to work under the IDE to (re)program bootloaders sometimes and had to do it directly with avrdude from the command line. Avrdude comes with a help file to show you how. The basic commands are: avrdude -pm328p -cavrispmkii -Pusb -U lfuse:w:xxx:m -U hfuse:w:xxx:m -U efuse:w:xxx:m to set the fuses then: avrdude -pm328p -cavrispmkii -Pusb -U flash:w:bootloaderfile.hex to flash the bootloader. The correct xxx values for your fuses are in the boards.txt file as it the correct name for the bootloader hex file (include the full path) change avrispmkii to the name of whatever programmer you are using (such as usptiny, dragon_ips, etc )

I put the chip back in the UNO board but can't get the bootloader to load. I keep getting the same error message

avrdude: stk500_recv(): programmer is not responding avrdude: stk500_recv(): programmer is not responding

What exactly do I need to be doing when I'm trying to burn the Bootloader? When I go to the Burn Bootloader tab, it comes up with several options (w/ AVR ISP, w/AVRISP mkll, etc.) I tried 'w/ Arduino as ISP' and 'w/ AVR ISP'

FYI, plugged another UNO board in with a different ATMEGA and was able to load the blink example sketch with no problems. Tried doing it on my chip, and got the same error message as above.

You need an actual programmer to 'burn' the bootloader. The Arduino board has a 6 pin connecter to plug in an ISP programmer. An Arduino board can be used as a programmer to burn the bootloader into a chip on an other Arduino board. There should be examples of interconnect wiring to do this somewhere on the web. Otherwise you need an ISP programmer of some sort: http://www.ladyada.net/make/usbtinyisp/ http://www.atmel.com/tools/AVRISPMKII.aspx are two inexpensive examples.

So I need a whole other part to burn the bootloader onto the chip? I can't do it with just the UNO?

Sorry for any seemingly redundant questions, I'm brand new to this, as is my teacher, and I'm having trouble getting any straight answer through Google.

Well if you have the original processor that was in the UNO and that still works you can use that UNO as a programmer to burn a bootloader into a virgin chip on your breadboard by wiring from the UNO to the breadboard (needs 6 wires). You MUST use the bootloader for the 8mhz rc version unless your breadboard has a crystal on it.

Maybe this will help. http://arduino.cc/en/Tutorial/ArduinoISP

You CAN'T burn the chip ON an Arduino with the SAME Arduino though.

So I did some magic*** and figured out what was wrong and got my UNO to load sketches onto my ATMEGA again, but only when I set it the board to 'Arduino Uno'. If I try to select 'ATmega328 on a breadboard (8 MHz internal clock)' and plug it into the breadboard, I get the same "programmer not responding" error. I tried putting it back on the UNO board and selected 'ATmega328 on a breadboard (8 MHz internal clock)' but it just sits there saying 'Uploading to board' forever (been going on 5 minutes now).

***Don't laugh but I had my ATMEGA plugged into the UNO backwards

The board selection does several things: It selects the fuses to set when flashing the bootloader, it selects the bootloader file, and it also sets the baud rate. Look for the boards.txt file and you will see the options for all boards. Since you were loading sketches it was the baudrate during upload that was probably the problem. It would seem that the chip is still programmed to require the 16mhz clock. If you want to run the chip on the breadboard you will have to flash a bootloader onto it. To do that follow the instructions on the link I sent you. If you flash the 8mhz bootloader, you will need to select the board profile that matches it to download sketches to it.

Still no luck.

Loaded ArduinoISP from the examples onto one Arduino UNO (Selected Arduino Uno under Tools > Board). No problem

Wired up the UNO to a breadboarded ATMega328P as shown in the tutorial

Selected ATMega 328 on a breadboard (8 MHz internal clock) under Tools > Board

Selected Tools > Burn Bootloader > w/Arduino as ISP

Error while burning bootloader.

avrdude: stk500_recv(): programmer is not responding

Noticed it called for a 10uF capacitor between Reset and Ground. When I put it in, it now says:

avrdude: Yikes! Invalid device signature. Double check connections and try again, or use -F to override this check.

So I've given up on this whole bootloader problem and am simply going to create a new PCB with a crystal, some caps and a resistor.

I'll have a 16 MHz crystal between pins 9 and 10, then caps connecting to ground.

Pins 7 (VCC) and 20 (VCCA) are connected to 5 volts, then 2 caps then to ground

Pin 21 (AREF) is connected to a cap, then to ground.

Does this sound about right?

**** All the resistors connected to the ULNs and the two at the bottom are to give me places to hook up some oversized 7-segment displays on the PCB