Go Down

Topic: How to reload the 16u2 firmware on a mega2560 (Read 2991 times) previous topic - next topic


The following instructions can be used to restore the 16u2 firmware on an arduino mega2560, rev 3. Using a Macintosh/osX (Lion), with the Arduino IDE 1.0.0 installed in the applications folder.

1) Plugin a usb cable to the arduino mega rev3 in order to supply it with power.

2) Plugin an avrispmkII programmer into the 6 pin icsp1 jack located adjacent to the usb connector (observe pin1 orientation via the dot on the board). I had to use an 'extender' for the icsp1 connector as the avrispmkii connector wouldn't fit due to proximity to one of the edge-connectors on the arduino.

3) Open a terminal window, paste in the following command and execute it:

/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -p m16u2 -F -P usb -c avrispmkii -U flash:w:/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/firmwares/Arduino-COMBINED-dfu-usbserial-atmega16u2-Mega2560-Rev3.hex  -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m

4) Unplug both the programmer and the usb cable, then plug the usb cable in and the mac (and the pc) should recognize the usb port.


c0d3Man

Would I be able to use a parallel programmer to do this? I don't have the programmer you used, nor can I afford to buy one.

Probably....best I can do...Give it a shot and tell us what happens!

c0d3Man

would I be able to use flip? or do I need to use avrdude?

c0d3Man

#4
Jul 14, 2012, 03:49 am Last Edit: Jul 14, 2012, 04:12 am by c0d3Man Reason: 1
Well I finally got my parallel programmer built, and I used the following command to try and flash my 16u2

Code: [Select]

C:\arduino\arduino-1.0.1\hardware\tools\avr\bin>avrdude -C ../etc/avrdude.conf -
p m16u2 -F -c dapa -U flash:w:../../../arduino/firmwares/Arduino-COMBINED-dfu-us
bserial-atmega16u2-Mega2560-Rev3.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efus
e:w:0xF4:m -U lock:w:0x0F:m -v


but I get this...

Code: [Select]
C:\arduino\arduino-1.0.1\hardware\tools\avr\bin>avrdude -C ../etc/avrdude.conf -
p m16u2 -F -c dapa -U flash:w:../../../arduino/firmwares/Arduino-COMBINED-dfu-us
bserial-atmega16u2-Mega2560-Rev3.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efus
e:w:0xF4:m -U lock:w:0x0F:m -v

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

         System wide configuration file is "../etc/avrdude.conf"

         Using Port                    : lpt1
         Using Programmer              : dapa
         AVR Part                      : ATmega16U2
         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     16384  128    128  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     0
0 0x00 0x00

         Programmer Type : PPI
         Description     : Direct AVR Parallel Access cable
           VCC     = 3
           BUFF    =  (not used)
           RESET   = 16
           SCK     = 1
           MOSI    = 2
           MISO    = 11
           ERR LED = 0
           RDY LED = 0
           PGM LED = 0
           VFY LED = 0

avrdude: AVR device not responding
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
avrdude: Expected signature for ATmega16U2 is 1E 94 89
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed

         To disable this feature, specify the -D option.

avrdude done.  Thank you.


C:\arduino\arduino-1.0.1\hardware\tools\avr\bin>


Anyone got any ideas on whats going wrong?

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy