Go Down

Topic: Mega2560 bricked? not detected, DFU failing (Read 7 times) previous topic - next topic

CBlair

Following http://arduino.cc/en/Tutorial/ArduinoISP didn't work. I connected pins 50 to 53 of both mega2560s together (as per http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1279287827 this recommendation) and 5V and GND together.

When I select Burn Bootloader -> w/ Arduino as ISP the output is:
Burning bootloader to i/o board...
Error while burning bootloader.
avrdude: stk500_getsync(): not in sync: resp=0x00

The RX light on the ISP arduino flashes twice right after I select Burn Bootloader -> w/ Arduino as ISP; no other lights flash. The L light on the dead mega is still lit constantly when the live mega is plugged into USB; when the power is cycled, the two megas flash their L lights identically, and then the good mega shuts off the L light, the bad mega leaves it on. Both power leds (ON) are lit.

Some similar ArduinoISP with atmega2650 posts:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1287952386 this post mentions there could be some updates to ArduinoISP sketch necessary to program a mega, due to the increased address space of a mega; its been added as a googlecode issue.
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1279287827 this person was having trouble using ArduinoISP on a mega as well... though perhaps it was a power problem.

I'd like to check the voltages on the 8u2 chip, but since it's surface-mount that seems very difficult...

Out of ideas for the moment, other than maybe getting an ISP programmer, maybe this one http://www.adafruit.com/index.php?main_page=product_info&cPath=16&products_id=46 to try with avrdude. There's a few people working on using ISP direct to the 8u2 (http://arduino.cc/forum/index.php?topic=55790.0 )

CBlair



Alright, one more thing to try. Added a header to the 8u2 ISCP port, and connected it to my ArduinoISP.

From https://github.com/arduino/Arduino/tree/master/hardware/arduino/firmwares/ readme.txt, I'm using the following line:

>avrdude -p at90usb82 -F -P usb -c avrispmkii -U flash:w:MEGA-dfu_and_usbserial_combined.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m
avrdude: AVR Part "at90usb82" not found.

Valid parts are:
  m6450 = ATMEGA6450      [C:\WinAVR-20100110\bin\avrdude.conf:11732]
.... big list

I also tried executing avrdude.exe with the same parameters from within \arduino-0022\hardware\tools\avr\bin after removing the WinAVR directories from the PATH variable, with the hope it would use the avrdude included with Arduino, and would include at90usb82... still seemed to be referencing the WinAVR installation though. Reinstalled WinAVR from sourceforge to the latest version. Now, "did not find any USB device "usb"", so that seems to have solved the "valid part" issue.

So, I changed the port to COM4,
>avrdude -p at90usb82 -F -P COM4 -c avrispmkii -U flash:w:MEGA-dfu_and_usbserial_combined.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m

avrdude: stk500_2_ReceiveMessage(): timeout

Now it just times out. Any ideas? I have to go now, will research when I get back :)

CBlair

Solved the avrdude issue, the proper call to get avrdude to work with the 8u2 (for me) is this, it wasnt working before because I had the wrong programmer selected (ArduinoISP is -c avrisp):

avrdude -p at90usb82 -F -P com4 -c avrisp -v -e -b 19200 -U flash:w:MEGA-dfu_and_usbserial_combined.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m

So that worked, output was
Code: [Select]
avrdude: Version 5.10, compiled on Jan 19 2010 at 10:45:23
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\WinAVR-20100110\bin\avrdude.conf"


         Using Port                    : com4
         Using Programmer              : avrisp
         Overriding Baud Rate          : 19200
         AVR Part                      : AT90USB82
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC6
         RESET disposition             : possible i/o
         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  Max W   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- --- -- ---------
           eeprom        65    20     4    0 no        512    4    128  9000  90 00 0x00 0x00
           flash         65     6   128    0 yes      8192  128     64  4500  4500 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0 0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0 0 0x00 0x00

         Programmer Type : STK500
         Description     : Atmel AVR ISP
         Hardware Version: 2
         Firmware Version: 1.18
         Topcard         : Unknown
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.13s
avrdude: Device signature = 0x1e9389
avrdude: Expected signature for AT90USB82 is 1E 93 82
avrdude: safemode: lfuse reads as EF
avrdude: safemode: hfuse reads as D9
avrdude: safemode: efuse reads as F4
avrdude: erasing chip
avrdude: reading input file "MEGA-dfu_and_usbserial_combined.hex"
avrdude: input file MEGA-dfu_and_usbserial_combined.hex auto detected as raw binary
avrdude: writing flash (8192 bytes):
Writing | ################################################## | 100% 9.42s
avrdude: 8192 bytes of flash written
avrdude: verifying flash memory against MEGA-dfu_and_usbserial_combined.hex:
avrdude: load data flash data from input file MEGA-dfu_and_usbserial_combined.he
x:
avrdude: input file MEGA-dfu_and_usbserial_combined.hex auto detected as raw bin
ary
avrdude: input file MEGA-dfu_and_usbserial_combined.hex contains 8192 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 9.41s

avrdude: verifying ...
avrdude: 8192 bytes of flash verified
avrdude: reading input file "0xFF"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.11s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xFF:
avrdude: load data lfuse data from input file 0xFF:
avrdude: input file 0xFF contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.03s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude: reading input file "0xD9"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.03s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xD9:
avrdude: load data hfuse data from input file 0xD9:
avrdude: input file 0xD9 contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.05s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xF4"
avrdude: writing efuse (1 bytes):

Writing | ################################################## | 100% 0.03s

avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xF4:
avrdude: load data efuse data from input file 0xF4:
avrdude: input file 0xF4 contains 1 bytes
avrdude: reading on-chip efuse data:

Reading | ################################################## | 100% 0.03s

avrdude: verifying ...
avrdude: 1 bytes of efuse verified
avrdude: reading input file "0x0F"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.13s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x0F:
avrdude: load data lock data from input file 0x0F:
avrdude: input file 0x0F contains 1 bytes
avrdude: reading on-chip lock data:
Reading | ################################################## | 100% 0.03s
avrdude: verifying ...
avrdude: 1 bytes of lock verified
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as D9
avrdude: safemode: efuse reads as F4
avrdude: safemode: Fuses OK


I unplugged the USB from the ArduinoISP mega, unplugged the wires, and tried plugging in the bricked mega. Still wasn't detected though... more in next post :)

CBlair

So then I tried to flash the atmega2560 firmware with the Arduino IDE, connecting to the other ICSP connector with my ArduinoISP; selecting "Burn Bootloader -> w/ Arduino as ISP gives "avrdude: stk500_getsync(): not in sync: resp=0x00". Selecting w/ AVR ISP gives "avrdude: stk500_getsync(): not in sync: resp=0x00 ; avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51"

So I switched back to using avrdude, same wiring; this was the result:

Code: [Select]

> avrdude -p m2560 -P com4 -c avrisp -b 19200 -v -e -U flash:w:Arduino-usbserial-mega.hex -U lock:w:0xCF:m
avrdude: Version 5.10, compiled on Jan 19 2010 at 10:45:23
        Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
        Copyright (c) 2007-2009 Joerg Wunsch
        System wide configuration file is "C:\WinAVR-20100110\bin\avrdude.conf"
        Using Port                    : com4
        Using Programmer              : avrisp
        Overriding Baud Rate          : 19200
        AVR Part                      : ATMEGA2560
        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  Max W   ReadBack
          ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- --- -- ---------
          eeprom        65    10     8    0 no       4096    8      0  9000  90 00 0x00 0x00
          flash         65    10   256    0 yes    262144  256   1024  4500  45 00 0x00 0x00
          lfuse          0     0     0    0 no          1    0      0  9000  90 00 0x00 0x00
          hfuse          0     0     0    0 no          1    0      0  9000  90 00 0x00 0x00
          efuse          0     0     0    0 no          1    0      0  9000  90 00 0x00 0x00
          lock           0     0     0    0 no          1    0      0  9000  90 00 0x00 0x00
          calibration    0     0     0    0 no          1    0      0     0    0    0x00 0x00
          signature      0     0     0    0 no          3    0      0     00       0x00 0x00
        Programmer Type : STK500
        Description     : Atmel AVR ISP
        Hardware Version: 2
        Firmware Version: 1.18
        Topcard         : Unknown
        Vtarget         : 0.0 V
        Varef           : 0.0 V
        Oscillator      : Off
        SCK period      : 0.1 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.13s
avrdude: Device signature = 0x1e9801
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as D0
avrdude: safemode: efuse reads as FD
avrdude: current erase-rewrite cycle count is 1191250039 (if being tracked)
avrdude: erasing chip
avrdude: reading input file "Arduino-usbserial-mega.hex"
avrdude: input file Arduino-usbserial-mega.hex auto detected as raw binary
avrdude: writing flash (65096 bytes):
Writing | ################################################## | 100% 63.13s
avrdude: 65096 bytes of flash written
avrdude: verifying flash memory against Arduino-usbserial-mega.hex:
avrdude: load data flash data from input file Arduino-usbserial-mega.hex:
avrdude: input file Arduino-usbserial-mega.hex auto detected as raw binary
avrdude: input file Arduino-usbserial-mega.hex contains 65096 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 55.05s
avrdude: verifying ...
avrdude: 65096 bytes of flash verified
avrdude: reading input file "0xCF"
avrdude: writing lock (1 bytes):
Writing |                                                    | 0% 0.00s ***failed;
Writing | ################################################## | 100% 0.36s
avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0xCF:
avrdude: load data lock data from input file 0xCF:
avrdude: input file 0xCF contains 1 bytes
avrdude: reading on-chip lock data:
Reading | ################################################## | 100% 0.03s
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
        0xcf != 0x0f
avrdude: verification error; content mismatch
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as D0
avrdude: safemode: efuse reads as FD
avrdude: safemode: Fuses OK


This seems to have had an error in writing, right from the start of the code. I tried again, on the same PC, same result. I'm not sure if I should be writing fuse values as well, http://arduino.cc/forum/index.php/topic,52544.0.html this person seems to not have, and they also seem to have had an issue with the same verification error; I'll have to try a different PC I suppose.

Now when I plug in my bricked mega, it is still not detected, and the L (pin 13) light no longer turns on at all. I assume that was the bootloader that turned it on? So it seems my mega is more lifeless than before now that I've uploaded garbled code :). Also, it's still not detected in DFU mode. I'll probably get a programmer and try again with that sometime later, since there was a possible issue with using ArduinoISP to program atmega2560's.

I am a bit confused that I can upload successfully to the 8u2 (indicating that it's alive), but the board isn't detected. It almost seems like there's a broken trace to the actual USB connector.

I hope this speil helps people who's arduino's arent as broken as mine and just need new firmware :) I'll probably write up a more concise version later with a troubleshooting section for how to upload via ICSP to the 8u2 and the atmega2560.

CBlair

#9
Apr 16, 2011, 01:38 am Last Edit: Apr 16, 2011, 09:35 am by CBlair Reason: 1
Just a note that the verification error shows up for both Blink and the bootloader uploads:

> avrdude -p m2560 -P com4 -c avrisp -b 19200 -v -e -U flash:w:Blink.cpp.hex -U lock:w:0xCF:m
  avrdude: Verification error.

> avrdude -p m2560 -P com4 -c avrisp -b 19200 -v -e -U flash:w:stk500boot_v2_mega2560.hex -U lock:w:0xCF:m
  avrdude: verification error.

Cheers!

Edit: Just noticed that pin13 LED is flashing when the board is powered, since loading the bootloader.. So it's possible that I can use the chip via ICSP programmer, without the USB working. Will look into this further, since it didnt seem to flash with just the Blink sketch uploaded.

Go Up