Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Burning Bootloader to Atmel 328p chip with Uno

Status
Not open for further replies.

MrAl

Well-Known Member
Most Helpful Member
Hi there,

Has anyone done this, it is supposed to be possible.

That is, we buy a raw totally unprogrammed 328p chip and burn the bootloader for Arduino using an Uno board and small breadboard jumpered to the Uno board, then burn the bootloader. The chips will be the 328p chips only in dip package.

I am hoping someone who did this already replies as i have seen other links on the web that are varied.
 
Hi dougy,

Thanks for the links. There is still a bit of uncertainty here though. For example, just *yesterday* i read that same article and it said that the board had to be a "Duemalova" or something like that and that it would not work with an "Uno". Now today it seems that someone changed it to remove that part of the message.

Also, in the link it states that we should use the command "Burn Bootloader > Arduino as ISP":
  1. Use the Burn Bootloader > Arduino as ISP command.
but there is no such command in the IDE.

This is what i mean, that there is nothing written that relates exactly to the software IDE. It's like maybe it works or maybe it doesnt.

Have you done this yourself yet?

Thanks for any info or ideas you might have.
 
The second link, post 5, describes the process as follows:
Using an Arduino and Avrdude to Program an AVR
see: https://www.sparkfun.com/tutorials/200

1) Upload ArduinoISP to the Arduino
2) Connect the Arduino to the Target Board's ISP signals
3) Generate the hex file to be loaded onto the Target Board
4) Use avrdude to send the hex file to the Arduino, which will program the Target Board

It was so simple!
The ArduinoISP is an example that you can load from the menu (File->Examples->ArduinoISP). It makes the Arduino behave as an AVRISP programmer.

Maybe you should just try it, and then worry if there are issues. It doesn't appear to be a complex task to upload the firmware and wire up the IC.
 
Hi dougy,

So you are saying perhaps that it is much easier than it reads on the forums i guess. Yes, that's probably the case but i need to buy some chips and i did not want to buy too many if there would be a problem, so i thought i would ask around first.

When they say "Generate the hex file to be loaded" does that means click the 'check' button ie compile the "Arduino as ISP" sketch?
I ask because there is nothing clear in the software that says "generate hex file" or related.
 
Programming an ATMEGA with a programmer is simple. The ArduinoISP sketch turns the arduino into a programmer. You can use AVRDUDE, as described in a previous post, and it appears you can use the 'burn bootloader' option from one of the menus if you don't want to use AVRDUDE.

The bootloader hex files are in the bootloaders folder under the Arduino installation folder. Optiboot is the one used for the Uno, and you will see a hex file compiled for the '328.
 
Hi again,

So i guess it goes after the hex file of the board that is being used as the ISP programmer then (in this case the Uno) ?
 
I'm not sure what you're saying.

My take on the steps is:
1. connect Uno
2. open ArduinoISP sketch example
3. upload to Uno
4. connect Uno to '328 on breadboard using some wires
5a. select tools->programmer->"Arduino as ISP", tools->"burn bootloader" (I think bootloader may be chosen automatically based on device ID)
5b. alternative to 5a: use AVRDUDE

edit: step 5a reordered
 
Last edited:
Hi again dougy,

Ok, i follow this up to step 5a, but i do get an option to select "Arduino as ISP" for the "programmer", as that is the programmer after loading the sketch.

But are you saying that after you select "Burn bootloader" from the menu that another window of some type comes up and asks for the hex file?
What happens now is i can not actually go through the steps yet because when i click "burn bootloader" it always gives an error message, and that is because i can not connect my board yet because it is currently the only working chip i have (on the board). I have to wait for the new chips to get here then i can try going through the actual steps, step 5a in particular.

I get an error without a board connected and the serial port that is usually used for it (which no longer shows up) and if i switch to another COM port i get a different error. So it looks like i have to wait until the chips get here to actually go through that last step and see what happens.
 
I just tried burning the bootloader from the arduino ide, and the hex file is chosen automatically. Tested burnt uC in arduino pcb with 'blink' program and it worked fine. Be sure to put a crystal (>= 4MHz) in the breadboard (caps aren't required).
 
Hi again,

Hey thanks very much dougy, that means it is as simple as that then and i can order more blank chips.

You are also saying that the secondary chip will program without any parallel loading caps like the two 22pf or similar? That's interesting too.

I get the feeling that a lot of the other stuff on the web is outdated when the IDE first came out or something and it did not work with Uno, or at least no one had a method yet.

Just one more last question, is the 10uf cap needed on the reset pin of the original chip in the Uno board when the boot loader is burnt in the new chip, or is that just for when doing serial programming of the new chip after the bootloader has been burnt and wires changed for 'normal' serial programming?
 
Yes, it's simple. I don't think I've ever needed the loading caps on a breadboard (which should provide only ~3pF) but feel free to put them in.

Can you include a picture or link to what you're referring to in your final paragraph?
 
Hi dougy,

Yes, here is an excerpt from the Arduino site page (link shown later but they change it every day sometimes).
Note item number 5 below.

Code:
Instructions
To use your Arduino board to burn a bootloader onto an AVR, you need to follow a few simple steps.


[1] Open the ArduinoISP firmware (in Examples) to your Arduino board.
[2] Note for Arduino 1.0: you need to make one small change to the ArduinoISP code. Find
the line in the heartbeat()function that says "delay(40);" and change it to "delay(20);".
[3] Select the items in the Tools > Board and Serial Port menus that correspond to the board
you are using as the programmer (not the board being programmed).
[4] Upload the ArduinoISP sketch.
[5] Wire your Arduino board to the target as shown in the diagram below. (Note for the
Arduino Uno: you'll need to add a 10 uF capacitor between reset and ground.)
[6] Select the item in the Tools > Board menu that corresponds to the board on which you
want to burn the bootloader (not the board that you're using as the programmer). See
the board descriptions on the environment page for details.
[7] Use the Burn Bootloader > Arduino as ISP command.

https://arduino.cc/en/Tutorial/ArduinoISP#.Ux5zHD-Sx_7
 
I didn't use the cap on reset and it didn't complain.

The "#.UyODQD-Sx_7" in the link just points to an anchor tag in the page and doesn't matter (it is resolved on the client PC {not even sent to the server}, so the correct page will have already been loaded from the server). The actual link won't change though.
 
Last edited:
Hello again dougy,

Oh that's great news. That means the idea that the cap is only needed for serial programming using the Tx and Rx pins is probably right then. I thought something was up because this new info appeared the day after the previous day where other info had changed, so i assumed someone was changing it on the fly and maybe not checking their facts first.
I've seen the 10uf cap being used, but it was used when the guy (other site) was doing a sketch upload to the breadboard chip. That's a different connection i believe, unless that info has changed now too.

Did you by any chance try uploading a new sketch to the breadboard chip yet?
 
I uploaded the blink sketch to the breadboard chip by placing it into the arduino uno socket. You shouldn't have much issue in the breadboard though. I guess you'd just route the VCC, GND, TX, RX and RESET pins to the appropriate places, remove the '328 from the arduino pcb (so that you're just using the uno pcb as a USB-serial interface), and do the usual compile/upload.

Another option is to just insert a zif socket in the uno and upload programs via the bootloader that way.

Alternately, you could probably burn the whole bootloader and main code through the ArduinoISP in a single step - just read the device contents after the two-step burn and write it each new chip. There may be an easier way to do this. You can use AVRDUDE to do the reading/writing if it's not available from the arduino IDE.
 
Hi,

Insert a zif socket into the Uno? How? No zif socket i every found would fit into a regular socket. If you know a trick please let me know.

Since the Arduino board has to act as a ICSP i thought that it would not be possible to load the boot loader into the same chip that was doing the ICSP. Maybe this works too though?

Thanks.
 
I have ZIF sockets that fit into the holes of the IC they accept.
Since the Arduino board has to act as a ICSP i thought that it would not be possible to load the boot loader into the same chip that was doing the ICSP. Maybe this works too though?
For the two-step process, the arduino is first used to load the bootloader onto all the blank ICs. The second step is to load the application program to the chips, and that may be done by removing the uC from the arduino pcb and inserting the uC to be programmed into the socket. Alternately, you could just route the TX and RX lines from the arduino pcb (with its uC removed) to the uC on the breadboard.
 
Hi again dougy,

You have ZIF sockets that fit the holes of the socket on the Arduino board? Where did you get them? I ask because all the ones i see for sales these days have rectangular pins that are twisted relative to the orientation of the metal strips used to create the socket pins. So they dont fit in any double wipe socket for example.

We talked about this in another thread, so if you know of where to get one that actually fits normal sockets that would be good to post :)
 
Hi again,

Ok, i got the chips today (late late in the day) and tried the burn bootloader and it seems to work pretty well. It's just a little tricky at first because there is conflicting information on the web. For example, we dont use a 10uf cap on the reset pin of the Uno board, but we do use a pullup resistor on pin 1 of the new Atmel chip to be programmed (supposed to be 10k but i used 22k and it worked ok).
Also, the IDE setup is a little strange because we first have to upload the ArduinoISP sketch, compile it, then upload it to the Uno board ('programmer' set in the IDE to standard AVRISP mkII ) and that is before making any external connections. Then cut power and then the new chip is connected via plugboard and jumpers, then restore power then burn bootloader (using 'programmer' as Arduino as ISP this time).
So there are a couple of steps to follow.
Also, the test sketch loaded after that too using the "Upload using Programmer" menu command after compiling the test sketch "Blink".

[LATER]
Note the above part of this post was in reference to the Atmega 328 chip.
I found that the 10uf cap seems to be needed for programing of the ATTiny85 chip. First try without it failed, and only after power down and adding the cap then power up and closing out the IDE and opening it again did the Blink sketch (with LED pin change) upload properly.

So apparently the Uno board can be used to program the Atmega 328 chip and also the ATTiny85 chip. Not too bad i guess.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top