Silahkan Melihat Tutorial di website kami dengan nyaman ENJOY YOUR LIFE ☕

ROBOTIKA :: CONNECTING AVRISP TO ARDUINO

Context

During the installation of Arduino IDE, a USB driver is installed so that the Atmel AVRISP mk II programmer can be used as an alternative to the Arduino serial boot-loader. The programmer can also be used for “burning” a bootloader on the target MCU so that the MCU can be programmed through the USB port.
During the installation of Atmel Studio a specific USB driver will be installed: this is theJungo driver. While you have the option of not installing the Jungo driver during the Atmel Studio installation process, but the lack of Jungo driver will prevent you from using the Atmel AVRISP mk II within the Atmel Studio environment. So let’s say that we decide to install the Jungo driver.
  • OS: Windows 7 Pro
  • Atmel Studio: rev. 6.2 SP2
  • AVRISP mkII: guenuine product
  • libusb: rev. 1.2.6.0
  • Arduino IDE: rev. 1.6.5
Problem
Having installed Atmel Studio and the the Jungo driver, the Atmel AVRISP mk II programmer will no longer work with Arduino IDE. AVRdude (one of the key applications behind the Arduino IDE) won’t work properly, because its normal USB driver has been replaced by the Jungo driver that Atmel Studio has loaded.
Solution
The idea is to allow the Jungo driver which works fine with Atmel Studio to co-exist with the Arduino IDE environment.
Note: This is a principle solution. You may retain the principle, mix it with common sense and apply it to your environment !
Arduino IDE uses the libusb0.dll USB driver. This DLL comes from a larger driver package that installs a generic USB driver which can be used by a variety of Microsoft Windows applications. This package provides drivers in two formats: stand-alone and filter. Thestand-alone version is installed along with the Arduino IDE. The filter version is installed along with Atmel Studio. The filter version interfaces to Arduino IDE via the libusb0.dll driver ; it “messages” the data and forwards it along to the Jungo driver. As a consequence of installing the filter version, “upload using programmer” or “Burn bootloader” functions will not work correctly within the Arduino IDE environment.
 Procedure
Plug your Atmel AVRISP mk II programmer and check for the actual driver using the Device Manager Program (“Computer” icon, right-click “Manage” in pop-up menu).
device_manager
Download the libusb package from here. The libusb is a C library that gives applications easy access to USB devices on many different operating systems. libusb is an open source project, the code is licensed under the ​GNU Lesser General Public License version 2.1 or later. More on libsub. Unzip the downloaded file and navigate to the “libusb-win32-bin-1.2.6.0/bin folder”. Select the sub folder which fits with your processor. Plug in your AVRISP mk II. Then run “install-filter-win.exe” program, which will display the following screen:
install-filter-win_1
Press Next, and you should see your Atmel AVRISP mk II in the list:
install-filter-win_4.
Note: If the AVRISP mk II does NOT appear, it is possible that a libusb driver for it has already been installed. If necessary, go back to the previous screen and  remove the appropriate device filter.
Select the AVRISP mk II and click on “Install”.
libusb0.dll filter driver should now be 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-win.exe” program (in the sub folder mentioned above):
install-filter-win_3.
Now, we have to prevent the AVRdude program from using the “libusb0.dll” file that it has already installed in its own folder, and instead use the filter version that we’ve just installed. To do this, “remove” all instances of the “libusb0.dll” files from within the “c:\program files\arduino” folder hierarchy. The best way to do this is to navigate to the “c:\programfiles\arduino” folder, and do a search for “libusb0.dll”. Once you have found them, rename them to “libusb0.dll.bak” (in case you need to cancel the operation). Once these files are “removed”, AVRdude will still look for libusb0.dll, but will only find the filterversion in the “windows\system32” folder, which the default location for drivers. Last but not least, reboot your computer in order to allow changes to take effect. At this stage, the list of devices should look like:
device_manage_2r
You should now be able to open the Atmel Studio and go to the “Tools/Device programming” menu and select the AVRISP mk II. After you click the “Apply” button you should be able to download programs to your AVR target board using the AVRISP mk II programmer. With Arduino IDE, you should be able to perform the “upload using programmer” operation successfully.
However, the “burn Bootloader” will still fail to work with Arduino IDE. The reason lies in the timing during the boot-loader burning operation. Arduino IDE performs two back-to-back access with AVRdude to the AVRispMKII.  There is a known issue with early AVRdude which fails to re-open the USB on back-to-back accesses. The issue is that AVRdude in conjunction with the USB communication library closes the USB connection and the AVRISP MkII programmer 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. Although this problem could be solved in Arduino IDE, the solution comes from the latest version of AVRdude that you can download from here. AVRdude 6.2 is capable of running back to back operations without resetting the interface. After downloading and unzipping the files, append a .bak extension to both avrdude.exe and avrdude.conf in their respective locations and copy the latest revision of both files in C:\Program Files (x86)\Arduino\hardware\tools\avr\bin and C:\Program Files (x86)\Arduino\hardware\tools\avr\etc.
You should now be able to perform all operations in Atmel Studio, Visual Studio and Arduino IDE.
Note : Burning the boot-loader could also be performed from Visual Studio (Menu “Tools” / “Device programming”). Check for board details in the board.txt file from Arduino in order to set the appropriate parameters for the target board.




0 komentar:

Post a Comment

ROBOTIKA :: CONNECTING AVRISP TO ARDUINO