Reflash Arduino UNO ATMEGA16U2

In case you've bricked the UNO bootloader or even the USB bootloader in the ATMEGA16U2, this may help ...

 

Flash ATMEGA16U2 on UNO-clone board

C:\Users\dietmar\GitHub\Arduino\hardware\arduino\avr\firmwares\atmegaxxu2\arduino-usbserial
"C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avrdude"
-C "C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf"
-p m16u2 -F -P usb -c avrispmkii
-U flash:w:Arduino-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

Flash Bootloader to UNO-clone board

C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude 
-CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf
-v -patmega328p -cstk500v2 -Pusb -e
-Ulock:w:0x3F:m -Uefuse:w:0x05:m -Uhfuse:w:0xDE:m -Ulfuse:w:0xFF:m

C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude
-CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf
-v -patmega328p -cstk500v2 -Pusb
-Uflash:w:C:\Program Files (x86)\Arduino\hardware\arduino\avr/bootloaders/optiboot/optiboot_atmega328.hex:i
-Ulock:w:0x0F:m