Fail to restore firmware on Atmega16U2 of Arduino Uno Rev3

Hi,

I recently bought the Arduino starter kit and have a lot of fun with it. My goals is to make a MIDI device and saw this post how to make a MIDI usb device of the UNO: ddiakopoulos/hiduino.

So I managed to flash the Atmega16U2 with arduino_midi.hex firmware using the Arduino ISP with the following command:

avrdude.exe -p m16u2 -P usb -c arduinoisporg -U flash:w:arduino_midi.hex -U lfuse:w:0xEF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m

This works perfectly: connecting the Arduino Uno through USB shows up as a midi device!

But my issue is going back. I would like to be able to connect to the serial port again.

avrdude -p m16u2 -P usb -c arduinoisporg -v -U flash:w:Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m

avrdude: Version 6.0.1, compiled on Jan 15 2015 at 16:58:43
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "c:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf"

         Using Port                    : usb
         Using Programmer              : arduinoisporg
avrdude: usbdev_open(): Found USBtinyISP, bus:device: bus-0:\\.\libusb0-0001--0x2a03-0x0049
         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
           flash         65     6   128    0 yes     16384  128    128  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 : USBtiny
         Description     :
avrdude: programmer operation not supported

avrdude: Using SCK period of 10 usec
avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e9489
avrdude: safemode: lfuse reads as EF
avrdude: safemode: hfuse reads as D9
avrdude: safemode: efuse reads as F4
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: Using SCK period of 10 usec
avrdude: reading input file "Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex"
avrdude: input file Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex auto detected as raw binary
avrdude: writing flash (16384 bytes):

Writing | ################################################## | 100% 44.75s

avrdude: 16384 bytes of flash written
avrdude: verifying flash memory against Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex:
avrdude: load data flash data from input file Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex:
avrdude: input file Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex auto detected as raw binary
avrdude: input file Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex contains 16384 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 24.63s

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

Writing | ################################################## | 100% 0.01s

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.00s

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

Writing | ################################################## | 100% 0.00s

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.00s

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

Writing | ################################################## | 100% 0.00s

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.00s

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

Writing | ################################################## | 100% 0.01s

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.00s

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 (H:F4, E:D9, L:FF)

avrdude done.  Thank you.

As you see no errors here. But The Uno does not appear as a COM device in the device manager. (I work on Windows 10, 64 bit)

I still can write to the atmega328p and write a sketch using the ISP, like blink. I can go back to the arduino_midi firmware. But when flasing with the default firmware the COM device does not appear. Why?

I hope somebody can guide me in the right direction.

Best,

Guido

I finally managed to solve it. I initially downloaded the firmware from github. However, when installing the Arduino IDE the firmware is also installed locally. In my case under:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\firmwares\atmegaxxu2

I took Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex from there. Initially the device appeared in the Device Manager under Atmel USB Devices but after uninstalling the driver and reconnecting Arduino Uno it appeared again under Ports(COM & LPT) just where I want it.

So solved!!

Hi I'm a little confused with how you solved your issue, I noticed in your first attempt in which you used the firmware from github and the one you took from your local folders has an identical name, was anything different between them?