Go Down

Topic: atmega168 bootloading.. (Read 841 times) previous topic - next topic

jfernsler

So, just to summarize, there's no way to burn a bootloader on an atmega168 using the arduino board? Even though right in the menu it says "Burn Bootloader" when the atmega8 is selected? Why is that there? Why does it not work? I have a couple 168's from a friend and would like to use them as an arduino.. but I have no avr programmer. Is that functionality impossible to build for a serial device?

I've only seen parallel programmers - but having a mac, I don't have a parallel port. Is there a homemade serial/usb progammer one can build?

I'd like to use the programmed chip in standalone projects - does this mean that technically i would have to buy an arduino board each time? I don't want to use the board w/ some projects - just the chip. I guess I was thinking I'd be able to slap a new chip in, burn the bootloader and begin again w/ a new chip.. wash, rinse repeat...

so, is there a programmer I can build for my mac? heh.

-JF

kg4wsv

I think the "burn programmer" menu item assumes you've got a programmer attached.

The arduino can be used as a programmer.  Info at http://tinker.it/now/2006/12/04/turn-arduino-into-an-avr-isp-programmer/ as well as on the forum.  I haven't tried this yet, but if it works out I might just buy another Arduino NG to use for a programmer (and have a spare Arduino).

There are also serial programmers.  I found some info at www.lancos.com.  Takes a little bit of digging, but you can piece together a serial programmer schematic for the AVR.  Atmel used to sell a serial programmer, but I think all they have now is the USB model.

-j

Daniel

#2
Feb 03, 2007, 05:26 am Last Edit: Feb 03, 2007, 05:53 am by Daniel Reason: 1
Quote
So, just to summarize, there's no way to burn a bootloader on an atmega168 using the arduino board?


You can burn the bootloader onto an Atmega8 or 168 using the ICSP pins, but you will still need an external programmer.

The Arduino design has always called for an external programmer to burn the bootloader onto the chip.

This is a basic, industry-wide fact of how most of these microcontrollers work: they almost always need a programmer to apply the correct programming voltages and signals.  Using a bootloader is one way to avoid using a programmer... but of course you have to burn that bootloader first with an external programmer.

I actually just burned a couple of Arduino boards with ATMEGA168's on them. It was easy once set up, all I needed was an AVRISP mkII programmer, and AVR Studio 4. This was on a MacBook Pro, running Windows XP in the latest release of Parallels workstation. Works like a charm. :)  

bigfun

If you want to build a serial-capable ICSP burner for the Arduino, this is the circuit diagram:
http://www.olimex.com/dev/pdf/avr-pg1b.pdf
I actually bought the programmer from Olimex and it works great
but I later needed to build a second one myself on this Olimex breadboard:
http://www.olimex.com/dev/avr-p28.html
so I could flip a 6PDT switch to switch a single serial cable from "standard Arduino serial" to "ICSP burning" and back again.
(In the version of the circuit I built, I replaced whatever NPN transistors Olimex uses with standard 2N2222s and they worked fine.)

Here are some pics of my Olimex Arduino programmer, front and back, afterwards and before:



bigfun

I should add, by the way, that I use AVRdude (the free command line AVR tool) in WindowsXP to put  bootloaderd on my Atmega chips, not Arduino.  But once I'm done loading the bootloaders, I flip my 6PDT switch and use the Arduino IDE with my Olimex board.  To make it usable in the world of Arduino, all I had to do was replace the 8MHz crystal with a 16MHz one and hook up two wires to the serial chip.

When programming with AVRdude, these are the three command lines I use:

avrdude -patmega168 -cponyser -Pcom1 -b56000 -u -v  -Uhfuse:w:0xdf:m -Ulfuse:w:0xc7:m -Uefuse:w:0x08:m
(to set the fuses for the world of Arduino)
avrdude -patmega168 -cponyser -Pcom1 -b56000 -u -v  -Uflash:w:a.hex
(a.hex being a copy of the Atmega168 bootloader)
avrdude -patmega168  -b56000 -Pcom1  -cponyser  -V -U lock:w:0xCF:m
(to lock the bootloader part of the Atmega's flash memory)

Go Up