Programming the Arduino UNO USB chip bootloader

Hi all,

I was able to successfully erase and reprogram the Arduino 328P bootloader using instructions on this webpage: Burning the Bootloader to an Arduino Uno using Atmel Studio and the AVRISP mkII

Now I would like to program the USB chip in a similar way. First, is this possible? And second, do I have to be concerned about the fuse settings like for the regular bootloader?

Thanks.
Tony

Hello there!

It is possible to flash/erase/program/etc the small USB chip. You have to download a free application called Atmel FLIP to do so. Once ready, perform the following actions. I'm doing this from memory so please bear with me.

  1. Plug UNO into computer
  2. Quickly touch the USB chip's ICSP reset and ground pins together
  3. Go to device manager
  4. Find any unknown devices
  5. Right-click on the device and select "Update driver software"
  6. Select "browse" in the new window
  7. Navigate to where you installed FLIP (mine is Program Files (86)/Atmel/Flip 3.4.7/usb)
  8. Make sure to select the folder, dont go into the folder
  9. Install the drivers
  10. The device should appear as "Atmega16u2" in something called "linusb-win32" or something
  11. Go back to FLIP
  12. Click on the chip icon on the top left and select ATmega16u2 from the menu
  13. Go to the USB cable option and select USB
  14. Click "open port" in the small popup window
  15. Go to File->load HEX and load the UNO hex file with the shorter title from the C:\Program Files (x86)\Arduino\hardware\arduino\avr\firmwares\atmegaxxu2 directory (your directory may differ)
  16. On the left of the main FLIP application, make sure the boxes for erase, program, and verify are checked
  17. Click run underneath the checkboxes

And you should be done. Unplug the UNO and back in and see if it registers as a COM port in device manager and in the Tools->Port menu of the IDE.

Let me know of any questions or if I made a mistake somewhere

bos1714,

Thank you for the detailed response. I will try it.

I'm thinking, however, that there must be a process to program the USB chip that has fewer steps, since Arduinos are made by the thousands and have to be programmed before shipping.

Atmel Studio has a simple way to program a .hex file into a device, and it also allows setting the proper fuse values. I used this method for the 328P, and it worked the first time. I erased the 328P flash, verified that it no longer worked, then re-programmed it, and it worked like a charm.

I will pursue this further, and post a procedure if I figure it out.

Again, thanks for your solution.

Tony

You can program the 32u4 using the “nearby” ISP header, assuming that it is populated, or that you can add the pins.
Any ISP programmer will work, including the “Arduino as ISP” sketch.
Arduino-32u4-ISP.jpg
Bos1714’s method should work if you don’t have a programmer of any kind.

Arduinos are made by the thousands and have to be programmed before shipping.

Arduino probably buys the chips pre-programmed.
But note that most of the other method steps are “install software and drivers.” Once you’ve done that, it’d be pretty much

  • reset the 32u4 into download mode via a jumper.
  • upload new firmware using the flip utility.

westfw,

Thank you for your reply. I have an ATMEL ICE programmer with the appropriate 6 pin connector. I already used it to erase the 328P bootloader, and then reload it. It worked fine.

For the USB chip, I would like to do the same, and as you have stated, this appears to be doable. But I had to set fuses to certain values when I programmed the 328P. Do you know if fuses need to be set when programming the USB chip?

Thanks again for your help.

Tony

Search for "Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex" on your computer.

Mine is at ~/ken/Downloads/arduino-1.8.5/hardware/arduino/avr/firmwares/atmegaxxu2.

Check out the README.txt at /atmegaxxu2.

I used this command from the README.txt with a few modifications, -patmega16u2 -cusbasp.

avrdude -p atmega16u2 -P usb -c usbasp -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

kprims,
Sorry for the delay in responding, but I got sidetracked with other stuff.

This is exactly what I was looking for. I will give it a try. Thank you.

Tony