How to Reburn the firmware onto Atmega16u2

From Wiki
Revision as of 03:19, 27 June 2016 by Root (Talk | contribs) (Preparations)

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.



USBtinyISP Module Uno MOSI MOSI MISO MISO RST RST SCK SCK VCC VCC GND GND

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.


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.

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

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


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.

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:

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.

You can also check the port in Device Manager: