mega 2560 R3 - no device present. make: *** [dfu] Error 1

hello folks.

first post here and first time holding something called “arduino” in my hands.

so. just finished soldering my project. i´m about to build my own chronome

http://flipmu.com/work/chronome/

and can´t figure out what i´m missing here.

here is what i´m have done so far:

http://flipmu.com/work/chronome/changing-the-serial-number/

had no problems thru steps 1-12

now, when putting (or actually trying to put) my mega 2560 R3 into DFU Mode, i get following results.
there is a little yellow LED which blinks just another couple of times after released the green pads (see pic in link) and then turns off.

open up arduino, tools/serial ports → my arduino is no longer is the device list, which is a good sign that my 2560 is in dfu mode.

now, when typing in termial:

sudo make dfu

i get this result:
dfu-programmer at90usb82 erase
dfu-programmer: no device present.
make: *** [dfu] Error 1

what am i doing wrong?

any help highly appreciated.

greetings to all.

pic arduino.tiff (863 KB)

terminal message.rtf (46 KB)

The Mega 2560 R3 uses the Atmega16u2 for serial conversion.

You will need to update the dfu programmer to recognize the Atmega16u2 part.

The following post discusses the steps to patch the dfu programmer:

hi louis,

thanks for the quick help.

just downloaded libusb-1.0.8 from here

Download libusb from SourceForge.net.

after typing in terminal

./configure

i get this error:

Claudio-Battistas-MacBook-Pro:libusb-1.0.8 claudiobattista$ ./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 whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in /Users/claudiobattista/chronome/libusb-1.0.8': configure: error: cannot run C compiled programs. If you meant to cross compile, use --host'.
See `config.log' for more details.
Claudio-Battistas-MacBook-Pro:libusb-1.0.8 claudiobattista$

?

hi louis,

o.k lets go on step back.

i think @dhunt has the solution

"…

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:
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

“”"

this is the error i get when trying to install libusb:

Claudio-MacBook-Pro:dfu-programmer-0.5.4 claudiobattista$ sudo apt-get install build-essential libusb-1.0-0-dev
Password:
sudo: apt-get: command not found

seems like i dont have the tool i need?!

hi louis,

when trying to follow @dhunts suggestion i get this error

Claudio-MacBook-Pro:dfu-programmer-0.5.4 claudiobattista$ patch -p0 < ~/Downloads/atmega16u2.diff
patching file src/arguments.c
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored – saving rejects to file src/arguments.c.rej
patching file src/arguments.h
Reversed (or previously applied) patch detected! Assume -R? [n] n
Apply anyway? [n] n
Skipping patch.
1 out of 1 hunk ignored – saving rejects to file src/arguments.h.rej

Claudio-MacBook-Pro:dfu-programmer-0.5.4 claudiobattista$ sudo apt-get install build-essential libusb-1.0-0-dev
Password:
sudo: apt-get: command not found

???

I suggest you follow the steps that @dhunt suggests further down in the thread.
@dhunt used macports as the package manager to get the necessary packages.

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

just tried.

after ./configure i get this error

Claudio-Battistas-MacBook-Pro:arduino-usbserial claudiobattista$ 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: libusb
To report a bug, see http://guide.macports.org/#project.tickets
Claudio-Battistas-MacBook-Pro:arduino-usbserial claudiobattista$ cd dfu-programmer-0.5.4;
Claudio-Battistas-MacBook-Pro:dfu-programmer-0.5.4 claudiobattista$ /bootstrap.sh;
-bash: /bootstrap.sh: No such file or directory
Claudio-Battistas-MacBook-Pro:dfu-programmer-0.5.4 claudiobattista$ ./bootstrap.sh
Claudio-Battistas-MacBook-Pro:dfu-programmer-0.5.4 claudiobattista$ ./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… m4/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 whether to enable maintainer-specific portions of Makefiles… no
checking for gcc… gcc
checking whether the C compiler works… yes
checking for C compiler default output file name… a.out
checking for suffix of executables…
checking whether we are cross compiling… configure: error: in /Users/claudiobattista/chronome/LUFA 100807/Projects/arduino-usbserial/dfu-programmer-0.5.4': configure: error: cannot run C compiled programs. If you meant to cross compile, use –host’.
See `config.log’ for more details
Claudio-Battistas-MacBook-Pro:dfu-programmer-0.5.4 claudiobattista$

i have x11 & xcode installed …!!!

???

mbp i7 osx 10.6.8, arduino mega 2560 R3

Attached is the patched version of dfu-programmer that I built on my system…

dfu-programmer (59.6 KB)

hi louis.

sorry for the dump question, but i have no idea where to put your attached file and which command to type in terminal...

thanks.

You can use the instructions at the following link as a guide:

http://arduino.cc/en/Hacking/DFUProgramming8U2

Put the dfu-programmer file that you downloaded in any folder of your choosing.

Download the following file and put it in the same folder:
https://github.com/arduino/Arduino/blob/master/hardware/arduino/firmwares/arduino-usbserial/Arduino-usbserial-atmega16u2-Mega2560-Rev3.hex

Then open the terminal and cd to the folder you just put the files in and execute the following commands:

sudo ./dfu-programmer atmega16u2 erase

When this command is done and you get a command prompt again, type

sudo ./dfu-programmer atmega16u2 flash Arduino-usbserial-atmega16u2-Mega2560-Rev3.hex

Finally, type

sudo ./dfu-programmer atmega16u2 reset

did so.

get this error

Last login: Sat Apr 7 16:35:57 on ttys005
Claudio-Battistas-MacBook-Pro:~ claudiobattista$ cd chronome_v2
Claudio-Battistas-MacBook-Pro:chronome_v2 claudiobattista$ sudo ./dfu-programmer atmega16u2 erase
sudo: ./dfu-programmer: command not found
Claudio-Battistas-MacBook-Pro:chronome_v2 claudiobattista$

attached a picture of the folder where i put the files…

when typing

sudo dfu-programmer atmega16u2 erase (without ./ – i have no clou what meany by the way) i get this

seems like 16u2 is not in the targe list?!?!?

Claudio-Battistas-MacBook-Pro:chronome_v2 claudiobattista$ 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]
Claudio-Battistas-MacBook-Pro:chronome_v2 claudiobattista$

chronome_v2.tiff (24.9 KB)

The ./ is used to make sure you execute the dfu-programmer app that is in the local directory.

When you removed the ./ , you are executing the old dfu-programmer app that does not have the patch.

If you look at the dfu-programmer file in Finder does it have an icon that shows "exec" and has a Kind of Unix Executable File?

If not, you will need to execute the command: chmod +x dfu-programmer

This will let you execute the file. Make sure your terminal's local directory is the one with the downloaded dfu-programmer and hex file.
Make sure you use the ./ when you execute the commands.

the dfu-programmer file didn´t had any exec icon until i did

chmod +x dfu-programmer

now my dfu-programmer file has an exec icon (see picture attached)

now, when i´m typing sudo ./dfu-programmer atmega16u2 erase

i get this:

Claudio-Battistas-MacBook-Pro:chronome_v2 claudiobattista$ sudo ./dfu-programmer atmega16u2 erase
dyld: Library not loaded: /usr/local/lib/libusb-1.0.0.dylib
Referenced from: /Users/claudiobattista/chronome_v2/./dfu-programmer
Reason: image not found
Trace/BPT trap
Claudio-Battistas-MacBook-Pro:chronome_v2 claudiobattista$

what am i doing wrong?

dfu exec.tiff (35.2 KB)

Now it is telling you that libusb library is not installed or it can't find it.

Since you have macports installed from a previous step, you need to run:

sudo port install libusb

Hopefully that will fix up your libusb library install.

desperate =(

Claudio-Battistas-MacBook-Pro:chronome_v2 claudiobattista$ sudo port install libusb
---> Cleaning libusb
Claudio-Battistas-MacBook-Pro:chronome_v2 claudiobattista$ sudo ./dfu-programmer atmega16u2 erase
dyld: Library not loaded: /usr/local/lib/libusb-1.0.0.dylib
Referenced from: /Users/claudiobattista/chronome_v2/./dfu-programmer
Reason: image not found
Trace/BPT trap
Claudio-Battistas-MacBook-Pro:chronome_v2 claudiobattista$

I am running out of ideas. Hopefully someone else on the forum and figure out the dependency issue.

You may need to create a symbolic link to your location of the libusb library.

You will need to find the location of your libusb library and then create a symbolic link from there to /usr/local/lib/libusb-1.0.0.dylib

I think MacPorts puts it’s packages in this location: /opt/local

So if you want to create a symbolic link from /opt/local/lib/libusb-1.0.0.dylib to /usr/local/lib/libusb-1.0.0.dylib

sudo ln -s /opt/local/lib/libusb-1.0.0.dylib /usr/local/lib/libusb-1.0.0.dylib

Now try to execute the ./dfu-programmer command and hopefully it will be able to find the libusb library.

man, your help is really highly appreciated, but i think i loose now the overview over everything.

your last post did help:

doing this

sudo ln -s /opt/local/lib/libusb-1.0.0.dylib /usr/local/lib/libusb-1.0.0.dylib

Claudio-Battistas-MacBook-Pro:chronome claudiobattista$ sudo ./dfu-programmer atmega16u2 erase
Claudio-Battistas-MacBook-Pro:chronome claudiobattista$ sudo ./dfu-programmer atmega16u2 flash Arduino-usbserial-atmega16u2-Mega2560-Rev3.hex
Validating…
4034 bytes used (32.83%)
Claudio-Battistas-MacBook-Pro:chronome claudiobattista$ sudo ./dfu-programmer atmega16u2 reset

i can see the arduino in my system profiler now.

but from this point on i am lost in space…

this are my next steps but problems again.aaaaaaaarghhhhhh

http://flipmu.com/work/chronome/chronome-serialosc/

again this “cannot run C compiled programs.” error

Claudio-Battistas-MacBook-Pro:arduino-usbserial claudiobattista$ cd ~/Downloads/confuse-2.7/
Claudio-Battistas-MacBook-Pro:confuse-2.7 claudiobattista$ ./configure
checking whether to enable maintainer-specific portions of Makefiles… no
checking for a BSD-compatible install… /usr/bin/install -c
checking whether build environment is sane… yes
checking for a thread-safe mkdir -p… support/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 whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... configure: error: in `/Users/claudiobattista/Downloads/confuse-2.7': configure: error: cannot run C compiled programs. If you meant to cross compile, use `--host'. See `config.log' for more details. Claudio-Battistas-MacBook-Pro:confuse-2.7 claudiobattista

so mainly what i don´t understand is,

  1. why am i not able to run C compiled programms

and

  1. why is terminal still telling me this, when doing: sudo make dfu ? why at90usb82 ???

Claudio-Battistas-MacBook-Pro:arduino-usbserial claudiobattista$ sudo make dfu
dfu-programmer at90usb82 erase
dfu-programmer: no device present.
make: *** [dfu] Error 1

WTF :frowning:

arduino.tiff (29.5 KB)

allrighty.

works like a charm now.

the problem was some funny issue with the root permission which didn´t let me do some commands in the terminal...

thanks to everybody...