Loading...
Pages: [1]   Go Down
Author Topic: Arduino Mega 1280 - unable to program ( bootloader )  (Read 1059 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all, I've recently started using the arduinos by ordering a UNO and a MEGA.
So far the experience has been very good, much better to prototype than using PICs + programmer smiley

However, I've run into a problem on my MEGA board. I am not able to upload any programs to it and the indicator led (L) blinks at a rate of ~10Hz unless I keep the reset button depressed. I've tried the loopback test so I know the pc / arduino communications are (still) working.

My initial hunch was that the bootloader was somehow broken, so I tried to upload a new one using ArduinoISP.
However, avrdude reported:
avrdude: Device signature = 0x000000

So I copied the commandline and added -F, now the process continued, but there where errors. I tried several times, but they usualy gave errors regarding the fuse-state. And even when it did manage to finish, the MEGA would instantly go back to the ~10Hz blinking and not being able to accept new programming.

Have I somehow fried my MEGA? What other steps can I take to try and restore it?

thanks in advance!

- Arjan
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 245
Posts: 16516
Available for Design & Build services
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Get an bootloader device such as
http://www.mdfly.com/index.php?main_page=product_info&cPath=5_6&products_id=415
and reload the bootloader that way.

In programmers.txt, need to make a 2-line addition for it to show up on the menu.
I posted that yesterday and someone else posted the same programmer for $4.95 elsewhere.
Will be a handy tool for you.
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

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

well, for 4,95 I guess I could give it a go.. but will this really be different from programming the bootloader through ArduinoISP ?
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 245
Posts: 16516
Available for Design & Build services
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Should be the same, but this definitely works, while you have shown the other not to work.

http://www.hobbyking.com/hobbyking/store/__21321__USBasp_AVR_Programming_Device_for_ATMEL_proccessors.html
Don't know it will need software update before using.

programmers.txt change:
usbasp.name=MDFLY   <<< will show up as MDFLY under TOOLS:PROGRAMMER in the IDE
usbasp.protocol=usbasp
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

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

It's been a while, but I have received my programmer.
This is what I get when I try to burn a bootloader without the mega 1280 attached

         Using Port                    : usb
         Using Programmer              : usbasp
avrdude: seen device from vendor ->www.fischl.de<-
avrdude: seen product ->USBasp<-
         AVR Part                      : ATMEGA1280
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    10     8    0 no       4096    8      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash         65    10   256    0 yes    131072  256    512  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : usbasp
         Description     : USBasp, http://www.fischl.de/usbasp/

avrdude: auto set sck period (because given equals null)
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: error: programm enable: target doesn't answer. 1
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.



When I connect the programmer to my mega and try again, I get this message:

avrdude: Version 5.11, compiled on Sep  2 2011 at 18:52:52
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/Users/arjan/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : usb
         Using Programmer              : usbasp
avrdude: error: could not find USB device "USBasp" with vid=0x16c0 pid=0x5dc

avrdude done.  Thank you.


When the mega is connected, it's light starts blinking at ~10Hz as it did before.

Any ideas?
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 245
Posts: 16516
Available for Design & Build services
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Go to this thread and ask Nick about supporting 1280 chips:
http://arduino.cc/forum/index.php/topic,105061.15.html
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

Global Moderator
Melbourne, Australia
Offline Offline
Shannon Member
*****
Karma: 218
Posts: 13896
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

My recent sketches all support that chip.

The ATmega640, ATmega1280, ATmega1281, ATmega2560 and ATmega2561. Amongst others.
Logged


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

As it turns out, the programmer failed because the mega started when the icsp cable was attached. This power drain made the programmer stop working. Now that I have the programmer working by supplying power to the mega as well, things look a little different..


avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9703
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: auto set sck period (because given equals null)
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: reading input file "/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega1280.hex"
avrdude: writing flash (130838 bytes):

Writing | ################################################## | 100% 72.25s

avrdude: 130838 bytes of flash written
avrdude: verifying flash memory against /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega1280.hex:
avrdude: load data flash data from input file /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega1280.hex:
avrdude: input file /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega1280.hex contains 130838 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 69.07s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0xf000
         0xff != 0x0c
avrdude: verification error; content mismatch

avrdude done.  Thank you.


So not quite there yet.. Any ideas?
Should I try uploading a different bootloader, or would this make no difference?
Logged

Global Moderator
Melbourne, Australia
Offline Offline
Shannon Member
*****
Karma: 218
Posts: 13896
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Some programmers don't handle more than 64 Kb of flash correctly.

I did a more robust one as described here:

http://www.gammon.com.au/forum/?id=11635

I have just amended it to include the bootloader for the Atmega1280 from the 1.0 release of the IDE.

Just program that sketch onto a spare Uno or similar, connect up 6 wires as described on that page (I assume the board is similar to the Mega2560) and then run the sketch, answering the question in the terminal monitor.
Logged


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

That's ironic, buying a programmer which is then superseded by the arduino ISP programming method..

Maybe a bit offtopic, but why on earth are these bootloaders so large?
optiboot for the UNO is much smaller and seems to get the job done just fine.

I'll try to reprogram it using ardiunoISP later and let you know what the results are smiley
Logged

Global Moderator
Melbourne, Australia
Offline Offline
Shannon Member
*****
Karma: 218
Posts: 13896
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
why on earth are these bootloaders so large?

For a start, they come in fixed sizes. Each one double the previous. So if it doesn't quite fit into 512 bytes, it has to be 1024. And if it takes 1025 then it needs 2048, and so on.

Second, some appear to offer extra features, like debugging (finding what is in memory, EEPROM etc.) not that I have ever used that.
Logged


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

As suggested by Nick, programming using his method worked perfectly!

I'm back to having a working mega smiley

thanks all, with special thanks going out to Nick for making the bootloading sketch!
Logged

Pages: [1]   Go Up
Print
 
Jump to: