Updating 16u2 USB firmware

cmaglie:
It seems a bug in the firmware of the 16u2 that does USB-2-serial conversion.

Bugfix for garbage data coming from serial port after reset. (Arduino Due) by cmaglie · Pull Request #1267 · arduino/Arduino · GitHub

Can you check if the updated firmware above solves the issues?

I'm new to Github (just created an account) as well as updating firmware, never done it so far so would like testing this new firmware.

Could someone provide detailed steps so i can I update this firmware from my Macintosh and/or my spare arduino MEGA interfaced with arduino DUE ?

Thank you in advance, Albert

I've been able to finally install Macports and DFU-programmer on my old iMac G5 running under Tiger following these instructions http://arduino.cc/en/Hacking/DFUProgramming8U2

Now it seems that atmega16u2 does not appear on the list, can someone tell me what is exactly arduino DUE device port name so I can proceed on upgrading the USB firmware

Here are extract of my Terminal shell showing where i'm stuck, Thanks

new-host:~ selfonlypath$ sudo dfu-programmer at90usb82 erase
dfu-programmer: no device present.
new-host:~ selfonlypath$ sudo dfu-programmer atmega16u2 erase
dfu-programmer 0.5.4
Usage: dfu-programmer target command [command-options] [global-options] [file|data]
targets:
       at89c51snd1c
       at89c51snd2c
       at89c5130
       at89c5131
       at89c5132
       at90usb1287
       at90usb1286
       at90usb1287-4k
       at90usb1286-4k
       at90usb647
       at90usb646
       at90usb162
       at90usb82
       atmega32u6
       atmega32u4
       atmega32u2
       atmega16u4
       atmega8u2
       at32uc3a0128
       at32uc3a1128
       at32uc3a0256
       at32uc3a1256
       at32uc3a0512
       at32uc3a1512
       at32uc3a0512es
       at32uc3a1512es
       at32uc3a364
       at32uc3a364s
       at32uc3a3128
       at32uc3a3128s
       at32uc3a3256
       at32uc3a3256s
       at32uc3b064
       at32uc3b164
       at32uc3b0128
       at32uc3b1128
       at32uc3b0256
       at32uc3b1256
       at32uc3b0256es
       at32uc3b1256es
       at32uc3b0512
       at32uc3b1512
       at32uc3c064
       at32uc3c0128
       at32uc3c0256
       at32uc3c0512
       at32uc3c164
       at32uc3c1128
       at32uc3c1256
       at32uc3c1512
       at32uc3c264
       at32uc3c2128
       at32uc3c2256
       at32uc3c2512
global-options: --quiet, --debug level
commands:
       configure {BSB|SBV|SSB|EB|HSB} [--suppress-validation] [global-options] data
       dump [global-options]
       dump-eeprom [global-options]
       dump-user [global-options]
       erase [--suppress-validation] [global-options]
       flash [--suppress-validation] [--suppress-bootloader-mem] [global-options] {file|STDIN}
       flash-eeprom [--suppress-validation] [global-options] {file|STDIN}
       flash-user [--suppress-validation] [global-options] {file|STDIN}
       get {bootloader-version|ID1|ID2|BSB|SBV|SSB|EB|
           manufacturer|family|product-name|
           product-revision|HSB} [global-options]
       getfuse {LOCK|EPFL|BOOTPROT|BODLEVEL|BODHYST|
               BODEN|ISP_BOD_EN|ISP_IO_COND_EN|
               ISP_FORCE} [global-options]
       setfuse {LOCK|EPFL|BOOTPROT|BODLEVEL|BODHYST|
               BODEN|ISP_BOD_EN|ISP_IO_COND_EN|
               ISP_FORCE} [global-options] data
       reset [global-options]
       start [global-options]
       version [global-options]
new-host:~ selfonlypath$ sudo dfu-programmer atmega16u4 erase
dfu-programmer: no device present.
new-host:~ selfonlypath$ sudo dfu-programmer atmega16u4 flash Arduino-DUE-usbserial-prod-firmware-2013-02-05.hex
dfu-programmer: no device present.
Arduino-DUE-usbserial-prod-firmware-2013-02-05.hex
MacPorts-2.1.3.pkg
new-host:~/desktop selfonlypath$ sudo dfu-programmer atmega16u4 flash Arduino-DUE-usbserial-prod-firmware-2013-02-05.hex
dfu-programmer: no device present.
new-host:~/desktop selfonlypath$ sudo dfu-programmer atmega16u2 erasedfu-programmer 0.5.4
Usage: dfu-programmer target command [command-options] [global-options] [file|data]
targets:
       at89c51snd1c
       at89c51snd2c
       at89c5130
       at89c5131
       at89c5132
       at90usb1287
       at90usb1286
       at90usb1287-4k
       at90usb1286-4k
       at90usb647
       at90usb646
       at90usb162
       at90usb82
       atmega32u6
       atmega32u4
       atmega32u2
       atmega16u4
       atmega8u2
       at32uc3a0128
       at32uc3a1128
       at32uc3a0256
       at32uc3a1256
       at32uc3a0512
       at32uc3a1512
       at32uc3a0512es
       at32uc3a1512es
       at32uc3a364
       at32uc3a364s
       at32uc3a3128
       at32uc3a3128s
       at32uc3a3256
       at32uc3a3256s
       at32uc3b064
       at32uc3b164
       at32uc3b0128
       at32uc3b1128
       at32uc3b0256
       at32uc3b1256
       at32uc3b0256es
       at32uc3b1256es
       at32uc3b0512
       at32uc3b1512
       at32uc3c064
       at32uc3c0128
       at32uc3c0256
       at32uc3c0512
       at32uc3c164
       at32uc3c1128
       at32uc3c1256
       at32uc3c1512
       at32uc3c264
       at32uc3c2128
       at32uc3c2256
       at32uc3c2512
global-options: --quiet, --debug level
commands:
       configure {BSB|SBV|SSB|EB|HSB} [--suppress-validation] [global-options] data
       dump [global-options]
       dump-eeprom [global-options]
       dump-user [global-options]
       erase [--suppress-validation] [global-options]
       flash [--suppress-validation] [--suppress-bootloader-mem] [global-options] {file|STDIN}
       flash-eeprom [--suppress-validation] [global-options] {file|STDIN}
       flash-user [--suppress-validation] [global-options] {file|STDIN}
       get {bootloader-version|ID1|ID2|BSB|SBV|SSB|EB|
           manufacturer|family|product-name|
           product-revision|HSB} [global-options]
       getfuse {LOCK|EPFL|BOOTPROT|BODLEVEL|BODHYST|
               BODEN|ISP_BOD_EN|ISP_IO_COND_EN|
               ISP_FORCE} [global-options]
       setfuse {LOCK|EPFL|BOOTPROT|BODLEVEL|BODHYST|
               BODEN|ISP_BOD_EN|ISP_IO_COND_EN|
               ISP_FORCE} [global-options] data
       reset [global-options]
       start [global-options]
       version [global-options]
new-host:~/desktop selfonlypath$

Well i've just installed the latest Xcode 4.6 running on Mac OS Lion so have now the latest DFU-programmer from macports The MacPorts Project -- Download & Installation but see below my terminal Shell results, it does NOT know atmega16u8

Maybe it is available on PC but right now, if really the DUE has the atmega16u2, can't erase it neither flash new firmware on the USB chip from a Macintosh.

It would nice someone provides the port device name handling the USB on arduino DUE, confirm it is atmega16u2 !

Thank, Albert

new-host:~ selfonlypath$ sudo dfu-programmer atmega16u2 erase
dfu-programmer 0.5.4
Usage: dfu-programmer target command [command-options] [global-options] [file|data]
targets:
        at89c51snd1c
        at89c51snd2c
        at89c5130
        at89c5131
        at89c5132
        at90usb1287
        at90usb1286
        at90usb1287-4k
        at90usb1286-4k
        at90usb647
        at90usb646
        at90usb162
        at90usb82
        atmega32u6
        atmega32u4
        atmega32u2
        atmega16u4
        atmega8u2
        at32uc3a0128
        at32uc3a1128
        at32uc3a0256
        at32uc3a1256
        at32uc3a0512
        at32uc3a1512
        at32uc3a0512es
        at32uc3a1512es
        at32uc3a364
        at32uc3a364s
        at32uc3a3128
        at32uc3a3128s
        at32uc3a3256
        at32uc3a3256s
        at32uc3b064
        at32uc3b164
        at32uc3b0128
        at32uc3b1128
        at32uc3b0256
        at32uc3b1256
        at32uc3b0256es
        at32uc3b1256es
        at32uc3b0512
        at32uc3b1512
        at32uc3c064
        at32uc3c0128
        at32uc3c0256
        at32uc3c0512
        at32uc3c164
        at32uc3c1128
        at32uc3c1256
        at32uc3c1512
        at32uc3c264
        at32uc3c2128
        at32uc3c2256
        at32uc3c2512
global-options: --quiet, --debug level
commands:
        configure {BSB|SBV|SSB|EB|HSB} [--suppress-validation] [global-options] data
        dump [global-options]
        dump-eeprom [global-options]
        dump-user [global-options]
        erase [--suppress-validation] [global-options]
        flash [--suppress-validation] [--suppress-bootloader-mem] [global-options] {file|STDIN}
        flash-eeprom [--suppress-validation] [global-options] {file|STDIN}
        flash-user [--suppress-validation] [global-options] {file|STDIN}
        get {bootloader-version|ID1|ID2|BSB|SBV|SSB|EB|
            manufacturer|family|product-name|
            product-revision|HSB} [global-options]
        getfuse {LOCK|EPFL|BOOTPROT|BODLEVEL|BODHYST|
                BODEN|ISP_BOD_EN|ISP_IO_COND_EN|
                ISP_FORCE} [global-options]
        setfuse {LOCK|EPFL|BOOTPROT|BODLEVEL|BODHYST|
                BODEN|ISP_BOD_EN|ISP_IO_COND_EN|
                ISP_FORCE} [global-options] data
        reset [global-options]
        start [global-options]
        version [global-options]
new-host:~ selfonlypath$

If I recall you could select an equivalent at90usb162.

hiduino:
If I recall you could select an equivalent at90usb162.

Unfortunately, just tried per your suggestion but DFU-programmer says no device present

You can upgrade only using an ISP programmer.

I used ArduinoISP on my leonardo. If your not familiar with this stuff, practice a bit with another (cheaper) board.

Then try downloading the current firmware from the due's atmega16u2, for future reference and to check whether your setup is reliable.

On the Due, pick the ISP header next to the atmega16u2!!! (One time I almost picked the other one, just by habbit, which is not 5V tolerant)

I used this cmd line on linux:

/opt/arduino-1.5.2/hardware/tools/avrdude -C /opt/arduino-1.5.2/hardware/tools/avrdude.conf -p m16u2 -b 9600 -c avrisp -P /dev/ttyACM1  -U flash:r:due-fw-ori.hex:i

I had to use avrdude from arduino, because the one on my system had no support for the m16u2.

On windows it goes like this (note the -C arduino is needed when using leonardo as isp):

C:\Users\peter\arduino-1.5.2/hardware/tools/avr/bin/avrdude -C C:\Users\peter\arduino-1.5.2/hardware/tools/avr/etc/avrdude.conf -v -v -v -v -p m16u2 -c arduino -P COM6 -b 9600 -Uflash:r:due-fw-ori.hex:i

Then burn the new firmware:
On linux:

/opt/arduino-1.5.2/hardware/tools/avrdude -C /opt/arduino-1.5.2/hardware/tools/avrdude.conf -pm16u2 -b 9600 -c avrisp -P /dev/ttyACM1  -U flash:w:Arduino-DUE-usbserial-prod-firmware-2013-02-05.hex:i

On windows:

C:\Users\peter\arduino-1.5.2/hardware/tools/avr/bin/avrdude -C C:\Users\peter\arduino-1.5.2/hardware/tools/avr/etc/avrdude.conf -v -v -v -v -p m16u2 -c arduino -P COM6 -b 9600 -Uflash:w:Arduino-DUE-usbserial-prod-firmware-2013-02-05.hex:i

I just want make sure no blue smoking or destruction of my DUE... with the issue of 5V versus 3.3V !

Please confirm that I just build a 6 wires ribbon to connect directly my MEGA's 6 pins ICSP connector to my DUE's 6 pins ICSP connector.

Via that ribbon, only +5V, GND, SCK, Slave, MOSI and MISO related to SPI protocol.

Of course, I'll power my MEGA via USB connection of my Macintosh but how about my DUE, should it be powered or just receiving energy via its ICSP ?

P.S. I've been able to download Crosspack CrossPack - A Development Environment for Atmel’s AVR Microcontrollers running OK on my Macintosh, still not clear on my side how to properly sequence different actions of MEGA ICSP sketch, learning curve here since i'm more software guy than hardware. For example, i don't understand how via ICSP sketch one can download the HEX file firmware provided by cmaglie !

selfonlypath,

due to the high request, I've asked one of my collaborator to write a step-by-step tutorial, more info coming soon.
Thanks for your patience.

Here the tutorial to upload new firmware on the ATmega16u2:

please report any issue/success by posting a comment here:

All right, working much better now with new USB firmware Bugfix for garbage data coming from serial port after reset. (Arduino Due) by cmaglie · Pull Request #1267 · arduino/Arduino · GitHub

selfonlypath:
All right, working much better now with new USB firmware Bugfix for garbage data coming from serial port after reset. (Arduino Due) by cmaglie · Pull Request #1267 · arduino/Arduino · GitHub

Yes much better voll agree, the page for upgrading the Atmel16u2 is really nice but I think I would better and nicer for beginner that there would an Name for the Programming Port Atmel in the Boardslist so that anyone can change the firmware easily from the IDE

Hello all. I am trying to do this as well and have a number of questions in regard to the tutorial posted above: http://arduino.cc/en/Hacking/Upgrading16U2Due

Here are the issues I encountered so far, I am using Windows to attempt this:

  1. It does not appear that AVRdude exists in the "tools" directory of any of the arduino releases so far. I was able to install WinAVR into a different directory.

  2. I do not know where to find the "avrdude.conf" configuration file for avrdude mentioned here. I've done a lot of searching on the forums here and the arduino site and cannot find it. Can someone please point me to where that file is located? Also, it would be helpful if there was a link to this in the tutorial.

That is as far as I made it using the tutorial. It appears that I need the avrdude.conf file to move forward. Any assistance you can offer is most appreciated.

Thanks!

Ok, I was able to find the correct path for the avrdude inside the arduino folders. I was also able to find the avrdude.conf file. And after a bit of work, I was able to create a command that avrdude would accept and seems to do something. My command looks like this:

avrdude -C avrdude.conf -c arduino -P com5 -b 19200 -p m16u2 -vvv -U flash:w:/16u2/16u2.hex:i

That works! I was able to flash the firmware to the 16u2. But, my Due still shows up as "USB device not recognized" in Windows. I guess it must be a further problem. Thanks all.

How does one determine if the OE firmware needs updating?

I ask this because my IDE ver1.5.2 "Arduino-DUE-usbserial.hex" file shows the "last modified" date as being 2/6/2013. That's one day newer than the proposed Arduino-DUE-usbserial-prod-firmware-2013-02-05.hex file. (I'm reading as Feb,6,2013 vs. Feb,5,2013)

I also know, that it is possible for neither of these versions to be actually installed (flashed) into the device from the factory. How do I tell?

Is there a trivial way to check if the 'update' is indeed required for the device in question?

User's Interface:
OS == Win7x64
Have dedicated ICSP tool == False
Have spare UNO == True (Should also be flashed?)
Have spare Mega2560 == True (Should also be flashed?)

You could download the current firmware from the 16u2 and compare it to what is in the ide.
Use ArduinoISP on the UNO as programmer. The avrdude command would look like this:

arduino-1.5.2/hardware/tool> avrdude.exe -C avrdude.conf -c arduino -P COMyour_com_port -b 19200 -p m16u2 -vvv -U flash:r:old.hex:i

'Tis old. Time to update... Done.

Thanks.

michaeluna:
Ok, I was able to find the correct path for the avrdude inside the arduino folders. I was also able to find the avrdude.conf file. And after a bit of work, I was able to create a command that avrdude would accept and seems to do something. My command looks like this:

avrdude -C avrdude.conf -c arduino -P com5 -b 19200 -p m16u2 -vvv -U flash:w:/16u2/16u2.hex:i

That works! I was able to flash the firmware to the 16u2. But, my Due still shows up as "USB device not recognized" in Windows. I guess it must be a further problem. Thanks all.

(from a newbie) So, if a person wanted to develop a project using the Due development board, then incorporate the Atmel SAM3x cpu, and the ATMEGa 16U2 USB interface, you would have to flash the 16U2 firmware. After you do all of that, you still get a "USB device not recognized" in Windows? Am I to conclude from this that this development board (the DUE) is really not ready as a development board platform? If one cannot take the hardware and incorporate it into another design, it is hard to think of it as a mature development platform. I wonder how long it will take for these issues to be resolved.

After you do all of that, you still get a "USB device not recognized" in Windows?

I flashed the firmware just for fun, and had no problems whatsoever. Of course it's a lot of work: One has to "build" the flasher out of an Arduino Uno and a number of cables, resistors and LEDs, but it was fun. I was using Windows 8 and also had to extend the commmands given in the tutorial a bit (e.g. avrdude.exe and avrdude.conf are not in the same directory, so I hat to use a path before avrdude.conf).
Regards, Martin