Go Down

Topic: Resetting the Arduino Uno R3 Atmega16U2 (Read 53 times) previous topic - next topic


I have been attempting to update the firmware on my Uno R3 by following the instructions here: http://arduino.cc/en/Hacking/DFUProgramming8U2

The instructions say to briefly bridge the rest pin with the ground pin. The problem is, those instructions are for resetting the Atmega8U2, NOT the Atmega16U2 on the R3 which has a  "Stronger RESET circuit." What parts of the board do I connect to reset the 16U2 chip on my UNO R3?

UNO Rev 3: http://arduino.cc/en/uploads/Main/ArduinoUno_R3_Front.jpg


Briefly connecting ground and reset on the ISP header works for me. I connect them for about one second.

So you tried it and the board didn't go into DFU mode?


Okay, I connected the two metal pins sticking up closest to the USB connector, and the serial port no longer shows my UNO so I assume that I reset the 16u2 chip (the power light still comes on when I connect over USB). However, the instructions are to enter sudo dfu-programmer at90usb82 erase into the terminal window, but again that's for the 8u2 chip not the 16u2. Entering sudo dfu-programmer at90usb162 erase returns the error message dfu-programmer: no device present.

This post http://forums.adafruit.com/viewtopic.php?f=25&t=25146 suggests that I may have to edit the dfu-programmer SOURCE to get it to recognize the 16u2 =(


Feb 15, 2012, 10:33 pm Last Edit: Feb 15, 2012, 10:35 pm by dhunt Reason: 1
Ah yes, dfu-programmer 0.5.4 does not know about the atmega16u2 and the developers don't seem to have updated it yet.

Download the dfu-programmer source from http://sourceforge.net/projects/dfu-programmer/files, apply the attached patch and build your own:
Code: [Select]

tar xzf ~/Downloads/dfu-programmer-0.5.4.tar.gz
cd dfu-programmer-0.5.4
patch -p0 < ~/Downloads/atmega16u2.diff

# Make sure you have the tools needed to build it
sudo apt-get install build-essential libusb-1.0-0-dev

# configure and build it

# install it
sudo make install

Now you should be able to do this:
Code: [Select]
sudo dfu-programmer atmega16u2 erase


Thanks so much for your help dhunt. Here is the terminal output when I try to run the code:

Jacks-MacBook-Pro:Downloads JackBookPro$ tar xzf ~/Downloads/dfu-programmer-0.5.4.tar.gz
Jacks-MacBook-Pro:Downloads JackBookPro$ cd dfu-programmer-0.5.4
Jacks-MacBook-Pro:dfu-programmer-0.5.4 JackBookPro$ patch -p0 < ~/Downloads/atmega16u2.diff
patching file src/arguments.c
patching file src/arguments.h
Jacks-MacBook-Pro:dfu-programmer-0.5.4 JackBookPro$ sudo apt-get install build-essential libusb-1.0-0-dev
sudo: apt-get: command not found

Upon further investigation, it appears as though I need to install the libsub-1.0-0-dev library, which I found online here: http://libusb.6.n5.nabble.com/libusb-1-0-0-released-td6100.html Upon downloading libusb-1.0.0.tar.bz2, unpacking it and following the included installation instructions, I get this:

Jacks-MacBook-Pro:~ JackBookPro$ cd Downloads/libusb-1.0.0
Jacks-MacBook-Pro:libusb-1.0.0 JackBookPro$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking build system type... i386-apple-darwin11.3.0
checking host system type... i386-apple-darwin11.3.0
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld
checking if the linker (/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm
checking the name lister (/usr/bin/nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 196608
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld option to reload object files... -r
checking for objdump... no
checking how to recognize dependent libraries... pass_all
checking for ar... ar
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm output from gcc object... ok
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin11.3.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for inline... inline
checking whether gcc and cc understand -c and -o together... yes
checking operating system... configure: error: unsupported operating system

Does this mean that OSX Lion 10.7.3 does not support the libsub-1.0-0-dev library needed to rebuild the dfu-programmer?

Go Up