How to Reburn the firmware onto Atmega16u2

From Wiki
Jump to: navigation, search

Overview

When you connect the board to your computer by a USB cable, if the chipset on the board is not heated, but it doesn't appear under Device Manager and even there's no "Unknown Device" prompt, the firmware of ATmega16u2 can be missing. You need to reburn it .

Preparations

  • USBtinyISP Module (burning tool)
  • Arduino Board (use Uno here)
  • PC
  • Arduino IDE
  • USB cable

Wiring

Connect components as follows. Then connect the buring tool USBtinyISP to the computer by a USB cable. You can connect the Uno later because the UNO will take power from the USBtinyISP.
Howtoburn1.jpg Biaoge.jpg

Howtoburn2.jpg

Start burning the firmware

Step 1: Find the two files avrdude.exe and avrdude.conf

When compiling, you need to call avrdude. Find the Arduino folder under the installation directory. Search for avrdude, and then avrdude.exe and avrdude.conf can be searched out.

Howtoburn3.jpg

Step 2: Copy them to path of Arduino software

If you've in stalled it as default, it's C:\Program Files\Arduino\hardware\arduino\avr\firmwares\atmegaxxu2. But yours may not be C:\Program Files. Just use your own one.

Howtoburn5.jpg

Step 3: Type in commands

Click the Start icon and type in cmd in the search bar and click on the cmd.exe displayed to open the window for commands
Then type in the following command to go to the folder atmegaxxu2:

cd C:\Program Files\Arduino\hardware\arduino\avr\firmwares\atmegaxxu2


Howtoburn6.jpg

Step 4:burn the firmware

avrdude -p at90usb82 -F -P usb -c usbtiny -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


Howtoburn7.jpg

Note: If you're reburning the hardware for a Uno board, in the command after flash:w: you typed in UNO-dfu_and_usbserial_combined.hex; but if you're using a Mega2560, after the command you should do MEGA-dfu_and_usbserial_combined.hex. So for Mega, the whole command should be:

avrdude -p at90usb82 -F -P usb -c usbtiny -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

Or, you can find the two files in the atmegaxxu2 folder.

Howtoburn8.jpg

After a minute, you'll see "avrdude done. Thank you." which means the download is done.

Test the burning

After finishing the work, you need to check whether it's done successfully. Connect Uno to your computer via a USB cable.
Upon your plugging the wire, the computer will automatically install the driver, as shown below:

Howtoburn10.jpg

After a whiel, you can see a prompt of the serial port; here it's Arduino Uno (COM54), indicating that the computer has recognized your board.

Howtoburn11.jpg

You can also check the port in Device Manager:

Howtoburn12.jpg