16u2 firmware hex file in IDE install seams faulty

Why is the "Arduino-COMBINED-dfu-usbserial-atmega16u2-Mega2560-Rev3.hex" in the Arduino install faulty?

I grab that file from - Program Files(86)/Arduino/hardware/arduino/avr/firmwares/atmegaxxu2 -, and in FLIP is shows as 1 util bytes.

I flash the 16u2 and it seams to load, but on reset there is no COM port in DevMang. It stays on 16u2 driver in DM.
I flash "MEGA-dfu_and_usbserial_combined.hex" and the COM works
I flash the non combined "Arduino-usbserial-atmega16u2-Mega2560-Rev3.hex and the COM works.

I tried another source for the hex and it's the same. I look for more downloads and they are all about as old, making it look like they are just copies of the original faulty one.

I just tried this twice with avrdude and it worked with no problems. IDE 1.8.7

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

Notice I burned the fuses. Then loaded a simple blink sketch.

It doesn't work in FLIP3.4.7, the recommended method, using USB. I've tried about 6 times.

https://www.arduino.cc/en/Hacking/DFUProgramming8U2

The others work fine in FLIP.

Arduino doesn't seam to have a avrdude guide for that, so I haven't heard of it.

Looks like more searching for a avrdude guide to flash a 16u2.

Arduino doesn't seam to have a avrdude guide for that, so I haven't heard of it.

Check out the README at:

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

To burn (Uno):
avrdude -p at90usb82 -F -P usb -c avrispmkii -U flash:w:UNO-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

To burn (Mega 2560):
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

Change -patmega16u2 and -c to your programmer plus the combined Hex for your Arduino, Mega or Uno.

I read that quite a few time already, but because I don't know what an avrdude is it didn't mean much to me. I also assumed it was out of date because it only mentions 8u2, and if you read the Terminal entry line it doesn't point to the file that I'm talking about - it probably didn't exist when that was written -.

Doing some reading and it looks like Arduino got rid of avrdude, which is understandable because it way too hard for a beginner to understand.

More digging and I found you have to install WinAVR, but when I got to the Terminal none of the words in the flags mean anything to me so I don't know what they do or which ones I should use.

More reading and I only find old 2013 posts, but again no explanations of what the flags do just lines of text to enter in the Terminal.

Not knowing anything I pasted one in, but it doesn't understand it.

More reading and there is no comprehensive guide of flashing a 16u2 with avrdude from start to finish, so even if one of those lines of text sticks I don't know how the thing is physically connected to the PC in that example.

I found a GUI for avrdude, but the settings are abbreviated, so I don't know what they stand for, nor what they do.

As a beginner I don't have a chance with avrdude unless there is specific instructions from start to finish.

Latter on in the README it says FLIP compatibility anyway, and it just seams like that .hex is not compatible with that version of FLIP and needs to be fixed.

You can see in my video how easy FLIP is, so why not fix it so that file works.

Try FLIP and see if you get that 1 util byte, because that signifies a bug even before you flash the 16u2.

Doing some reading and it looks like Arduino got rid of avrdude, which is understandable because it way too hard for a beginner to understand

Well, every time I load a sketch using the Arduino IDE It seems to me, we are using avrdude. :slight_smile:

Try FLIP and see if you get that 1 util byte, because that signifies a bug even before you flash the 16u2.

I get "Address is out of range".

Just my thoughts on this and I have only been on Window's for 2 days. I broke down and added Win 10 to my Linux box.

I think in order for FLIP to work, you already have to have a DFU program burned to the 16u2 chip.

I think Flip will work just fine if you go into the:
"C:\Program Files (x86)\Arduino\hardware\arduino\avr\firmwares\atmegaxxu2\arduino-usbserial" directory and select the Arduino-usbserial Hex file for your Mega or whatever you are using.

This worked for me using a UNO Rev3

Since I used Flip for the first time today, I think I will drop out of this thread and let someone who knows more about this help you. Good Luck.

I think the combined binary can only be written with an external programmer. Flip is a bootloader, and it can’t overwrite itself, afaik.

Well, every time I load a sketch using the Arduino IDE It seems to me, we are using avrdude. :slight_smile:

I read about traces in posts back in 2013 - 1.5-ish - , and there is even a guide on it, but my install of IDE doesn't have it. I've only been on IDE for about a year so maybe previously installed old versions don't delete it when you update. First time in Terminal it reports that it doesn't exist. File search in Win Explorer says no file. More reading and I have to install WinAVR. Now I have avrdude. I can't do much with it because there is no detailed guide and I don't know what to do.

I get "Address is out of range".

I get "Address is out of range". with atmegaxxu2/Genuino-COMBINED-dfu-usbserial-atmega16u2-Mega2560-R3.hex but it takes the faulty Arduino-COMBINED-dfu-usbserial-atmega16u2-Mega2560-Rev3.hex

I don't know about the DFU because the faulty one and MEGA-dfu_and_usbserial_combined.hex load

The hex files are not faulty.

The COMBINED files contain the DFU bootloader.
FLIP uses the DFU bootloader for uploading.
You cannot use the bootloader to update the bootloader, you need an ISP for that.
In other words, you cannot use FLIP to update the bootloader or to upload the combined 16u2 hex files.

The older combined hex file works because it for the 8u2 and the data addresses are not in the 16u2 bootloader region.

And by the way, avrdude is definitely still there:

> unzip -l arduino-1.8.7-windows.zip '*avrdude*'
Archive:  arduino-1.8.7-windows.zip
  Length     Date   Time    Name
 --------    ----   ----    ----
   463478  10-16-17 13:20   arduino-1.8.7/hardware/arduino/avr/bootloaders/gemma/avrdude.conf
   562176  04-17-18 10:34   arduino-1.8.7/hardware/tools/avr/bin/avrdude.exe
   506846  04-17-18 10:34   arduino-1.8.7/hardware/tools/avr/etc/avrdude.conf
 --------                   -------
  1532500                   3 files

It's all a bit disappointing, because the Arduino instructions says you use FLIP to load a bootloader when you can't load a DFU bootloader on a chip with a DFU bootloader.

https://www.arduino.cc/en/Hacking/DFUProgramming8U2

Still is a bit weird that loading that file into FLIP, without even connecting the MEGA, reports that file as only 1 util byte when other files report 1000s of bytes.

Now that you point out the path I see avrdude. Evidently when I searched Explorer I had a typo, so it found nothing. Doh.

I found some avrdude instructions, but it was so old all the paths are wrong so I couldn't work it out.

https://www.arduino.cc/en/Hacking/Upgrading16U2Due

Now that I know the path I might be able to work it out, but if like you said I already have DFU there is not much point in loading the Combined.

I don't know it all just seams a bit disappointing for a beginner that doesn't know anything or have any previous experience to have out-of-date instructions, because they don't know any principles and can only do the old monkey see monkey do.

As a beginner, why do you think you need to reload the 16u2 firmware?
The things on the “hacking” page would generally not be thing expected of a beginner…

It was just a guess that the combined DFU and Serial, that won't load, might make a difference to my failed MEGA.

It was kind-of a "clutching at straws" thing for what I have come to the conclusion is a blown RX on the 2560 chip on my MEGA board. The guy on the other post didn't confirm it, but that was my conclusion based on the test he told me to do. Basically my OCD won't let me leave it until it's perfect.

FLIP is not hard for a beginner, in fact it's easy when you know how, it's just avrdude is very hard in method and understanding, ie flags, for a beginner.

Yes, avrdude is not for the faint of heart. It's one of those do-it-all programs with a billion options all tied to single-character switch names that may or not make sense...

For windows, you could try AVRDudess instead - still billions of options, but now they're all on a GUI panel. I haven't actually tried it, and I'm not sure that it's easy to set up with the Arduino version of AVRdude, but ... might be worth a try.

(and yeah, trying to "repair" a broken Arduino isn't really a beginner activity either. Though I'll admit that trying is a good thing. Repairing things seems to be a lost art :frowning: ) (you can think of it as a sort of historical glimpse of what things were like in the pre-arduino days!)

No luck with AVRDudess - do people still use .bat files :astonished: - because it doesn't seam to install.

I've got AvrDude GUI working, but again I don't understand what things do. Like do I FLASH or EEPROM, and that's not to mention all the settings like fuses, lock bits, etc.

Mech stuff I have no problems with because I'm a Mech Eng, so swapping out a SMD for the first time wasn't that much of a problem.

I've got a spare 2560 chip from another defunked project that I can swap in to test if the RX of the old chip is actually blown, but that might be a bit of a risk to run an actual car on.