Pages: [1]   Go Down
Author Topic: Arduino Mega 2560 bootloader  (Read 4033 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 134
Posts: 6762
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27113
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27113
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.


* AVR_ISP_MKii_path.jpg (74.51 KB, 960x720 - viewed 81 times.)
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset 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
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27113
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27113
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
Code:
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.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27113
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27113
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Wahiawa, Hawaii
Offline Offline
God Member
*****
Karma: 29
Posts: 600
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

Pages: [1]   Go Up
Jump to: