ATMega328 Bootloader Not Working

Hi Everyone,

I'm trying to bootload a new ATMega328P-PU with the Arduino to Breadboard bootloader... I downloaded the files and put them in the hardware folder of my IDE, and then attempted to boot load the new ATmega with my Arduino UNO. I had the ICSP wires hooked up to the corresponding ones on the UNO (10,11, 12, 13) and a 10uf capacitor between the reset pin and ground on the Arduino.. When I selected "Burn Bootloader" from the Tools menu I got an error. Can anyone please help me resolve this problem?

Thanks in Advance,
Mr_E

I got an error.

Perhaps you could be more specific?

If the chip ever had an Arduino bootloader it is probably programmed to use a 16 MHz crystal or resonator. If the chip's system clock isn't running you can't use the ICSP pins to program it. Give it a 16 MHz crystal (and load capacitors) or resonator.

Do you have your breadboard wired as here: http://arduino.cc/en/Tutorial/ArduinoISP

I'm having problems with this as well and it's driving me crazy. After spending a couple hours checking and rechecking and rechecking my wiring and not being able to get the bootloader to even flash on a clean new mega328p, I finally got it to flash by putting an external crystal on it.

So first question, do these things come set from the factory requiring an external crystal or something? Is there anyway for me to change it so that it doesn't require the external crystal? I wanted to try running it off it's 8mhz internal oscillator.

Moving on, as a test I try to upload the blink sketch and no dice. I just constantly keep getting the avrdude: stk500_getsync(): not in sync: resp=0x00 message.

I've got everything wired up exactly as shown here: http://arduino.cc/en/Tutorial/ArduinoISP With the exception of adding a 10 uF cap between reset and gnd on the programming arduino uno.

What gives? I've been trying to avoid coming here and asking for something that should be simple, but I've been beating my head on the desk for hours now and this thing just doesn't work like the guide says.

One thing to note, I used the breadboard hardware zip here: http://arduino.cc/en/Tutorial/ArduinoISP but I had to add atmega328bb.build.variant=standard to the settings on it to get the blink sketch to even compile. I don't know if that is part of the problem or not...

do these things come set from the factory requiring an external crystal or something?

The normal "burn bootloader" process first programs the fuses and lock bits, then loads the bootloader, and then changes the lock bits again; a three step process. For most types of Arduino, the initial programming of the fuse bits will set the chip configuration to REQUIRE an external crystal; if you don't have a crystal, the subsequent steps will fail. To program a chip using the internal clock without an external crystal, you'll need a special BOARDS.TXT entry that has different fuse byte values!

westfw:

do these things come set from the factory requiring an external crystal or something?

The normal "burn bootloader" process first programs the fuses and lock bits, then loads the bootloader, and then changes the lock bits again; a three step process. For most types of Arduino, the initial programming of the fuse bits will set the chip configuration to REQUIRE an external crystal; if you don't have a crystal, the subsequent steps will fail. To program a chip using the internal clock without an external crystal, you'll need a special BOARDS.TXT entry that has different fuse byte values!

As far as I would think, the one I downloaded from the arduinotobreadboard page would be such a boards.txt entry. It is supposed to be for 8mhz internal clock. But it doesn't work without the crystal.

And like I said, I can't get it to upload a program at all. No matter what I do, or what settings I try I just get a not in sync error.

So it seems that I'd better get some crystals...I was going to order 15 from Mouser, but wanted to test the ATMega with the standalone setup first. I'll post a reply once I try it with the crystals

Thanks Everybody!
Mr_E

steven6282:
So first question, do these things come set from the factory requiring an external crystal or something?

No. Fresh from the factory they use the internal 8 MHz oscillator and the /8 prescale so they run at 1 MHz. Many people sell 386P chip pre-loaded with the Arduino UNO bootloader. Those chips need a 16 MHz oscillator.

The good news is that you can force an external oscillator into the crystal pin to allow programming. Luckily for you, Adafruit Industries has made a modified version of ArduinoISP that outputs a 8 MHz clock on Pin 9 that you can feed into your 386P: GitHub - adafruit/ArduinoISP: A fork of the ArduinoISP that has 8mhz output clock

johnwasser:

steven6282:
So first question, do these things come set from the factory requiring an external crystal or something?

No. Fresh from the factory they use the internal 8 MHz oscillator and the /8 prescale so they run at 1 MHz. Many people sell 386P chip pre-loaded with the Arduino UNO bootloader. Those chips need a 16 MHz oscillator.

The good news is that you can force an external oscillator into the crystal pin to allow programming. Luckily for you, Adafruit Industries has made a modified version of ArduinoISP that outputs a 8 MHz clock on Pin 9 that you can feed into your 386P: GitHub - adafruit/ArduinoISP: A fork of the ArduinoISP that has 8mhz output clock

I'm not using the ones preloaded with arduino uno bootloader. I ordered some of those as well, the ones I'm using are supposed to be clean with no bootloader on them. Like I've already said, I finally got the bootloader to load using an external crystal, it will not load if I do not use the external crystal.

The more important problem now is that no matter what I try to do to upload a sketch, I simply get not in sync errors.

I've tried with 8mhz crystal, 16 mhz crystal, no crystal, using the mega328p breadboard hardware, arduino uno hardware, arduino mini 8mhz and 16mhz hardware (3.3v and 5v), arduino lillypad hardware. With and without a 10uf cap between reset and ground onthe programming uno. And I've tried that arduinoisp sketch that you linked as well now (which doesn't have very good instructions by the way, says it has 8mhz output on pin 9 but no instructions on how to use it. Does it plug into one of the external crystal oscillator pins on the 328 or somewhere else?). Nothing works, all give me the error not in sync.

steven6282:
I've tried that arduinoisp sketch that you linked as well now (which doesn't have very good instructions by the way, says it has 8mhz output on pin 9 but no instructions on how to use it. Does it plug into one of the external crystal oscillator pins on the 328 or somewhere else?).

I believe you connect Pin 9 to XTAL1 which is pin 9 on the 28-pin DIP. Note that pin 9 is the 9th pin down the left side when the notch is facing up.

Just to let you guys know, I was able to configure a blank ATMega to use its 8MHZ internal clock and get the boot loader working..the timing commands (delay, delayMicroseconds) are a little off, but it still does work. I'm probably going to wait until my package from Mouser arrives with some 16MHZ crystals..I might put together a post later detailing on how to do it for the truly "minimal" configuration.

Cheers!
Mr_E

Hi Mr_E,
I have the same problem.
Can you please give me the solution?

Thanks
Thewizard83

Take a look at Nick Gammon's very complete and easy to follow tutorial on this subject,... it saved me!

Hi Everyone,

Sorry it's been a long time....I got real busy with school and all and finally have some time off..
thewizard83-
I just reinstalled the arduino IDE (1.01) with the library for breadboard on another pc (I first tried with windows 8 consumer preview and then on a laptop with XP)...I guess that was all to it. Long time since my crystals arrived and I'm happy to say that after building a few pcbs, I now have multiple arduinos..

Mr_E

-a small note to anyone building a stripped down version of the board, you can easily use the arduino board as the programmer through arduino 1.01, no USB/TTL adapter is necessary.