Loading bootloader to an Atmega8U2, easiest way?

I have a PCB I designed very similar to the Mega2560 Arduino. It has an AtMega8U2 that is properly connected to USB and also to an AtMega2560. The chips are straight from Atmel and stock.

What is the best way to get things going? My understanding is I first have to get a bootloader onto the AtMega8U2 chip? I can use USB or I have an AVR ISP MkII programmer available as well. ISP pin headers are available for both chips. What is the easiest way?

I don't think the bootloader goes on the '8U2. It needs the USB to serial communications code. The code they put on the original UNO's 8U2 might work. It should be available from the Arduino site some where. The bootloader would go on the '2560.

Either way, you'd need your ISP programmer to put the code on them.

DirtBiker:
I don't think the bootloader goes on the '8U2. It needs the USB to serial communications code. The code they put on the original UNO's 8U2 might work. It should be available from the Arduino site some where. The bootloader would go on the '2560.

Either way, you'd need your ISP programmer to put the code on them.

That is correct. One is said to burn 'firmware' into a 8U2 chip to turn it into a USB serial converter chip. A bootloader is what one burns into the mega2560 chip. To burn the firmware into a 8U2 chip or a bootloader in amega2560 requires a hardware ICSP programmer which can be a standard arduino board running the arduino as ISP sketch or some other standalone hardware ICSP programmer of which the arduino IDE supports several different models that can be seen in the IDE tools/programmer pull down menu. Both the firmware and bootloader HEX files are included in the arduino IDE distribution software that is installed in your PC.

Lefty

Thanks for the help! So to clarify, I'd need to FIRST load the firmware onto the 8U2. I would then have USB functionality, correct? Can I then use the 8U2 over USB to load the bootloader AND software onto the 2560?

What file do I need for the 8U2 firmware and how would I load it with the hardware programmer? I have the Atmel FLIP software if that helps.

monkey123:
Thanks for the help! So to clarify, I'd need to FIRST load the firmware onto the 8U2. I would then have USB functionality, correct?
Yes, you would then have created a USB virtual serial port communications link to and from the PC.

Can I then use the 8U2 over USB to load the bootloader AND software onto the 2560?
No, the bootloader for the 2560 needs to be installed via a ICSP hardware programmer, which can be another arduino board loaded with the arduino as ICP sketch. The 8U2 chip is not a ICSP programmer, it's just a USB serial converter chip. So whatever you used to install the firmware into the 8U2 chip is what you would use to burn the bootloader into the 2560 chip.

What file do I need for the 8U2 firmware and how would I load it with the hardware programmer? I have the Atmel FLIP software if that helps.

I've never owned a arduino board with a 8U2 chip so I'm not the one to give you specific steps to take. However the first step is identifying and obtaining the ICSP programmer you are going to use to load the firmware and later the bootloader for the 2560 chip.

Lefty

I'll be using the AVR ISP MkII programmer. So:

  1. Load firmware on 8U2.
  2. Load bootloader on 2560.
  3. I can now connect via USB and upload sketches to the 2560?

If all goes well, yes.

Can anybody point me in the direction to load the 8U2 firmware and 2560 bootloader? All the resources I've found have been less than helpful.

You could use avrdude. Use a command line like:

avrdude -P com4 -b 19200 -p m328p -c avrisp -Ulock:w:0x0F:m -Uhfuse:w:0xDA:m -Ulfuse:w:0xFF:m -Uefuse:w:0x05:m -V -Uflash:w:MyFile.hex:i –u

That particular command will load MyFile.hex onto an ATmega328p through an AVR ISP attached to com4. You would have to make the desired/required changes to the com port (-P), to the chip (-p), to the fuses and to specify whatever hex file you want. Id' suggest reading through the avrdude documentation too.

EDIT:
Actually, if you have the Arduino software loaded up, go to the Ardunio home directory. Then go to:

hardware->arduino->firmwares

In that directory is a README.txt that explains how to get the firmware onto the ATmega8U2 for use with a ATmega2560.

Crazy question. When updating the firmware or bootloader on these chips, do you need to connect them to external power, or does the ICSP programmer supply power to the chips?

Some programmers can supply power through the ICSP, some can't. So the quick answer is, it depends on the programmer you choose.

DirtBiker:
Some programmers can supply power through the ICSP, some can't. So the quick answer is, it depends on the programmer you choose.

AVR ISP Mkii

monkey123:

DirtBiker:
Some programmers can supply power through the ICSP, some can't. So the quick answer is, it depends on the programmer you choose.

AVR ISP Mkii

I believe that is one of the programmers that cannot power the target chip, thus external power is need for the target chip.

Lefty

I believe that is one of the programmers that cannot power the target chip

I believe so as well.

retrolefty:

monkey123:

DirtBiker:
Some programmers can supply power through the ICSP, some can't. So the quick answer is, it depends on the programmer you choose.

AVR ISP Mkii

I believe that is one of the programmers that cannot power the target chip, thus external power is need for the target chip.

Lefty

Interesting. But that would make sense since it is reading 0 volts. Thanks for the tip. :slight_smile: I will try external power to the chip.