Avr Programmers (and others) Usb Driver for Arduino

by Visual Micro 17. January 2014 09:21

This document solves usb driver errors for Arduino programmers. The problem usually happens after installing Atmel Studio. The error will often be:- avrdude: usbdev_open()

Atmel changed the usb driver they install to Jungo which doesn't work with the Arduino Ide and therfore with Visual Micro

This document explains how to switch the driver to one that the Arduino tool chain will work with.

Tested on Xp, Win7 and Win8.1

1) We downloaded the latest release (1.2.6.0) of libusb-win32 from http://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/ but the latest release can be found here http://sourceforge.net/projects/libusb-win32/

2) Unpack the libusb zip and run the inf-wizard.exe in the bin folder AS ADMINISTRATOR

3) Select the avrisp mkII from the list that appears when you run inf-wizard then click next through the wizard.

4) When prompted select a place on your pc to save the .inf file that the wizard will create. (If you loose the file in the future you can simply repeat the task)

5) When prompted click OK to install the driver.

If required you can run the Atmel Studio 6.1 Jungo driver install again and revert to Atmel Studio drivers with the avrispmkII. 

It is probably also possible to switch back to arduino/avrdude mode by reapplying the .inf created in step 6) via device manager

Sorry about the formatting of the following, it is my fault and caused by conversion from ms word. This update was submiited by Brian M. It explains how to make both the Arduino and Atmel Studio Native commands to work using the same usb driver

Using Atmel's AVRISP mk II Programmer

 with the Visual Micro plug-in for Atmel Studio IDE 

Overview:  When you install the Arduino IDE, a USB driver is installed so that you can use the Atmel AVRISP mk II programmer as an alternative to using the Arduino serial Boot-loader. Also, if you need to actually program an AVR MCU with the bootloader code itself (i.e. if you have a blank Mega328 that has not had the boot-loader firmware pre-installed), you can do so from the Arduino IDE using the Tools/Burn Bootloader function- after having specified the AVRISP mk II as the programmer using Tools/Programmer function.

            When you install Studio 6.1/ 6.2 however, the Atmel installation will install it's own USB driver, which work with the Studio6.x IDE. This is the Jungo driver, and while you have the option of not installing the Jungo driver during the Studio install process, you can't use the Atmel AVRISP mk II nor the Atmel JTAGICE3 without this driver.

 

The Problem: When you install the Visual Micro plug-in for Studio 6.x, you are most likely to be using the Arduino serial bootloader, since Visual Micro's programming and  debugging capability is based upon the USB-serial link between the PC and the Arduino board. Doing things  this way works fine.

            However, if you decide that you want to use the Atmel AVRISP mk II from within the Visual Micro/Studio 6.x IDE (for downloading your program, or burning the Arduino bootloader), you will find that it doesn't work. You will get an error message to the effect that AVRdude (the programming software used by the Arduino IDE), can't “see” the AVRISP mk II programmer. This happens because Studio6.x uses the Jungo USB driver, and Visual

Micro basically calls the AVRdude programming software (located in the Arduino program folder) just like the Arduino IDE does. AVRdude won't work properly, because its normal USB driver has been replaced by the Jungo driver that Studio6.x has loaded.

 

The Solution:  What we need is a way to allow the Jungo driver that is associated with the Studio6.x to co-exist with the USB driver that the Arduino IDE uses. That is, we want the Arduino programming routines (i.e. the AVRdude program) to work even with the Atmel Studio6x Jungo driver loaded. This is not too difficult to achieve.

1)   If you want to be certain that Studio6.x has installed the Jungo driver, you can run the Windows Device Manager program, and you will see the following (assuming your AVRISP mk II is plugged in)

 

2)    The USB driver that the Arduino IDE uses (and therefore Visual Micro) is libusb0.dll. This DLL comes from a larger driver package that installs a basically generic USB driver (which can be used by a variety of Windows applications). This package provides drivers in two formats: stand-alone and filter. The stand-alone format is what the Arduino IDE installs when you run the Arduino setup program. It works fine on its own, but doesn't work with native Atmel Studio6.x tools unless using Visual Micro. If the Atmel Studio usb drivers are installed then we can still program Arduino using Visual Micro but not the Arduino IDE. This can be fustrating if we want all software to work all of the time regardless of Visual Micro. The filter version of the driver works differently. It basically interfaces to your application (Arduino IDE in this case) via the libusb0.dll, but the filter version of the DLL then “massages” the data and forwards it along to the Jungo driver (which is what Studio 6.x uses by default).So, after installing this “filter” version, when you use the “upload using programmer” or “Burn bootloader” functions available in the Tools/Visual Micro toolbar, they will work correctly.

3)   You download the libusb package from the sourceforge.net website, by searching for libusb. Pick the libusb-winb32 version. Unzip the downloaded file (libusb-win32-bin-1.2.6.0 when I did it), navigate to the libusb-win32-bin-1.2.6.0/bin folder  and enter  the i86 folder. Plug in your AVRISP mk II now. Then run the install-filter-win program, which will display the following screen:

 
            

Press Next, and you should see your Atmel AVRISP mk II in the list:

            Select the AVRISP mk II and hit Install.

            If the AVRISP mk II does NOT appear, it is possible that a libusb driver for it has already been installed (and presumably not the filter version, or you would not be having this problem in the first place).You can go back and select the “remove a device filter” option, and if you see the AVRISP mk II in that list, remove it. Then you should be able to re-try the installation of the filter driver for the AVRIPS mk II. If successful, you should get the following message:

4)   You should now have a libusb0.dll filter driver installed for the AVRISP mk II. You can check for its presence in the Windows/System32 folder under the filename libusb0.dll. You can test the driver using the testlibusb program (in the x86 folder mentioned above):

 

We're almost done. However, we have to stop the AVRdude program (used by Arduino for programming) from using the libusb0.dll file that it has already installed in its own folder, and use the new (filter version) one that we've just installed. Do do this, we have to “remove” all instances of the libusb0.dll file from within the  c:\program files\arduino folder hierarchy.

The best way to do this is to navigate to the  c:\program files\arduino folder, and do a search for “libusb0.dll. Once you have found them, rename them to libusb0.dll.bak (in case something goes wrong and you need them back again!


           

            In the case of my XP computer, there were 3 files, and on my 32-bit Win7 computer, there was an additional libusb0-x64.dll file (for 64 bit windows). Once these files are “removed” by renaming them, AVRdude will still look for libusb0.dll, but will only find the filter version in the windows\system32 folder, (where all windows programs look, by default, if they can't find the necessary DLL in their own folder).

            At this point you should be able to open the Studio6.x program and go to the Tools/visual Micro/Programmers tab and select the AVRISP mk II. After you click the “upload  using programmer” tab you should now be able to download programs to your AVR target board using the AVRISP mk II programmer, or use the “burn Bootloader” routine in the Tools/Visual Micro menu bar.

NOTE: to use the Visual Micro USB debugging routines, you will still need to connect your Arduino board to the PC using the standard USB connection cable, as fully described in the Visual Micro documentation.

            This procedure worked for me on both my XP and 32-bit Windows 7 computers, one with Studio6.1 and the other with Studio6.2 and the Visual Micro plug-in.