Burning bootloader on Atmega using Arduino Errors

Hey, I'm working on programming some ATMEGA 328's, and I was having great difficulty getting the AVR studio to work, and then I found this: http://arduino.cc/en/Tutorial/ArduinoToBreadboard.

I've been trying to get it to work. I have followed all the steps, made sure my wires are in correctly, and made sure to download the necessary extras. I'm using an Arduino Duemilanove with an ATMEGA 328 on it, and am trying to program more ATMEGA 328's. Im using the minimal system described on the link (above), using the internal clock on the arduino.

I keep getting this message when I try to burn the bootloader on to the new chip: Error while burning to bootloader. avrdude: stk500_getsync(): not in sync: resp=0xf0 avrdude: stk500_disable(): protocol error, expect=0x14, resp=0xf0

Any ideas what that means?

The bootloader fuse settings require an external clock. Once the fuses are changed, the processor will not run without an external clock. Including responding to a programmer.

Do you have a crystal + capacitors or a resonator?

I do not. The tutorial says that you can use the internal clock...

I do not. The tutorial says that you can use the internal clock...

It's a chicken and the egg problem. If the processor has it's internal fuse set to use internal clock then it can be used without crystal. If processor has it's internal fuse set for external clock then you must use external crystal or resonator.

So the question you need to answer is what is the existing clock fuse setting in your chip?

If the chip came from of an existing Arduino board, then its fuse setting is set to use crystal. If the crystal came direct from the ATMEL factory, without any prior programming then it does not need a external crystal.

Which is your chip?

Lefty

Were you ever able to upload a bootloader?

Did the error occur on the very first attempt?

Be sure to select "ATmega328 on a breadboard (8 MHz internal clock)" when burning the bootloader. (If you select the wrong item and configure the microcontroller to use an external clock, it won't work unless you connect one.)

Did you have "ATmega328 on a breadboard (8 MHz internal clock)" selected when you tried to burn the bootloader?

Yes, I had that option selected everytime. I have 12 brand new ATMEGA 328's, and one Arduino. I was trying with one ATmega, then I thought I might have screwed it up by using the wrong settings, so i tried a new one. SAme problem.

All my chips are new, and should be blank.

Please answer the first two questions in my post. It makes a big difference on how you will proceed.

Yes this is my first attempt, never done it before. No, it has never worked.

The fuse settings from "ATmega328 on a breadboard (8 MHz internal clock)" look OK. I suspect you have not yet communicated with either processor.

The most likely culprits are...

  1. Arduino ISP. If you do not get auto-reset disabled I think attempting to upload erases the Arduino ISP sketch. How did you disable auto-reset?

  2. Wiring. How long are the wires? Do you have a breadboard with a "broken" power bus?

To speed up your work, you may want to learn a few basic AVRDUDE commands.

The wires and breadboard are good enough I believe... I know that the breadboard is good to go. How do you tell if a wire is "too long" or "too short"?

The auto reset seems like a likely culprit, how do I disable it? (I was looking and found this:http://www.arduino.cc/en/Main/ArduinoBoardDuemilanove "The Duemilanove contains a trace that can be cut to disable the auto-reset. The pads on either side of the trace can be soldered together to re-enable it. It's labeled "RESET-EN". You may also be able to disable the auto-reset by connecting a 110 ohm resistor from 5V to the reset line; see this forum thread for details."

Is that it?

And what commands, and where would I look to find them?

Upload the ArduinoISP sketch again. Then disable the auto reset by connecting a 10uF capacitor between GND and RESET. Then set the Board to "Arduino on a breadboard (8MHz clock)" and try burning the bootloader again.

Xyver: How do you tell if a wire is "too long" or "too short"?

I vaguely recall someone having problems with 60 cm wires. Until you have something working, try to keep the wires 10 cm or less.

The auto reset seems like a likely culprit, how do I disable it?

For the Duemilanove, an approximately 120 ohm resistor from 5V to RESET seems to work well.

The Duemilanove contains a trace that can be cut to disable the auto-reset. The pads on either side of the trace can be soldered together to re-enable it. It's labeled "RESET-EN".

That would be a semi-permanent method and, as far as I know, has never been required.

You may also be able to disable the auto-reset by connecting a 110 ohm resistor from 5V to the reset line; see this forum thread for details. Is that it?

Go with that option. There are more details here... http://www.arduino.cc/playground/Main/DisablingAutoResetOnSerialConnection

And what commands, and where would I look to find them?

First, make certain you can run AVRDUDE from the command-line. In my case, I have to do this...

set PATH=%PATH%;C:\Arduino\arduino-0022\hardware\tools\avr\utils\bin
set PATH=%PATH%;C:\Arduino\arduino-0022\hardware\tools\avr\bin
set PATH=%PATH%;C:\arduino\arduino-0022\hardware\tools\avr\etc

Or, if you prefer a great deal of typing, you can use a full paths...

C:\Arduino\arduino-0022\hardware/tools/avr/bin/avrdude -CC:\Arduino\arduino-0022\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -carduino -P\.\COM14 -b115200 -D -Uflash:w:C:\Users\USER~1.001\AppData\Local\Temp\build4128319007689436592.tmp\sketch_aug23a.cpp.hex:i

A command like this should do nothing more than check the fuse settings (nothing is written)...

avrdude -v -v -v -v -patmega328p -cSTK500 -P\\.\COM14 -b19200

Thank you for all your help. I'll go test the resistor, and then get back to you. I don't really want to un-solder some of my board.... :/

I’m getting this error when compiling the ArduinoISP code: C:\Program Files\arduino-0022\hardware\tools\avr\bin\avr-ar: wiring_analog.c.o: No such file or directory. Reinstall maybe?

EDIT:: Got rid of that, tried the resistor and everything, and am now down to one error, not two. avrdude: stk500_getsync(): not in sync: resp=0x15.

Where in the coding do I put this?
set PATH=%PATH%;C:\Arduino\arduino-0022\hardware\tools\avr\utils\bin
set PATH=%PATH%;C:\Arduino\arduino-0022\hardware\tools\avr\bin
set PATH=%PATH%;C:\arduino\arduino-0022\hardware\tools\avr\etc

tried the resistor and everything, and am now down to one error, not two. avrdude: stk500_getsync(): not in sync: resp=0x15

When you try to do what? Upload the Arduino ISP sketch to your Duemilanove or upload a sketch to the breadboard processor using your Duemilanove as an ISP?

I made sure that the correct board was chosen (duemilanove 328) and then uploaded the program (without the resistor). Then, I changed it to ATmega 328 (using internal clock) and put the resistor in, and tried to burn the bootloader in to the external chip.

On the Duemilanove, do you have status LEDs on pins 7, 8, and 9? What are the LEDs doing?

I did not put those in. Doing that now.

building and testing board with lights....

When the board has the ArduinoISP on it, all three lights are just On. Solidly. When I switch the settings to the other board, and hit "Burn bootloader", they all flash off for a second (literally), then flicker back to life yellow, red, then green maybe 0.25 seconds apart. Then they are just solid again. Watching the computer, they flicker back on right when the error message appears (Error while burning bootloader. avrdude: stk500_getsync(): not in sync: resp=0x15)

Huh. That's strange. 9 should fade bright and dim (heartbeat). 7 and 8 should be off to start.

If no target is connect during an upload, 9 goes off, 7 and 8 blink.

After the upload fails, 9 goes back to fading, 7 and 8 go off.

Do you have the LEDs wired to GND or 5V?

Negative leg in the pin, positive leg to the 5v.

I hope thats not backwards, because if it is, I now sound like an idiot.