Offline
Newbie
Karma: 0
Posts: 6
|
 |
« on: February 15, 2012, 01:54:01 pm » |
I have been attempting to update the firmware on my Uno R3 by following the instructions here: http://arduino.cc/en/Hacking/DFUProgramming8U2The 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
|
|
|
|
|
Logged
|
|
|
|
|
Wellington, New Zealand
Offline
Sr. Member
Karma: 1
Posts: 404
|
 |
« Reply #1 on: February 15, 2012, 03:15:43 pm » |
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?
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #2 on: February 15, 2012, 03:50:53 pm » |
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 
|
|
|
|
|
Logged
|
|
|
|
|
Wellington, New Zealand
Offline
Sr. Member
Karma: 1
Posts: 404
|
 |
« Reply #3 on: February 15, 2012, 04:33:56 pm » |
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: 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 ./bootstrap.sh ./configure make
# install it sudo make install
Now you should be able to do this: sudo dfu-programmer atmega16u2 erase
|
|
|
|
« Last Edit: February 15, 2012, 04:35:40 pm by dhunt »
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #4 on: February 15, 2012, 05:10:44 pm » |
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 systemDoes this mean that OSX Lion 10.7.3 does not support the libsub-1.0-0-dev library needed to rebuild the dfu-programmer?
|
|
|
|
|
Logged
|
|
|
|
|
Wellington, New Zealand
Offline
Sr. Member
Karma: 1
Posts: 404
|
 |
« Reply #5 on: February 15, 2012, 06:07:29 pm » |
Ok I gave you instructions for the wrong OS, sorry. I've built it on OSX 10.6.8 without problems (the patch still applies the same way with patch -p0), I'll give it a go tonight on a lion VM with 10.7.3. I use MacPorts ( http://www.macports.org/) as a package manger on my Mac to get easy access to ported libraries and apps.
|
|
|
|
|
Logged
|
|
|
|
|
Wellington, New Zealand
Offline
Sr. Member
Karma: 1
Posts: 404
|
 |
« Reply #6 on: February 16, 2012, 06:16:27 am » |
I wasn't able to get the xcode install completed on my lion system tonight - it wants to spend 2 hours downloading for some reason. But on 10.6.8 I built and installed this libusb version without any problems: http://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-1.0.8/libusb-1.0.8.tar.bz2/download. Do the usual ./configure; make; sudo make install. After that you should be able to build dfu-programmer.
|
|
|
|
|
Logged
|
|
|
|
|
Wellington, New Zealand
Offline
Sr. Member
Karma: 1
Posts: 404
|
 |
« Reply #7 on: February 19, 2012, 01:27:20 am » |
I got the dfu-programmer to build on OSX Lion 10.7.3 with the following steps: - Install Xcode 4.3 from the Appstore
- Install Xcode command line tools from Xcode preferences (see https://developer.apple.com/library/ios/#documentation/DeveloperTools/Conceptual/WhatsNewXcode/Articles/xcode_4_3.html).
- Tell Xcode where Xcode is installed: sudo xcode-select -switch /Applications/Xcode.app
- Set up a link for the missing clang executable: cd /Applications/Xcode.app/Contents/Developer/usr/bin; sudo ln -s clang llvm-gcc; cd -
- Install macports from http://www.macports.org/
- Install autoconf tools via macports: sudo port install pkgconfig automake
- Install libusb via macports: sudo port install libusb-devel
- Configure and build dfu-programmer: cd dfu-programmer-0.5.4; ./bootstrap.sh; ./configure; ./make; ./sudo make install
After this you should be pretty much set for building other packages and tools too. You can also search for available packages using the macports search command. For example: port search libusb libusb @1.0.8 (devel) library for USB device access
libusb-compat @0.1.3 (devel) library for USB device access
libusb-devel @1.0.8.20101017 (devel) library for USB device access
libusb-legacy @0.1.12 (devel) Library providing access to USB devices
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #8 on: February 20, 2012, 08:15:28 pm » |
I can't thank you enough for all of your help! I installed Xcode and the command line tools and tried to execute the code you gave me, but I made a mistake; I ran the sudo port install pkgconfig automake command before putting in sudo ln -s clang llvm-gcc and then -cd: Jack-Wolfes-MacBook-Pro:bin JackBookPro$ cd Jacks-MacBook-Pro:~ JackBookPro$ sudo xcode-select -switch /Applications/Xcode.app Jacks-MacBook-Pro:~ JackBookPro$ cd /Applications/Xcode.app/Contents/Developer/usr/bin Jacks-MacBook-Pro:bin JackBookPro$ sudo port install pkgconfig automake Warning: port definitions are more than two weeks old, consider using selfupdate ---> Computing dependencies for pkgconfig ---> Cleaning pkgconfig ---> Computing dependencies for automake ---> Dependencies to be installed: autoconf help2man p5.12-locale-gettext m4 ---> Fetching archive for p5.12-locale-gettext ---> Attempting to fetch p5.12-locale-gettext-1.50.0_6.darwin_11.x86_64.tbz2 from http://packages.macports.org/p5.12-locale-gettext ---> Fetching p5.12-locale-gettext ---> Attempting to fetch gettext-1.05.tar.gz from http://ftp://ftp.cpan.org/pub/CPAN/modules/by-module/Locale ---> Verifying checksum(s) for p5.12-locale-gettext ---> Extracting p5.12-locale-gettext ---> Applying patches to p5.12-locale-gettext ---> Configuring p5.12-locale-gettext ---> Building p5.12-locale-gettext ---> Staging p5.12-locale-gettext into destroot ---> Installing p5.12-locale-gettext @1.50.0_6 ---> Activating p5.12-locale-gettext @1.50.0_6 ---> Cleaning p5.12-locale-gettext ---> Fetching archive for help2man ---> Attempting to fetch help2man-1.40.4_1.darwin_11.x86_64.tbz2 from http://packages.macports.org/help2man ---> Fetching help2man ---> Attempting to fetch help2man-1.40.4.tar.gz from http://ftp://ftp.gnu.org/gnu/help2man ---> Verifying checksum(s) for help2man ---> Extracting help2man ---> Configuring help2man Error: Target org.macports.configure returned: configure failure: shell command failed (see log for details) Error: Failed to install help2man Log for help2man is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_textproc_help2man/help2man/main.log Error: The following dependencies were not installed: autoconf help2man m4 Error: Status 1 encountered during processing. To report a bug, see <http://guide.macports.org/#project.tickets>After that, I tried switching back to the main directory but I kept getting the same error: Jack-Wolfes-MacBook-Pro:~ JackBookPro$ cd /Applications/Xcode.app/Contents/Developer/usr/bin Jacks-MacBook-Pro:bin JackBookPro$ sudo ln -s clang llvm-gcc ln: llvm-gcc: File exists Jacks-MacBook-Pro:bin JackBookPro$ cd - /Users/JackBookPro Jacks-MacBook-Pro:~ JackBookPro$ sudo port install pkgconfig automake ---> Computing dependencies for pkgconfig ---> Cleaning pkgconfig ---> Computing dependencies for automake ---> Dependencies to be installed: autoconf help2man m4 ---> Configuring help2man Error: Target org.macports.configure returned: configure failure: shell command failed (see log for details) Error: Failed to install help2man Log for help2man is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_textproc_help2man/help2man/main.log Error: The following dependencies were not installed: autoconf help2man m4 Error: Status 1 encountered during processing. To report a bug, see <http://guide.macports.org/#project.tickets> Jacks-MacBook-Pro:~ JackBookPro$ sudo port install libusb-devel ---> Computing dependencies for libusb-devel Error: Unable to execute port: Can't install libusb-devel because conflicting ports are installed: libusbDo you know what these errors mean, and how I can avoid encountering them? I've attached the main.log file referenced in the above code. Please excuse my limited knowledge of programming; I'm a much better digital artist than I am a coder.
|
|
|
|
|
Logged
|
|
|
|
|
|
|
quito
Offline
Newbie
Karma: 0
Posts: 4
|
 |
« Reply #10 on: March 14, 2012, 12:03:15 am » |
hi, i had kind of the same problem. my uno r3 stopped responding after setting the baudrate to 14400 and started to create a new serial (/dev/ttyACM*) port with each reset. i did patch and build the dfu-programmer with the mentioned patch but when it comes to flashing the firmware i get a parsing error: >>sudo dfu-programmer atmega16u2 flash unor3.hex Error parsing the line. Something went wrong with creating the memory image. (i renamed the the *.hex for being lazy in the typing area).
>>uname -a Linux laptopanatol2 2.6.32-39-generic #86-Ubuntu SMP Mon Feb 13 21:47:32 UTC 2012 i686 GNU/Linux
the lsusb returns a "03eb:2fef Atmel Corp" device (instead of the unnamed 2341:0043 which used to be the arduino) and dmesg confirms the "full speed USB device"
the erase command with dfu-programmer went just fine and that was the last i heard from the arduino.
any idea if i got the wrong firmware or if the patch went wrong? (the one i used was "Arduino-usbserial-atmega16u2-Uno-Rev3.hex" from the git)
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 3
|
 |
« Reply #11 on: March 14, 2012, 04:04:11 pm » |
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 ./bootstrap.sh ./configure
bootstrap succeeds, but configure fails with: ./configure: line 3588: syntax error near unexpected token `LIBUSB_1_0,' ./configure: line 3588: ` PKG_CHECK_MODULES(LIBUSB_1_0, libusb-1.0 >= 1.0.0 , have_libusb_1_0=yes, have_libusb_1_0=no)' This is on Debian 6. Help?
|
|
|
|
|
Logged
|
|
|
|
|
quito
Offline
Newbie
Karma: 0
Posts: 4
|
 |
« Reply #12 on: March 15, 2012, 11:33:25 pm » |
hodwy, it seems to me that you have the *dev lib installed but not libusb itself. just do the sudo apt-get install libusb (don't remember the package name right now but you could use aptitude to search for it) recompile again and it should go fine
|
|
|
|
|
Logged
|
|
|
|
|
Wellington, New Zealand
Offline
Sr. Member
Karma: 1
Posts: 404
|
 |
« Reply #13 on: March 16, 2012, 03:09:28 am » |
hodwy, it seems to me that you have the *dev lib installed but not libusb itself. just do the sudo apt-get install libusb (don't remember the package name right now but you could use aptitude to search for it) recompile again and it should go fine
That would be weird. Installing the dev lib should install the base lib also. E.g. apt-rdepends output for libusb-1.0-0-dev: libusb-1.0-0-dev Depends: libc-dev Depends: libc6-dev Depends: libusb-1.0-0 (= 2:1.0.8-4) I would think it more likely that libusb-1.0-0-dev and libusb-1.0-0 is not installed. Running "dpkg -l | grep libusb" would be one way to check.
|
|
|
|
|
Logged
|
|
|
|
|
quito
Offline
Newbie
Karma: 0
Posts: 4
|
 |
« Reply #14 on: March 16, 2012, 01:57:08 pm » |
right you are dhunt, but you never know it turns out that my *.hex was corrupted i got the right one now and the flashing went fine never the less, the arduino, even with the new bootloader, still doesn't respond to the arduino ide. i've got the /dev/ttyACM0, the ide reports it correctly, but when it comes to uploading i get a java error:
Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyACM0 processing.app.SerialException: Error opening serial port '/dev/ttyACM0'. at processing.app.Serial.<init>(Serial.java:146) at processing.app.Serial.<init>(Serial.java:91) at processing.app.SerialMonitor.openSerialPort(SerialMonitor.java:204) at processing.app.Editor.handleSerial(Editor.java:2415) at processing.app.EditorToolbar.mousePressed(EditorToolbar.java:352) at java.awt.Component.processMouseEvent(Component.java:6200) at javax.swing.JComponent.processMouseEvent(JComponent.java:3267) at java.awt.Component.processEvent(Component.java:5968) at java.awt.Container.processEvent(Container.java:2105) at java.awt.Component.dispatchEventImpl(Component.java:4564) at java.awt.Container.dispatchEventImpl(Container.java:2163) at java.awt.Component.dispatchEvent(Component.java:4390) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4461) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4122) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4055) at java.awt.Container.dispatchEventImpl(Container.java:2149) at java.awt.Window.dispatchEventImpl(Window.java:2478) at java.awt.Component.dispatchEvent(Component.java:4390) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:649) at java.awt.EventQueue.access$000(EventQueue.java:96) at java.awt.EventQueue$1.run(EventQueue.java:608) at java.awt.EventQueue$1.run(EventQueue.java:606) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:105) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:116) at java.awt.EventQueue$2.run(EventQueue.java:622) at java.awt.EventQueue$2.run(EventQueue.java:620) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:105) at java.awt.EventQueue.dispatchEvent(EventQueue.java:619) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:275) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:200) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177) at java.awt.EventDispatchThread.run(EventDispatchThread.java:138) Caused by: gnu.io.UnsupportedCommOperationException: Invalid Parameter at gnu.io.RXTXPort.setSerialPortParams(RXTXPort.java:171) at processing.app.Serial.<init>(Serial.java:136) ... 35 more
anyone got an idea? might it be a mixup between processing and arduino libs?
edit (just a few hours later) sorry about filling it up a very strange thing happened with the user permissions i had to re-add myself to the dialout group to get r/w access to the /dev/ttyACM* and still i have no clue wtf happend.
|
|
|
|
« Last Edit: March 16, 2012, 03:53:10 pm by anatolw »
|
Logged
|
|
|
|
|
|