Re-burning bootloaders

Today, I received an ATMEGA 328 in the post from RS. I found the hardware files for the 328 (without an external crystal) here:

It said that I needed to burn a bootloader to program it, so I did. (I burned the bootloader to use it with the internal oscillator). I then connected it up how they did in the diagram, and it did not work. As I already had the bootloader on it, but I could not program it on the breadboard, so I put it into my arduino to program. It still did not work, so I tried to burn a new bootloader to it. This did not work either. I successfuly managed to burn the no-crystal bootloader onto it, using the arduino as an ISP. I just cannot program it now. >:-(
Is there any way to burn a new bootloader onto it, or get it to work some other way?

Thanks everyone.
Onions.

This is what I had to do to get it to program.

After you hook up your breadboard to RX and DX and removed the chip from you main board, connect a wire from the pin 1 on the main board (now empty) socket (not pin 1 on the headers.....on the chip socket)and connect it to the pin 1 on your on-breadboard chip.

After you hook up your breadboard to RX and DX and removed the chip from you main board, connect a wire from the pin 1 on the main board (now empty) socket (not pin 1 on the headers.....on the chip socket)and connect it to the pin 1 on your on-breadboard chip.

That makes sense, as pin 1 is the reset, and we will need to reset the IC to program it.

Just tested it, and it still does not work. Thanks anyway though!
Onions.

What is the exact error message you are getting when you try to program the chip?

I thought my ATmega168 chips were fried because I always got a verification failure programming the lock bits. Turns out that AVRDUDE was resetting the Arduino that was supposed to be acting as an ISP and talking to the Arduino bootloader instead of the ArduinoISP sketch. :frowning: The fix was to add a capacitor (2.2ufd in my case) from Reset to Ground to keep AVRDUDE from resetting the Arduino.

Once you have the ArduinoISP connected, instead of burning a bootloader, try to upload a simple Sketch like Blink. Don't forget to add an LED + resistor on pin 13. If that works then you've proven that your ArduinoISP really is working the way it should. Reburn the bootloader.

When Blink + burning the bootloader works, I think these are the remaining possibilities...

  1. You didn't get RX + TX connected correctly (loose wire, swapped).

  2. You didn't get the Arduino processor "disabled" when you tried to upload a Sketch to the target.

Onions:

After you hook up your breadboard to RX and DX and removed the chip from you main board, connect a wire from the pin 1 on the main board (now empty) socket (not pin 1 on the headers.....on the chip socket)and connect it to the pin 1 on your on-breadboard chip.

That makes sense, as pin 1 is the reset, and we will need to reset the IC to program it.

Just tested it, and it still does not work. Thanks anyway though!
Onions.

Newcastle..........great beer!

What Arduino do you have? The Uno? I have the Uno.

Are you trying to load on a breadboard that as a 16mhz crystal or are you using the internal clock?
I forgot to say that I do it with a 16mhz resonator. I never go it to work with the 8mhz breadbord thing.

I had experience with both Parallel Programmer and A Serial programmer out of the two make the Serial programmer the LINK > diy4fun: Simple Serial Programmer for AVR ,Although i had some different circuit but this will work as fine, WHY SERIAL OVER PARALLEL?, The thing is the LCP1 port is taken as a Printer port by the system, so sometimes it's harder to amend that ,sometimes you have made all the right settings in preferences.txt, boards.txt and in windows but it wont just work's , so further use the PONYPROG and that's it!, will work Fine, i was able to do read and write (And that's all! mainly).(although in one of my experiment i burned my ATmega168 but yes after uploading it.).

So with my experience use the SERIAL + PONYPROG Really easiest and most cost effective method.

and ALPARENT is right , i have had the same problems with this UNO and internal Oscillator ,it's just needing an CRYSTAL and 2 22PF caps not that COSTLY!

WATCH MY VIDEO about this STANDALONE!

Let us know what board you have.
And I can give you a step-by-step of what worked for me. (If you want?)

I didn't need an external programmer. Just my Uno, a spare atmega, a breadboard, a 16mhz 3 pin resonator (as the caps integrated) and a 10k resistor.

Hello again!

What is the exact error message you are getting when you try to program the chip?

"Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions" in the bar, and
avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51
In the box below.

What Arduino do you have? The Uno? I have the Uno.

Are you trying to load on a breadboard that as a 16mhz crystal or are you using the internal clock?
I forgot to say that I do it with a 16mhz resonator. I never go it to work with the 8mhz breadbord thing.

I am using the duemillanove. Yes, I was trying to load the program onto a 328 on a breadboard, set up to use the internal oscillator. I will probably end up using the resonators / crystals instead.

So with my experience use the SERIAL + PONYPROG Really easiest and most cost effective method.

and ALPARENT is right , I have had the same problems with this UNO and internal Oscillator ,it's just needing an CRYSTAL and 2 22PF caps, not that COSTLY!

The only problem is, I do not have the crystal, capacitors, or a resonator lying around, and I forgot to order one with the 328 :(.

Let us know what board you have.
And I can give you a step-by-step of what worked for me. (If you want?)

That would be good, thanks! :smiley:

I didn't need an external programmer. Just my Uno, a spare atmega, a breadboard, a 16mhz 3 pin resonator (as the caps integrated) and a 10k resistor.

I will probably end up using the same. The only problem is, local electronics shop is shut tommorow, so I cannot buy the bits yet. :frowning:

Once you have the ArduinoISP connected, instead of burning a bootloader, try to upload a simple Sketch like Blink. Don't forget to add an LED + resistor on pin 13. If that works then you've proven that your ArduinoISP really is working the way it should. Reburn the bootloader.

When Blink + burning the bootloader works, I think these are the remaining possibilities...

  1. You didn't get RX + TX connected correctly (loose wire, swapped).

  2. You didn't get the Arduino processor "disabled" when you tried to upload a Sketch to the target.

I will try that now...

Thanks everyone!
Onions.

No, I cannot upload blink to the new 328 with the arduino as an ISP.
I uploaded the “arduino as ISP” sketch to the original 328 on the arduino, then uploaded blink with the “ATmega328 on breadboard (with 8MHz internal oscillator)” option, and it uploaded to the original 328 instead – the one I was trying to use as the ISP. This was very annoying, and confusing. I took the original 328 out of the arduino, and replaced it with the new 328 that was not working. I then uploaded the blink sketch in the same way as before, and it did not work again! As everything with the breadboard (internal oscillator) option failed, I tried to upload it to the 328 in the same way that I would with any other program (using the duemilanove option). Once again, it did not work. Each time, it came up with the warning in the previous post.
Thanks again, Onions.

Ok let's just start over.

First you need a board with a working atmega.
Then there are 2 steps. 1- Put the boot loader on the chip (this might be done already) 2. Put the sketch on the chip.

To do the first part, load the Use Arduino as ISP sketch to the chip on the board.
Make sure you ave selected the right board and the right port.
Then connect you breadboard like this (bottom secion of this page) Circuit (targeting an AVR on a breadboard) http://arduino.cc/en/Tutorial/ArduinoISP
Like I said it only worked if I used an external clock. (I have the Uno board, with optiboot)

Then use the burn bootloader with arduino as ISP.

Now your new chip as a bootloader!

Then remove the chip from your board.

You could just pop the new chip on the board and program any sketch you would like on it.

But is you want leave the chip on the breadboard and load a sketch on in.........do this.....

Disconnect wires to header pin 10,11,12,13 and connect pins rx and tx the the rx and tx pins on the atmega on the breadboard. Like this
http://arduino.cc/en/Tutorial/ArduinoToBreadboard Uploading Using an Arduino Board

Then add a wire from the board socket pin 1 (reset) to the breadboard chip pin 1 (reset)

Then load the sketch you want to the chip on the breadboard.

Remember never to change the board selection............but like I said it only worked with an external clock.

I uploaded the “arduino as ISP” sketch to the original 328 on the arduino, then uploaded blink with the “ATmega328 on breadboard (with 8MHz internal oscillator)” option, and it uploaded to the original 328 instead – the one I was trying to use as the ISP

After uploading the Arduino ISP sketch, did you disable auto-reset on the Arduino?

Thanks alparent! I am hoping to go out and buy the resonator tomorrow, so I will let you know how I get on.

After uploading the Arduino ISP sketch, did you disable auto-reset on the Arduino?

I don't know how to :~. I might have done it accidentally though...

Thanks again guys!
Onions.

Start with this...
http://www.arduino.cc/playground/Main/DisablingAutoResetOnSerialConnection

No, I haven't put a 120ohm resistor in, or taken anything out, and I don't think I changed any of the software...

Out of interest, what differences would it make if I did disable the auto-reset? Apart from having to hold the reset button, will it add more memory, or speed up upload times?

Onions.

The Arduino ISP sketch will not work unless you disable auto-reset on the Arduino. By failing to disable auto-reset, the bootloader in your Arduino responds to AVRDUDE instead of the Arduino ISP sketch. AVRDUDE is communicating with the wrong party.

Coding...

Is this behaviour with only when using avrdude with an Arduino as an ISP from the command line or also when burning from the IDE?

I ask because I regularly upload bootloaders and code to ATMegas and ATtinys from the IDE.

I use my USBASP from the avrdude cli.

Typically, there won't be any difference between running AVRDUDE from a command-line or using the IDE to invoke AVRDUDE. Practically, there may be differences due to the PATH or operating system security (or something else I'm not aware of on Linux / Mac OS).

I ask because I regularly upload bootloaders and code to ATMegas and ATtinys from the IDE.

Using an Arduino running the Arduino ISP sketch? With auto-reset intact?

I didn't need any of this? I have a Uno (dose it make a difference?)

Loaded the bootloader with no problems. Is there code in the load boatlooder tool that disable the auto-reset?

To load sketches to a chip with a bootloader I'm not using Arduino as ISP.....I remove the chip on the Uno then connect TX, RX and the reset to my breadboard and load any sketch. (Yes I could just pop the new chip with bootloader on the Uno board. But I'm not working with 28 pin lately.....I'm using 32 pin SMD).The IDE thinks it's loading to the chip on the board but it's redirected to the one on the breadboard.

I will be getting some atmega48 SMD soon (they have no place for a bootloader) and I guess I will have to use Arduino as IDE to load my sketch on them. Then I figure I might need this disable the auto-reset trick?

OK i was just thinking?

Are you saying that if I just disable the auto-reset, I wouldn't have to remove the chip on the board, I wouldn't have to change my wiring.....cause bypassing the auto-reset would cause the Arduino as ISP sketch to keep running and it would grab the new sketck and put it on the external chip (like it dose for the bootloader)?

If so, this means there is something in the load bootloader tool that disables the auto-reset.