Arduino Mega 2560 bootloader

Hi,

Today I bought my first Arduino development board (Mega 2560 rev3).

Since I'm a newbie to the Arduino world I would like to request help on how I can restore/burn the Arduino factory bootloader?
I would like to do this using AVR Studio IDE + AVRISP MKII if possible.
I have tried, with Arduino IDE 1.0.2, to "burn the bootloader" but I'm always getting the following error message:
avrdude: usbdev_open(): did not find any USB device "usb"

I'm using Windows 7 where I have AVR Studio 6 IDE and Arduino IDE 1.0.2 installed and I also have an AVRISP MKII programmer.
Can anyone help me on this matter?

Thanks in advance.

  • MicroC

Iirc, avrisp mk II needs different firmware, or different drivers, depending on whether you use it with avrdude (arduino), or the Atmel tools. Check avr freaks.net...

MKii driver has been discussed here.
Is located in the arduino files.
Search for "Jungo" for threads on how install the libusb for arduino in place of default jungo driver.

Hi CrossRoads,

Thanks for the tips.
It seems that the error that I get when using the Arduino IDE is driver related.
The Arduino MKII drivers and the Jungo drivers are incompatible. I have tested in my friend laptop using only the Arduino tools and it worked fine.
Since I need to have the AVR Studio IDE, is it possible to burn the Arduino bootloader using this IDE?
If yes, how can I do it?

Thanks in advance,

  • MicroC

You may have to remove/uninstall the Jungo driver & install the MKii driver so they don't conflict.

I load 328 & 1284 boards with mine using the IDE.
I burn a bootloader first to set the fuses, and then use File:Upload Using Programmer to load the sketch and leave out the bootloader when I want sketches to start immediately after a reset.

Hi.

Yes, that is one option and it must work. Since I need to have the AVR Studio installed and its related drivers, is it possible to burn the Arduino bootloader using the AVR Studio? If yes, how can I do it?

Thanks in advance.
-MicroC

Under Tools:AVR Programmer, I think you browse to the bootloader file & go from there.

I find it quicker to just burn it within the IDE tho.

Hi CrossRoads,

In order to summarize what is my understanding from the posts:

  1. erase the chip memory
  2. burn the fuses
  3. burn the lock bits
  4. burn the file stk500boot_v2_mega2560.hex under the folder arduino-1.0.2\hardware\arduino\bootloaders\stk500v2?

Should the fuses and lock bits be set as:
0xFF = fuse low
0xD8 = fuse high
0xFD = fuse extended
0xCF = lock bits

Is this a complete procedure? Am I missing something?

Thanks in advance,

  • MicroC

I'm trying to fire up my version of AVR Studio5.1 to check - it doesn't seem to want to recognize my MKii since I changed the drivers for it to work with the IDE. Downloading 6.0 to see if that fixes it.

Sounds about right tho. Fuses look to agree with the settings in boards.txt:

mega2560.name=Arduino Mega 2560 or Mega ADK

mega2560.upload.protocol=wiring
mega2560.upload.maximum_size=258048
mega2560.upload.speed=115200

mega2560.bootloader.low_fuses=0xFF
mega2560.bootloader.high_fuses=0xD8
mega2560.bootloader.extended_fuses=0xFD
mega2560.bootloader.path=stk500v2
mega2560.bootloader.file=stk500boot_v2_mega2560.hex
mega2560.bootloader.unlock_bits=0x3F
mega2560.bootloader.lock_bits=0x0F

mega2560.build.mcu=atmega2560
mega2560.build.f_cpu=16000000L
mega2560.build.core=arduino
mega2560.build.variant=mega

That's why I do this in the IDE:
Burn the bootloader, which sets the fuses
Download the sketch via File: Upload Using Programmer, wipes out the bootloader, leaves the fuses, and the sketch starts immediately after a reset.

Well, I downloaded & installed Studio 6, still not seeing my MKii.
Arduino IDE does, bootloaded a '328P as I descibe above.

Hi CrossRoads,

I have managed to burn the bootloader without any problems with AVR Studio 6.
The trick is to have only the AVR Studio 6 drivers installed.

Thank you for your help,

  • MicroC

Need the LibUSB-Win32 Devices driver for AVRISPmkII to show up in Device Manager for the MKii to work in the IDE.
I stopped using AVR Studio because it takes too long to start up, and I don't need that strong of an environment for the kind of programming I do.

Some versions of the AVRISPmkII programmer can be made to work under both libusb and Atmel Jungo. All you need is to install the libUSB-Filter utility. Then run the Filter Wizard and add AVRISPmkII to it.

Again it only works with some versions of AVRISPmkII. I have this working with the Atmel AVRISPmkII programmer and also some other clone versions.