Make your own AVRISP-MKII!

Go To Last Post
35 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Freaks,

My latest and greatest side-project is now complete - that is, it's now usable. I've developed the firmware to turn any Atmel USB AVR into an AVRISP-MKII. That's right, native USB!

What is it?

An AVRISP-MKII, obviously. Actually, it's a clone, but using entirely open source firmware rather than just ripping of Atmel's binaries from a real AVRISP-MKII.

Why AVRISP-MKII over AVR910 or other protocols?

Using the official AVRISP-MKII protocol means the programmer will integrate with AVRStudio seamlessly and exposes more features than the simpler AVR910 or similar counterparts.

Why AVRISP-MKII and not an AVRISP-MKI?

The AVRISP-MKII uses native USB drivers, and since I've written the code for my LUFA USB stack, it seemed like the logical thing to do. With later extensions, the native USB will allow for even better features than the real AVRISP-MKII, such as alternate modes of operation (e.g. USB-to-Serial, USB-to-SPI/I2C converter, bitbanger).

The AVRISP-MKII protocol is slightly better than the original's in that it requires less packet massaging and has more features like short-circuit and reversed-connector warnings. Unfortunately, neither of these are currently in the firmware, but I'll add them in the future. PDI and TPI programming is supported in addition to ISP programming.

What's the benefit?

Cheaper, if you go for the bare-bones approach or build it entirely yourself. Free if you've already got a USB AVR board around and want to re-use it as a second programmer.

Many people also are starting out with cheap ~$20 USB AVR boards, and want to try out other AVRs later. This gives their initial purpose some extra value outside its use as a general development board.

In the future, new firmware updates will give added functionality to the device. Adventurous programmers could also hack the firmware themselves to add features that they desire.

Caveats?

Since you build it yourself, you make it as cheap as you like. The simplest form would be something like the $20 Teensy, AVROpendous or Bumble-B boards, with no extra circuitry. Adding level converters, etc. would obviously add to the cost of the unit.

Currently, ISP programming modes below 125KHz aren't supported, since I'm using the hardware SPI unit at this time. In theory, it can program with a SCK frequency of up to 4MHz for a USB AVR running at 8MHz, or 8MHz for a USB AVR running at 16MHz.

As mentioned above, currently there's no short circuit or reversed target detection, so be careful when hooking it up.

If used on an AVR with no ADC subsystem, VTARGET detection is disabled and the device will always report 5V.

How do I build it?

First, you need to download the latest LUFA package from here, and edit the Projects/AVRISP-MKII/ directory makefile to suit your chosen USB AVR target. In the makefile, you can set the pins used for VTARGET detection and target RESET. Build the project by running a "make all" from the command line.

Program the HEX file into your chosen USB AVR. For this you can use another programmer that you have, or you can load it with Atmel's FLIP software via the USB bootloader which comes preloaded into every USB AVR.

See the AVRISP-MKII project's text file for target connection information. Ideally, you should build the project documentation using Doxygen, but it's still readable in its unprocessed form.

Feedback Appreciated

This is a first revision project, and is only a very minor part of my much larger LUFA USB stack for the USB AVRs. From the next official release, this side-project will be included to show off a practical application built with the library.

Please give feedback here, so I can improve the code!

EDIT: Outdated HEX file removed - please download latest LUFA source code here for latest source.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

Last Edited: Fri. Jan 22, 2010 - 06:22 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

abcminiuser wrote:
This package contains an in-development version of my LUFA stack, which is NOT FIT FOR USE outside of this project.
Is there a reason for using a potentially
flaky version instead of a release version?
Would replacing the included version with
a release version result in code that works?

International Theophysical Year seems to have been forgotten..
Anyone remember the song Jukebox Band?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Is there a reason for using a potentially
flaky version instead of a release version?
Would replacing the included version with
a release version result in code that works?

Well, it shouldn't be flaky in the parts I'm using for the AVRISP project -- the changed areas affect other portions of the library which haven't been fully tested yet. From the next official release in a few weeks the project will be a part of the normal download package, and the library will be fit for general use.

You can replace it with the latest release version, however you will need to copy over the Endpoint_SetEndpointDirection() macro from LUFA/Drivers/USB/LowLevel/Endpoint.h.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Another nice Deanski product !
Congratulations with this "baby" :!:

Nard

A GIF is worth a thousend words   She is called Rosa, lives at Mint17.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Plons wrote:
Another nice Deanski product !
Congratulations with this "baby" :!:

Nard

A simple one (heck, a week-long project is nothing to crow about) but a useful one. Lots of people have USBKEYs sitting around collecting dust, or one of the myriad of new USB AVR development boards which they bought to have an easy start with AVRs without having to build their own programmers. This gives the boards a second use, as an AVR-Studio integrated programmer.

Eventually I'll add in extra functionality modes, so that the one device can be used as a USB-to-USART converter, SPI sniffer, I2C sniffer, etc.

Does anyone have any ideas on how to implement reversed target or short circuit detection cheaply?

EDIT: Removed outdated source package - please download the latest source from http://www.fourwalledcubicle.com...

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

Last Edited: Fri. Jan 22, 2010 - 06:23 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

abcminiuser wrote:
Does anyone have any ideas on how to implement reversed target or short circuit detection cheaply?

For reversed target, check if MISO is always 0 and RST is 1.

Felipe Maimon

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

An update to the project -- the latest code can now be found in the latest LUFA distribution: http://www.fourwalledcubicle.com... under the Projects/AVRISP directory. This will be where future code updates will be released, including (when I have the time to implement it) alternate modes of operation line USB-to-Serial.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Eventually I'll add in extra functionality modes, so that the one device can be used as a USB-to-USART converter, SPI sniffer, I2C sniffer, etc.

Sounds like you're going in the same direction as the "Bus Pirate" but with an AVR chip.

http://dangerousprototypes.com/c...

http://hackaday.com/the-bus-pira...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dean thanks for your great job. but currently my 2$ DIY stk200 solves my programming issues. all of us wants Jtag ICE MKII so we can debug and program our xmegas too.

I love Digital
and you who involved in it!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can debug the Xmegas with Dragons too.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've had a look at the JTAG-MKII, but from what I understand there are crucial portions of it that Atmel haven't released. I've no idea if that's true or not, but it would require an enourmous amount of work, and if I'm not certain I'll get anywhere with it I don't really want to spend the hours (I've already been burned by MS's SideShow USB stuff).

That said, I'll be adding PDI programming support soon to match the new capabilities of the official AVRISP-MKII.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
You can debug the Xmegas with Dragons too.

dose it support pdi programming and debugging! some xmegas only support pdi.

I love Digital
and you who involved in it!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I just thought I'd update this thread, by saying that the latest version now does PDI programming, and TPI programming (for the 6-pin TINY AVRs) is on its way. I've created a new project page on my site for the clone programmer:

http://fourwalledcubicle.com/AVR...

However the actual code is still in the LUFA release packages available from:

http://fourwalledcubicle.com/LUF...

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

what is TPI.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

what is TPI.

It's a brand new programming protocol that Atmel have invented purely for use with the Tiny10 (not the original, the one released last year). If you don't plan to use the Tiny10 (or one of the derivatives due to appear this year) you can forget TPI all together.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

why attiny10 have four I/O pins spi neds only four pins too.
why make a new intrface.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

why make a new intrface.

Ask Atmel - I guess it's a way to sell STK600's (the official way to program TPI)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Ask Atmel - I guess it's a way to sell STK600's (the official way to program TPI)

The AVRISP-MKII is now officially a TPI programmer also (with the Dragon following soon) -- the only restriction is that it won't be able to supply the 12V needed when the /RESET functionality is disabled.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

dam google translation it deleted my text when i did edit this.

Last Edited: Sun. Jan 17, 2010 - 09:57 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Uh - I just ran that through Google Translate. Those with sensitive ears (eyes?) probably shouldn't.

Guarra: this should work out significantly cheaper than the AVRISP-MKII (once I've tested TPI functionality), if you make the programmer yourself -- or, if you have some sort of USB AVR lying around already, it would be free.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Vad i hela helvete
That's probaly "what the hell is up with the Swiss?"

It would be nice to know where gurra95 hails from.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

it's swedish.
i'm from sweden.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"Vad i hela helvete" means crap.

Last Edited: Fri. Jan 8, 2010 - 11:34 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

it means "dammit"

Why on earth do you insist in posting in Swedish (that about 3 people here understand) when your grasp of English actually seems very good. If you want to make comments or get help then please try to do so in English on this English speaking forum.

Cliff (moderator)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i'm going to try this circit on my xmega thats
i have orderd instead of buy a new mkll.
sorry for the swedish problems with google translation.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i have a queston pdi looks simular to PS2 does the interface have any simularis or is the only they have simular pins (data,clock).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It's completely, 100% different -- after all, most interfaces have a DATA and CLOCK pin. It's the protocol that separates them.

At the physical layer, PDI/TPI programming uses half duplex synchronous USART encoded data.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I love the idea of an inexpensive programmer. I mean fancy programmers are great when you want to do fancy stuff, but for most hobby types like myself. Cheaper is better. I will be looking forward to TPI availability as I wouldn't mind using the new 6 pin chips for a few projects i have.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The TPI code is in the latest SVN revision, but I'm waiting on some TINY10 samples so I can test it. I can pretty much guarantee that it won't work at all until I debug it with real hardware, but you're welcome to try it out.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thanks for the explain of the pdi.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

abcminiuser wrote:
Guarra: this should work out significantly cheaper than the AVRISP-MKII (once I've tested TPI functionality), if you make the programmer yourself -- or, if you have some sort of USB AVR lying around already, it would be free.

- Dean :twisted:


If someone builds one of those programmers ... please blog the effort & link it here.

Dean,
I appreciate your contributions here, and made a $10 donation on your site (ie. Dean's 'retirement fund') ;)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks mcuaust! I was going to link to my donation fund in the original post, but thought it a bit tacky to do so. However, interested parties will find a link on my site where the download links are now located.

I've gone ahead and removed the ancient packages from here, since the code in the latest LUFA release is much newer and better (with the code in the latest SVN even better than that).

I'm waiting on some sample TINY10 microcontrollers and a custom programmer board using my firmware from a member on the #avr IRC channel of Freenode - I'll post about them when they arrive.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dean,
LUFA is used in "Programming AVRs With A BumbleB" at http://fletchtronics.net/programming-avrs-bumbleb

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It sure is - I've been working closely with Dave from Fletchtronics (who is a big proponent of LUFA) to get it all working for his boards. Fun stuff!

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Awesome, jut got TPI programming working flawlessly. That means the latest SVN LUFA version's AVRISP-MKII project now does ISP (AVR8), PDI (XMEGA) and TPI (6-Pin AVR8)!

The updated code will be in the next LUFA release, scheduled for the 19th.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!