Pages: [1]   Go Down
Author Topic: How to configure the Atmel AVRISP MKii to work with Arduino IDE  (Read 12126 times)
0 Members and 2 Guests are viewing this topic.
Offline Offline
Newbie
*
Karma: 2
Posts: 48
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello all, since I've been helped by so many knowledgeable and generous people here, I wanted to give back a little on what I've learned.  After two days of searching literally hundreds of forums, blogs and spec sheets, I was finally able to get my Atmel AVRISP MKii to work with the Arduino IDE and upload sketches to my breadboarded Mega 328P IC.  I found many threads with tips on doing this and that, but none had all the missing pieces nor helped walk a newcomer through all the little adjustments that had to be made in order to make this happen (at least for a newbie like myself).

So here goes;  For this particular tutorial, I'm using a breadboarded Mega328P with the Atmel AVRISP MKii with Arduino IDE 0023 on a Windows 7 machine. If anyone spots an error, please let me know.

1.  DO NOT install the Atmel AVR Studio software suite.  It installs the "Jungo USB" driver which is not compatible with AVRdude (which the Arduino IDE uses).  You can either use one of the other, not both at the same time.

If by chance you had already installed AVR Studio and the Jungo Drivers, don't worry, I'll show you how to replace it further down.

2.  Download the LibUSB-Win32 driver and extract it somewhere temporary.  It can be found at www.libusb.org, however, for some reason my machine did not like this version, so I found another version that appeared to be tailored specifically for the AVRISP MKii here: http://mightyohm.com/blog/2010/09/avrisp-mkii-libusb-drivers-for-windows-7-vista-x64/

3.  Now if you haven't installed the Jungo USB drivers, then you can simply plug in your AVRISP MKii, but when it asks whether you wish to install the drivers for it automatically or manually, choose MANUAL. If your did like mine and went ahead automatically and installed the stinkin Jungo USB drivers anyway, then you'll need to do the follow:

How to replace the Jungo USB drivers:
A. Go into your Device Manager and expand the tree under "Jungo".  If you see "AVRISP mkII" there, then you'll need to replace that driver with the LibUSB-Win32 driver. Right-Click and select "Update Driver Software" and then choose "Browse my computer for driver software".  Then simply navigate to where you extracted your LibUSB-Win32 drivers and let it do it's thing. If it refuses to replace it or says that Windows deems the current driver the latest, then you'll need to find a better/newer copy of the LibUSB driver.  You can also try uninstalling the Jungo driver first, but my smartass PC kept reinstalling it automatically everytime I plugged the AVRISP MKii back in---regardless of me manually clicking cancel!

4. If the LibUSB-Win32 driver installed correctly, the AVRISP MKii should now appear under "LibUSB-Win32 Devices" instead of the Jungo tree. This is important to make sure of because the Arduino IDE will NOT work with it as long as it appears under Jungo.

5. Now, to get the Mega328p to work with IDE 0023, you'll need to edit the /hardware/boards.txt << within your Arduino install folder and add the following to the very bottom:

###############################################

atmega328bb.name=AVRISP mkII w/ ATmega328
atmega328bb.upload.using=arduino:avrispmkii
atmega328bb.upload.maximum_size=30720
atmega328bb.upload.speed=57600
atmega328bb.bootloader.low_fuses=0xE2
atmega328bb.bootloader.high_fuses=0xDA
atmega328bb.bootloader.extended_fuses=0x05
atmega328bb.bootloader.path=arduino:atmega
atmega328bb.bootloader.file=ATmegaBOOT_168_atmega328_pro_8MHz.hex
atmega328bb.bootloader.unlock_bits=0x3F
atmega328bb.bootloader.lock_bits=0x0F
atmega328bb.build.mcu=atmega328p
atmega328bb.build.f_cpu=8000000L
atmega328bb.build.core=arduino:arduino
atmega328bb.build.variant=standard

###############################################

Keep in mind the above is for the Mega328P (the "P" being the "Pico" version of the chip). You'll need to make some minor adjustments for the non-pico version).

6. Now locate /lib/preferences.txt file and find the line "upload.using=bootloader" and replace it with, "upload.using=avrispmkii" (we're just replacing the bootloader with the avrispmkii)

7. DONE! You're now ready to begin using your new AVRISP MKii!!! When you first open up the Arduino IDE (I'm using 0023) go to Tools > Boards > and you'll see a new entry for "AVRSIP MKII w/ ATMega328" > choose this one if you're that's the chip you're using like I am.  After that, I'd suggest you try out a simple sketch like the Blink LED in the examples folder and make sure it all works.

Some closing tips. If you're hooking up the MKii to your breadboard, be sure you have the cable's pinouts correctly.  I found so much confusing and contradictory pinout information for the AVRISP MKii on the web it was rediculous. It all comes down to locating PIN 1 -- which is always located on the side of the ribbon with the stripe. Now since two pinholes line up with the ribbon stripe, look carefully for a triangle symbol. The triangle will point you to PIN 1, and thereafter you can make out the orientation of all the other pins.

I really hope this helps out other people and saves you all the headaches I had to go through to get this thing working. I swear at one point I was ready to hang the MKii on a post outside and put a bullet through it!

« Last Edit: August 11, 2012, 04:01:33 pm by velocity101 » Logged

JOPIN STUDIOS | Trusted Web Design since 1998 | www.jopin.com

Europe
Offline Offline
Full Member
***
Karma: 0
Posts: 104
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

great work
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16514
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is it also true or not that the Atmel AVRISP MKii will not provide power to the target? I have a USBtiny programmer that does provide such +5vdc power for the target if you have a jumper clip in the correct position, but thought I read that some programmers don't offer that selection option?

Lefty
Logged

Offline Offline
Newbie
*
Karma: 2
Posts: 48
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Is it also true or not that the Atmel AVRISP MKii will not provide power to the target? I have a USBtiny programmer that does provide such +5vdc power for the target if you have a jumper clip in the correct position, but thought I read that some programmers don't offer that selection option?

Lefty


It will not provide power (at least from my experience with a Mega328p on breadboard setup).  I had to hook up an external +5v to the breadboard rails and then hook up the MKii's +5v and GND leads to the +5V & GND rails in order for it to program correctly.  The MKii will power up itself via USB, but I found that it checks to verify you have power to the Chip you're programming.
Logged

JOPIN STUDIOS | Trusted Web Design since 1998 | www.jopin.com

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

great work, but how do you make it work on arduino version 1.0
Logged

San Pedro, CA.
Offline Offline
Full Member
***
Karma: 3
Posts: 147
My head HURTS!!!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@retrolefty

As velocity101 said, it will not provide power. From reading the user guide
Quote
The Atmel AVRISP mkII supports target voltages from 1.8V up to 5.5V.

Note
VCC must be connected to the target board in order to get correct operation and voltages on the ISP/PDI lines. VCC does not draw any power from the target.
In fact, the AVRISP mkII will not detect the target until it (the target) is powered. Also (I can't find the quote right now), I read somewhere in the user manual that the programmer senses the target voltage and adjusts its self by level shifting to the correct voltage. I do know when you enter the programming dialog it displays the current target voltage.

Hope this info helps.

BTW I was here a few days ago and found a thread on how to get the Arduino core to work under Atmel Studio 6. I followed the instructions and it worked! For me anyway. But after messing around a bit, I'm having some minor troubles. So, I need to find that thread (that's what I was doing when I came upon this thread) and follow the steps again. It's really cool  smiley-cool having all those libraries playing nicely with a full featured IDE with debugging capabilities.  smiley-grin

So, I'm off to search...
DigitalJohnson
Logged

DigitalJohnson

0
Offline Offline
Full Member
***
Karma: 4
Posts: 218
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

great work, but how do you make it work on arduino version 1.0
Yes I wondered the same . why not swap to the latest Arduino and configure it for that . How many people still run  V0023  ?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I know this is ancient thread, but i had to register just to thank you for this post. This helped me to recover my arduino mega2560 from forever upload loop that many people experience. I borowed avr isp mk2, followed your instructions, burned new bootloader and now it works. Thanks again, cheers!
Tom
Logged

Montana, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all - The AVRISP MKii is a great device that comes with no directions; I'm trying to use it with Arduino IDE to program an ATTINY85. Velocity101's post is the closest on the web to do this, but I need more instruction particularly in step 5.

I tried the AVR fuse bit calculator http://www.engbedded.com/fusecalc but had not luck. I am using the ATTINY85V-10SU, the summary data sheet is here: http://www.atmel.com/Images/Atmel-2586-AVR-8-bit-Microcontroller-ATtiny25-ATtiny45-ATtiny85_Datasheet-Summary.pdf

I have measured my board supply voltage at 5VDC being supplied to the Vcc pin of the chip. Note this microprocessor runs at 10MHz (not 8MHz as listed in the above fuse bit calculator).

I sure other users would like to use the AVRISP MKii to couple to other ATEML chips, as well. Please provide more instruction on how to get over this fuse bit hurdle.  Thanks!


Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I really really hate to grave dig, but none of this worked for me... If you need to replace the Jungo driver and windows still won't let you although you've uninstalled all of Atmel Studio (like me). It's easy to get it working... Don't fight Jungo, trick it.

1. Navigate to your Windows Directory
2. Go to "System32"
3. Go to "drivers"
4. rename "windrvr6.sys" to "windrvr6.sys.bak"
5. paste in the libusb0.sys file
6. rename it to "windrvr6.sys"
7. The Arduino IDE should be able to find the mkii

To revert just delete the "windrvr6.sys" file, and rename "windrvr6.sys.bak" to "windrvr6.sys"
Logged

Pages: [1]   Go Up
Jump to: