Go Down

Topic: Standalone Arduino 328P, Uno board as programmer (Read 8737 times) previous topic - next topic

FerryP

Hi all!

First post. I've just discovered the beaty of Arduino. I'd like to build a small board, breadboard or similar. I've bought a ATMega 328P w/ bootloader, and I've got two Uno boards. How can I upload sketches to a standalone 328P? I've been googling a bit and trying to find out, but I still need some advice. Been reading this: http://www.arduino.cc/en/Main/Standalone and this: http://arduino.cc/en/Tutorial/ArduinoISP

- Do I have to burn a new bootloader to the standalone chip? If so I guess it's easy to do so by putting it on the Uno board.

- Can I then upload sketches to the standalone chip by using TX/RX lines from a Uno board? The standalone will have power and x-tal. How do I wire it up? tx to tx, or tx to rx?

I guess this must have been done a billion times before, so please give me some slack if I'm flooding the forum with the same question again.

Thanks!


Atlant

FerryP,
if you got another board, just remove chip from it, replace with your 328 with bootloader and upload your sketch into it.
You do not need new bootloader being flashed into it.

retrolefty

I agree, especially when first starting out. As long as your Uno uses the DIP 328p chip with socket (not the Uno SMD) then just buy a replacement 328p chips that already have a bootloader installed in it. Later you can play with all the other methods one can use to upload sketches onto a standalone project if you want to.

http://www.sparkfun.com/products/10524

Lefty

FerryP

Thanks for your response! And sorry for my late answer. Reading a bit more I found this comment "NOTE: Currently, you cannot use an Arduino Uno as an ISP programmer because the optiboot bootloader does not support this sketch. A revision for this is in progress."
on http://arduino.cc/en/Tutorial/ArduinoISP. Anyone knows when or if the revision comes? Anyhow, I ordered a Duemilanove from Ebay. And a Sparkfun FTDI Basic http://www.sparkfun.com/products/9716 to play with. At the moment I'm running the 328P on a breadboard with a 16 MHz x-tal and two 22 pF caps. Running the reset, rx and tx lines from the UNO (with the 328 removed) Works just fine.

Texy

You CAN use the Uno to program bootloaders - the information on that page is out of date. Search on this forum and you will see how its done - you need will need a 10uF capacitor on the reset line to GND.
Texy

bperrybap

You can easily use any arduino, including UNO, to burn an optiboot bootloader into a 8/168/328.
It just isn't done using avrdude from the IDE GUI which requires the UNO to act as a stk500 ISP programmer.

You will want to use the optiloader sketch instead.
The difference is the "arduino as an ISP" sketch allows avrdude to use the arduino as a standalone ISP programmer
device.
It turns your your Arduino into an ISP programmer that can burn anything in a chip.

optiloader, it is a sketch that runs on your arduino that only knows how to burn an optiboot bootloader
into a 8/168/328 chip. The bootloader is contained inside the sketch itself so it can burn the chip
on its own.

If all you need/want to do is burn an optiboot bootloader, the optiloader
sketch  is probably a better/simpler solution
as there is no issue with autoreset since the sketch does everything.

Here is a link to the optiloader:
https://github.com/WestfW/OptiLoader

Another useful tool is the fusebytes sketch:
https://github.com/WestfW/fusebytes
It will display lots of useful chip information on the serial port.

--- bill

liudr

bperrybap beat me to it. (I had to teach though  :smiley-sweat:)

I would give westfw's work two thumbs up. I've had trouble bootloading one particular chip and it bricked. I was only able to unbrick it by loading it with westfw's updated optiboot bootloader. I have not tried the optiloader, which should be another highly regarded tool to mass-brainwash chips with older bootloaders or load a brain to blank chips. I ordered 25 blank chips and will have a go with optiloader later this week. I'm a couple hours drive to digi-key ;)

liudr

optiloader worked beautifully. I don't know how it was able to bootload so fast though. the arduino ISP program takes minutes!!!

cappy2112


You can easily use any arduino, including UNO, to burn an optiboot bootloader into a 8/168/328.
It just isn't done using avrdude from the IDE GUI which requires the UNO to act as a stk500 ISP programmer.



Bill- Are you referring to dropping a 328 into the socket of a Duemilanove or Uno board (for example),
and reprogramming the bootloader ,

or

are you referring to using a Duemilanove or Uno board- to reprogram the bootloader of an off-board-328?



CrossRoads

"I've bought a ATMega 328P w/ bootloader"
You already have a bootloader, all you need is a USB/Serial adapter to down load sketches into your standalone application using the Rx/Tx/DTR lines.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

liudr

I think Bill referred to the latter, using a Duemilanove dev board to boot load a 328 on a breadboard. You can't bootload a chip on the dev board with the dev board. You need one dev board to bootload another dev board or a single chip.

retrolefty


I think Bill referred to the latter, using a Duemilanove dev board to boot load a 328 on a breadboard. You can't bootload a chip on the dev board with the dev board. You need one dev board to bootload another dev board or a single chip.


I'm confused. Who's on first, no what's on second.  ;)

Lefty


bperrybap



You can easily use any arduino, including UNO, to burn an optiboot bootloader into a 8/168/328.
It just isn't done using avrdude from the IDE GUI which requires the UNO to act as a stk500 ISP programmer.



Bill- Are you referring to dropping a 328 into the socket of a Duemilanove or Uno board (for example),
and reprogramming the bootloader ,

or

are you referring to using a Duemilanove or Uno board- to reprogram the bootloader of an off-board-328?



I'm referring to using one Arduino board to program an off board 328 - which might also be in another Arduino board.

This is what the optiloader sketch does. It is a self contained sketch that knows how to burn the optiboot bootloader
with no interaction of any kind from avrdude or the PC host.
(the IDE uses avrdude under the hood for all programming/uploading operations)

You upload the optiloader sketch to one arduino board and that arduino board
can now program an externally wired up 8/168/328 on its own.
the optiloader sketch figures which AVR part is attached and burns the appropriate image.
(multiple bootloader images are built into the optiloader sketch)

Where as  the "arduino as an ISP" sketch does not know how to burn a bootloader but rather simply
knows how to process stk500 commands from the serial port sent by avrdude which in turn
toggles the ISP port to burn whatever code avrdude is sending it.

While optiloader is self contained, it can only burn an optiloader bootloader on 8/168/328 chips,
where as the arduino as an ISP can program pretty much anything.
But while the combination of avrdude and arduino as an ISP can program parts
with anything, the additional complexity of using avrdude talking to a sketch does
have some potential issues on certain Arduino boards.

Where as you can upload the optiloader sketch to an Arduino board and things
like autoreset are no longer an issue.

sbright33

https://github.com/WestfW/OptiLoader

How do I connect the 2 Uno's?  Which pins to which?

Can I change the fusebytes the same way?
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

westfw

13 to 13, 12 to 12, 11 to 11, 10 to RESET, GND to GND, +5 to +5.

Yes, this setup can/will also change the fusebytes.

Go Up