Go Down

Topic: Error:avrdude: usbdev_open(): did not find any USB device "usb" Using AVRISPMK2 (Read 8815 times) previous topic - next topic

v81

EDIT for those coming here from a google search.
-I had Atmel AVR Studio drive installed for the avrisp mk2
Have learned this is NOT compatible with Arduino IDE
Details here on the fix...
http://forum.arduino.cc/index.php?topic=118089.0
- Also after fix still had issues with Arduino IDE sending commands too fast when burning a bootloader, am raising this as an issue in the Arduino Suggestions forum.


I'm trying to burn code or a bootloader into several Arduinos.

Using...
Arduino IDE 1.6.3
Running Win7x64
Genuine AVR ISP Mk2 - correctly identified in device manager.

Devices in question...
Modern Device BBB
Modern Device RBBB
IC Station Nano (counterfeit FTDI chip)

In tools have selected...
Board (as required)
Processor (as required, BBB has a 168, RBBB has a 328)
Programmer AVRISP mkII

Tools > Burn Bootloader result...
Code: [Select]
avrdude: usbdev_open(): did not find any USB device "usb"
Error while burning bootloader.


When trying to burn code using "Programmer"

Code: [Select]
Build options changed, rebuilding all

Sketch uses 1,030 bytes (3%) of program storage space. Maximum is 30,720 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2,039 bytes for local variables. Maximum is 2,048 bytes.
avrdude: usbdev_open(): did not find any USB device "usb"



So not having a great deal of luck here, any ideas?


v81

A small amount of progress...
Reading this - http://forum.arduino.cc/index.php?topic=118089.0
I'm now able to burn code using the "programer"
Seems the Atmel Studio driver is not compatible with the Arduino IDE.

Still cannot burn a bootloader.
Same error as above.

v81

Ok, i suspect i have found out why the bootloader wont burn.

I found a option called "Shoe verbose output" and enabled it.
It appears burning a bootloader is a 2 part process, and 1st command runs successfully, however the second command fails.
During the burn process i do hear the Windows USB sound play.
I suspect what is happening is that the programing device us being reset by Avrdude after the first command is run and the second command is launched before the reset has completed.

To test this i copy/pasted the commands into a command line and ran them one after another with a few seconds delay between the commands, and it worked.

Re-tested in the IDE and it failed.

Re-confirmed at the command line and it worked again.

So i wrote a batch file to test it...
Code: [Select]
@echo off
cls
echo    ###################################################################
echo    #                                                                 #
echo    #  Arduino bootloader burn test, 1 command rapidly after another  #
echo    #                                                                 #
echo    ###################################################################
Pause
C:\Users\v81\AppData\Roaming\Arduino15\packages\arduino\tools\avrdude\6.0.1-arduino2/bin/avrdude -CC:\Users\v81\AppData\Roaming\Arduino15\packages\arduino\tools\avrdude\6.0.1-arduino2/etc/avrdude.conf -v -patmega168 -cstk500v2 -Pusb -e -Ulock:w:0x3F:m -Uefuse:w:0x00:m -Uhfuse:w:0xdd:m -Ulfuse:w:0xFF:m
C:\Users\v81\AppData\Roaming\Arduino15\packages\arduino\tools\avrdude\6.0.1-arduino2/bin/avrdude -CC:\Users\v81\AppData\Roaming\Arduino15\packages\arduino\tools\avrdude\6.0.1-arduino2/etc/avrdude.conf -v -patmega168 -cstk500v2 -Pusb -Uflash:w:C:\Users\v81\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2/bootloaders/atmega/ATmegaBOOT_168_diecimila.hex:i -Ulock:w:0x0F:m
echo.
echo.
echo.
echo.
echo.
echo    ##########################################################################################
echo    #                                                                                        #
echo    #  Arduino bootloader burn test, 1 command followed by 1 second delay then next command  #
echo    #                                                                                        #
echo    ##########################################################################################
Pause
C:\Users\v81\AppData\Roaming\Arduino15\packages\arduino\tools\avrdude\6.0.1-arduino2/bin/avrdude -CC:\Users\v81\AppData\Roaming\Arduino15\packages\arduino\tools\avrdude\6.0.1-arduino2/etc/avrdude.conf -v -patmega168 -cstk500v2 -Pusb -e -Ulock:w:0x3F:m -Uefuse:w:0x00:m -Uhfuse:w:0xdd:m -Ulfuse:w:0xFF:m
sleep 1
C:\Users\v81\AppData\Roaming\Arduino15\packages\arduino\tools\avrdude\6.0.1-arduino2/bin/avrdude -CC:\Users\v81\AppData\Roaming\Arduino15\packages\arduino\tools\avrdude\6.0.1-arduino2/etc/avrdude.conf -v -patmega168 -cstk500v2 -Pusb -Uflash:w:C:\Users\v81\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2/bootloaders/atmega/ATmegaBOOT_168_diecimila.hex:i -Ulock:w:0x0F:m


And the result...
Exceeds 9000 characters and the forum wouldnt let me post it.
However it is as expected, 1 command immediately after the other results in the second failing, 1 command after the other with 1 second delay works.

Wonder if it is worth posting this as a bug.
It could ultimately be a case of how fast one's computer is.
It would be good to experiment with delay between commands to see how short the delay has to be before it causes a failure.
The may only need to be a 200ms or so delay added between commands and eliminate this issue.


So it all works now with the exception of burning bootloaders from the IDE.
I'll look for a way to report this as an issue.
If anyone knows a way to make the IDE insert a short delay between commands this would solve everything for me.

hiduino

It's a timing issue with burning bootloader.  The IDE does two back-to-back access with avrdude to the AVRispMKII.  There is a known issue with avrdude v6.0.1 which fails to re-open the USB on back-to-back accesses.  This appears to be fixed with avrdude v6.1.
You should update avrdude to v6.1, you will need an updated avrdude.conf file also.  They changed the config file format slightly with v6.1.

garystofer

As @hiduino states the problem is related to the back to back invocations of avrdude from the Arduino IDE when trying to write the bootloader. First the fuse bits are written, then in a second invocation the program and the lockbyte is written.

The issue is that avrdude in conjunction with the USB communication library closes the USB connection and the AVR programming adapter reboots, then connects to the USB bus again, during which time the "usb" device is not present in the system, hence the error message about not being able to find a USB device.

The problem lies squarely with the Arduino IDE not having a delay in between the invocations, not with avrdude.

Running with version 6.1 of avrdude the same problem exists.

This issue has existed since the very beginning of the Arduino IDE and has vexed many a users and is present on all Atmel AVR - usb type programmers, jtag, ice , Dragon.   

The only way I can work around this issue on the JTAG ICE MKII for example is not to use the built in USB port, but rather use the old style com port. 
Gary

NeX

I am having the same problem, my Mkii can upload sketches but fails when uploading the bootloader. i am using the latest 6.4 version of the IDE and it still doesn't work.

anyone have a fix for this?

hiduino


hiduino

Running with version 6.1 of avrdude the same problem exists.
It may be you have it install in the wrong place.

I've been using avrdude v6.1 with all versions of the Arduino IDE and have not had any problems burning bootloader with an AVRispMKII programmer.



chucktodd

I blew the bootloader out of two Mega2560, today, and it took me all night to recover.

The Diagnosis that V81 identified is correct.

Ok, i suspect i have found out why the bootloader wont burn.

I found a option called "Show verbose output" and enabled it.
It appears burning a bootloader is a 2 part process, and 1st command runs successfully, however the second command fails.
During the burn process i do hear the Windows USB sound play.
I suspect what is happening is that the programing device us being reset by Avrdude after the first command is run and the second command is launched before the reset has completed.

To test this i copy/pasted the commands into a command line and ran them one after another with a few seconds delay between the commands, and it worked.

Re-tested in the IDE and it failed.

Re-confirmed at the command line and it worked again.

So it all works now with the exception of burning bootloaders from the IDE.
I'll look for a way to report this as an issue.
If anyone knows a way to make the IDE insert a short delay between commands this would solve everything for me.

Here is what my dirty fix has three parts, first:

add a cmd file name with the name of x.cmd to the Arduino\hardware\tools\avr\bin folder
Code: [Select]

"c:\Program Files\Windows Resource Kits\Tools\sleep.exe" 1
set a=%0
%a:~0,-6%avrdude.exe" %*

  
As you can see I had to download Windows Server 2003 Resource kit to get Sleep.exe. you can see that I strip the command line off the batch filename and concatenate it to avrdude.exe then pass the rest of the parameters.

Second:
modify platform.txt
Code: [Select]


# AVR Uploader/Programmers tools
# ------------------------------

tools.avrdude.path={runtime.tools.avrdude.path}
tools.avrdude.cmd.path={path}/bin/x.cmd
tools.avrdude.config.path={path}/etc/avrdude.conf


see where I changed tools.avrdude.cmd.path= from {path}/bin/avrdude to {path}/bin/x.cmd

Third:
I had to download Windows Server 2003 Resource kit to get sleep.exe

Now I can burn Bootloaders back into my Mega2560's

Chuck.

Currently building mega http server 90% done, the Last 10% is killing me.

Apothus

I had the same problem today using arduino v1.6.5 however I have previously had no problem burning loaders in the past.

Burning the bootloader with Arduino V1.04 worked fine. Not sure the difference between the distribution versions that allows this but i wont complain, I assume this has a delay or operates slower so the USB restart is not an issue.

bperrybap

As @hiduino states the problem is related to the back to back invocations of avrdude from the Arduino IDE when trying to write the bootloader. First the fuse bits are written, then in a second invocation the program and the lockbyte is written.

The issue is that avrdude in conjunction with the USB communication library closes the USB connection and the AVR programming adapter reboots, then connects to the USB bus again, during which time the "usb" device is not present in the system, hence the error message about not being able to find a USB device.

The problem lies squarely with the Arduino IDE not having a delay in between the invocations, not with avrdude.

While the first part of the explanation is correct. The problem is in avrdude not the IDE.
avrdude is resetting the USB when it exits. This is what is causing the Atmel ISP products to reset and have to re-enumerate with the host.
avrdude created the problem and it can be fixed in avrdude - which is where it should be fixed.
Anything else is simply working around the avrdude issue.
There is a 6 line patch to avrdude that fixes this issue.  I have been trying to get it added to avrdude for MANY years but have been unsuccessful.

Recently Cristian on the arduino.cc team was interested in including the patch in the avrdude that ships with the Arduino IDE since the maintainers of avrdude are not interested in fixing this long outstanding issue. I thought this had been added already to the version of avrdude that ships with the IDE but I need to follow up with Cristian to see what the latest status is.

--- bill

Go Up