USBTinyISP & AVRDude - -F'ed up my MEGA?

Hi,

I’m posting with a question I think I know the answer to, but I’m at my wits end here. I built a board based off the MEGA 2560, and I was programming the bootloaders. I know the USBTinyISP doesn’t officially support the 2560, but I flashed the bootloader and was able to get it to work (and flash the LED).

I couldn’t get the ATmega16U2 to reflash (maybe a soldering error - kind of moot right now), but I gave it a valiant effort. I got the .hex file set up, tinkered with avrdude, and tried to get it to download. Here’s where it gets good…

I unplugged the ISP header and plugged it back in. Finally, I get a device signature, but it’s not valid. I figured that I might have to resolder the 16U2 if it goes wrong, but I had a spare handy. I did what I now know not to do, and -F’ed it in the command line, only after programming realizing that I had plugged it into the wrong header. Now, I can’t get any signature - and obviously can’t upload any software.

Is there anything I can do, short of replacing the micro? I didn’t know that the write command would necessarily change the fuses, and the file wasn’t present… so I think it just erased it.

Here’s my log:

avrdude -c usbtiny -p m16u2 -U flash:w:megahex.hex -P usb -vvvv -F

avrdude: Version 5.8cvs, compiled on Jan 15 2010 at 17:27:01
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : usb
         Using Programmer              : usbtiny
         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  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no        512    4    128  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash         65     6   128    0 yes     16384  128    128  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 : USBtiny
         Description     : USBtiny simple USB programmer
avrdude: programmer operation not supported

avrdude: Using SCK period of 10 usec
CMD: [ac 53 00 00] [00 00 53 00]
avrdude: AVR device initialized and ready to accept instructions

Reading |                                                    | 0% 0.00sCMD: [30 00 00 00] [00 30 00 1e]
CMD: [30 00 01 00] [00 30 00 98]
Reading | #################                                  | 33% 0.00sCMD: [30 00 02 00] [00 30 00 01]
Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9801
avrdude: Expected signature for ATmega16U2 is 1E 94 89
CMD: [50 00 00 00] [00 50 00 ff]
avrdude: safemode read 1, lfuse value: ff
CMD: [50 00 00 00] [00 50 00 ff]
avrdude: safemode read 2, lfuse value: ff
CMD: [50 00 00 00] [00 50 00 ff]
avrdude: safemode read 3, lfuse value: ff
avrdude: safemode: lfuse reads as FF
CMD: [58 08 00 00] [00 58 08 d8]
avrdude: safemode read 1, hfuse value: d8
CMD: [58 08 00 00] [00 58 08 d8]
avrdude: safemode read 2, hfuse value: d8
CMD: [58 08 00 00] [00 58 08 d8]
avrdude: safemode read 3, hfuse value: d8
avrdude: safemode: hfuse reads as D8
CMD: [50 08 00 00] [00 50 08 fd]
avrdude: safemode read 1, efuse value: fd
CMD: [50 08 00 00] [00 50 08 fd]
avrdude: safemode read 2, efuse value: fd
CMD: [50 08 00 00] [00 50 08 fd]
avrdude: safemode read 3, efuse value: fd
avrdude: safemode: efuse reads as FD
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
CMD: [a0 01 fc 00] [00 a0 01 ff]
CMD: [a0 01 fd 00] [00 a0 01 ff]
CMD: [a0 01 fe 00] [00 a0 01 ff]
CMD: [a0 01 ff 00] [00 a0 01 ff]
avrdude: erasing chip
CMD: [ac 80 00 00] [00 ac 80 00]
avrdude: Using SCK period of 10 usec
CMD: [ac 53 00 00] [00 ac 53 00]
avrdude: reading input file "megahex.hex"
avrdude: error opening megahex.hex: No such file or directory
avrdude: input file megahex.hex auto detected as invalid format
avrdude: can't open input file megahex.hex: No such file or directory
avrdude: write to file 'megahex.hex' failed

CMD: [50 00 00 00] [00 50 00 ff]
avrdude: safemode read 1, lfuse value: ff
CMD: [50 00 00 00] [00 50 00 ff]
avrdude: safemode read 2, lfuse value: ff
CMD: [50 00 00 00] [00 50 00 ff]
avrdude: safemode read 3, lfuse value: ff
avrdude: safemode: lfuse reads as FF
CMD: [58 08 00 00] [00 58 08 d8]
avrdude: safemode read 1, hfuse value: d8
CMD: [58 08 00 00] [00 58 08 d8]
avrdude: safemode read 2, hfuse value: d8
CMD: [58 08 00 00] [00 58 08 d8]
avrdude: safemode read 3, hfuse value: d8
avrdude: safemode: hfuse reads as D8
CMD: [50 08 00 00] [00 50 08 fd]
avrdude: safemode read 1, efuse value: fd
CMD: [50 08 00 00] [00 50 08 fd]
avrdude: safemode read 2, efuse value: fd
CMD: [50 08 00 00] [00 50 08 fd]
avrdude: safemode read 3, efuse value: fd
avrdude: safemode: efuse reads as FD
avrdude: safemode: Fuses OK

avrdude done.  Thank you.

Thanks for any help, even if it is just to tell me that I’ve taken one for the team.

EDIT: Making progress slowly but surely. Removing the SD card I had in that shared MISO/MOSI helped. D’oh!

Did you get your arduino board to work? I am having the exact same problems.