Which Bootloader Should I Use?

I am in the middle of a project in which I will be embedding an almost exact Arduino clone. This project will be using an ATMega382P-AU in a TQFP package for the microcontroller, and an FT232RL for serial communications, wired in the exact same way as the Arduino Duemilanove. The only differences in the two schematics are that mine has the USB V+ pin not connected, as I plan to only use an external power supply, and AREF is tied to +5V. The ATMega382 will be coming straight from Digikey, with no bootloader.

There are a few bootloaders to chose from, and I don't want to permanently mess up my chip after I solder it in (It is SMD). My questions are:

1: Does the latest version of the Arduino IDE have the Duemilanove bootloader(with the faster timeout), and would it work correctly in my application?
2: Does the latest version of the Arduino IDE have the Optiboot bootloader, and would it work correctly in my application (without the notorious "flash amnessia")?
3: Are there any better bootloaders than these that would work correctly in my application?

Also, I saw in the notes for ArduinoISP that

Windows users should consider WinAVR's avrdude instead of the avrdude included with Arduino software.

Should I take this into consideration, because I am running Windows Vista 32-bit.

Thanks.

1: Does the latest version of the Arduino IDE have the Duemilanove bootloader(with the faster timeout), and would it work correctly in my application?

Yes, the file name is ATmegaBOOT_168_atmega328.hex and is located in the IDE core library

2: Does the latest version of the Arduino IDE have the Optiboot bootloader, and would it work correctly in my application (without the notorious "flash amnessia")?

It's also there, called optiboot_atmega328.hex . Don't see why it wouldn't work, but of course then you have to select the Uno board if compiling in the Arduino IDE. I haven't direct experience with this bootloader so I can't really recommend it or not, but it does take up a little less room leaving the difference available for you application code. Not sure about the anmessia problem.
3: Are there any better bootloaders than these that would work correctly in my application?

I use the 328 bootloader from the Adafruit site, they modified it. It has very short timeout length and handles watch dog timer interrupts correctly. Called ATmegaBOOT_xx8_adaboot328.hex and was downloaded from their site along with source code called Adaboot328.zip. It can take a time finding where they hide that download, but it is there and has been very reliable for me. Here it is somewhere close: :wink: Arduino Hacks

Also, I saw in the notes for ArduinoISP that
Quote:

Windows users should consider WinAVR's avrdude instead of the avrdude included with Arduino software.
Should I take this into consideration, because I am running Windows Vista 32-bit.

Not sure if that is important or not presently. AVRDUDE is a separately run open source project that updates on it's own schedule and frequently the latest version available does not match the one the Arduino is using in their release. It's pretty simple to update the AVRDUDE files yourself into the arduino core directory if there was a need.

You stated you are wiring +5vdc to the Aref pin. This can work but the same reference voltage is available and used by the Arduino A/D code by utilizing the +5vdc from the Avcc pin. By hardwiring voltage to the Aref pin, if you every accidentally switched to the internal 1.1 bandgap voltage I belive there would be a high current path created and possible damage to the chip. Best to just leave Aref open unless you really need it for some non-standard reference voltage.

Lefty

Thank you for your input. I had heard of Adaboot, but I didn't know that she had a download sitting somewhere.

About AREF, I had been wondering what to do if I didn't want to use it. I couldn't find out by the datasheet, so I tied it to +5. Thank you for telling me to leave it floating, because I wouldn't want to risk frying my fairly expensive(relative to my usual budget) project.

Another option for AREF is to decouple it to help reduce noise when using the internal option.


Rob

This is kind of getting off topic, but if my application will not be doing anything with analog inputs, how should I leave AREF; floating or decoupled to GND(or other option)?

So impressed am I with the Opti-boot loader, I've reflashed my Uno with the Duemilanove one......

This is kind of getting off topic, but if my application will not be doing anything with analog inputs, how should I leave AREF; floating or decoupled to GND(or other option)?

If not using analog input then just leave it floating free. The arduino design leaves it floating even if you use analogRead() statements. :wink:

Lefty

Hello, Im relatively new this and but have a project similar to Beta's. An ATmega328 TQFP package from digikey and trying to bootload it with an AVRISP mkII. The circuit its in is the same as the pro-mini. The bootload didnt work using the Arduino IDE and the work-arounds I found were dated and a little confusing. So now Im trying it using the AVR studio 4. And wondering about the proper fuse settings, etc. Really what I want to know is: What's the best solution for a newbie like me to get this thing loaded and functioning?

Also, once burned, can it be reburned with new fuse settings?

Thanks

wondering about the proper fuse settings, etc.

Fuse settings are dependent on lots of variables. Type (and speed) of clock, size of bootloader, etc. If you're using optiboot and a 16MHz crystal, you should be able to get by with the fuses shown in the Arduino boards.txt file. If you have something else, you can ask specifically or dig in to the datasheet (which is particularly confusing when it comes to the fuses.)

What's the best solution for a newbie like me to get this thing loaded and functioning?

If it's a 16MHz arduino clone and you want optiboot, and you have an existing arduino, you can use my "optifix" sketch: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1295516707

Also, once burned, can it be reburned with new fuse settings?

Yes, in general. There are some fuses that will effectively turn off the ability to do ISP programming, in which case you will need to find a programmer that supports "high voltage programming" to fix it. But in theory, you can always start over...

Westfw, thanks for the info. Really appreciate the reply. Ill give your fix a try.

One more thing: I may want to use a chip like the ATtiny45 for a project. Is there a way to stick with the Arduino IDE or should I learn to use AVR Studio 4, etc. for that? My programming skills are rudimentary at this point.

Thanks again for your help,

Deej

One more thing: I may want to use a chip like the ATtiny45 for a project. Is there a way to stick with the Arduino IDE or should I learn to use AVR Studio 4, etc. for that?

The ATtiny45 will work but the ATtiny85 is a better choice. The 45 has very limited amount of SRAM and is a bit snug for Flash. But, it all depends on what you plan to do.

You will need to download a "core" and install it (basically unzip some files to the correct location). You will need an ICSP (or ISP or "programmer"). Your AVRISP mkII should work fine. You may need to use AVRDUDE directly (I haven't needed to with a Pololu programmer).