7 April 2012

A USB/ISP Programmer (Part 2)

Programming Software for the USBasp

There are several interesting options, how to use the USBasp programmer. The LCSoft variant was sold with the option to download a program called ProgISP V1.72 from the vendors site. Also, a schematic was available as well as the drivers for Windows. Installation was no problem. I found no user manual in English, but usage of the software is fairly straight forward.



The USBasp project itself is supported in avrdude, a command line tool for programming. It runs under Windows, MacOs and Linux. There are several front-ends available for avrdude. So software support is good.

I didn't find a way though to integrate avrdude in the AVR studio. And that would have been nice. If you try things on your target system, it is a bit cumbersome to change windows, press the right buttons and switch windows again. With the STK500, once all is set up you just press the write button in AVR studio and you are done. And this is, where another cool project comes in...

The USB AVR Lab

It seems the project's documentation is only available in German. But the PC software can be set to English. The project uses quite a clever concept. On the programmer, there is a USB boot loader. So you can start up the PC software and load a bunch of different applications on the programmer.

But first I have to report a minor drawback. This project uses a somewhat different hardware. Fortunately, all the important parts are identical. So, no problems with crystal oscillator, USB interface and ISP interface. But the status LEDs are on a different set of port pins. Also this project has got some additional hardware. One is an additional input, which is connected to the otherwise unused pin 3 of the ISP header. The other is a voltage divider to measure the selected operating voltage.

So, you use a second programmer to write the boot loader on the USB programmer...



...and then you start the PC software and select, which application you want to write on the programmer. Note that I disconnected the target supply line of the programmer via jumper. I am not sure, but it may well be that the linear regulator on the "receiving end" gets destroyed otherwise. And I set the reset jumper (J2). The programmer, which is written to gets supplied through a cheap emergency USB charger. Using the USB AVR Lab with its own boot loader, you will later not need to set J2 and of course you don't need the second programmer, because reprogramming happens through the USB interface

Here is the list of available applications:
  • AVRISPmkII 
  • STK500v2 
  • OpenOCD (alpha)
  • JTAGICEmkII (beta) - Note: additional pin 3 needed!
  • USBasp (for AVRdude support)
  • Clock generator (to re-set the fuses an an AVR chip)
  • and more
This is what I am using at the moment. I selected the AVRISPmkII and now I can simply use the AVR studio with its integrated programming software. That is the perfect solution for me. Unfortunately, the project is not open source, and it seems not to be in active development. So I might need to go back to the USBasp solution in future, if new processors show up that are not supported (e.g. TPI support).


Bottom Line
Buy this programmer! Search for "usb isp programmer" at your favourite auction house (...) and buy one, or better still, buy two. You could use this thing even as a prototyping platform, if you can live with the small amount of pins. The USB AVR Lab has even support for this in the shape of a template project. In this case, you don't even need a programmer. After all, it is only three Euros.

And here is my small scale AVR development system: A 10" netbook running WindowsXP with an AVR ISP mkII clone and a small target PCB. Cute!


10 comments:

  1. THis is a great little bit of hardware, thanks to your post I found a bit more about it.

    It seems unfortunate to me that there are 3 or 4 ADC pins simply not connected to anything. With a few digital pins and a couple of analog, this little board can be a substitute for a full arduino board or a custom project in very many situations.

    Just one question, you say that "One is an additional input, which is connected to the otherwise unused pin 3 of the ISP header."
    Which pin is this? It's not in the circuit diagram. Is it another digital pin, hopefully one of the "spare" ADCs?

    ReplyDelete
  2. I fully agree with you. It would be great to have an additional header with access to a few more pins.

    Regarding your question. Perhaps my post is a bit confusing. What I meant to say was: The USB AVR Lab has its own schematic, in which an additional controller port is connected to pin 3.

    But both programmers that I have follow the pin-out of the USBasp project, so unfortunately on both pin 3 is not connected. Sorry.

    As it is you are stuck with MISO/MOSI/SCK (PB3/PB4/PB5), TX/RX (PD0/PD1 - LCSoft version only!). All are digital only. But there is the jumper 3 on the LCSoft variety. It is the "SlowClock header" and it is connected to PC2 (ADC2). So you have one ADC port.

    And finally, if you wanted, you could also remove the two status LEDs, which would give you access to PC0 and PC1 (ADC0/1).

    ReplyDelete
  3. Thanks Tom,
    Yes as you say there is an ADC on the slowclock header which is very handy. For more pins it's time to break out the soldering iron and a very steady hand.

    Also I think you could make use of pin 5 (RESET) on the 10-pin socket, which I don't think you need once you have the USB AVR Lab firmware installed, although it might interfere if you want to flash a new bootloader. It's just another digital pin, PB2.

    Not bad for a $4 board.

    ReplyDelete
  4. Tom, I am not very technically oriented, but I have used a USBasp to flash new firmware onto Atmega chips that are used on various quadcopter hardware I use. I have never changed the firmware on the USBasp itself.

    However, there is a guy who has written a program that can be programmed into an arduino then it can be used to flash SiLabs chips. I guess it is kind of a translator. Excuse my ignorance about these things.

    Anyway, it would be really cool if I could use a USBasp as a tool to flash both kind of chips. I am pretty sure it can be done by programming the flash on one USBasp with another one, but that requires two of them.

    It would be even cooler if I had one USBasp with it own bootloader and could swap out the firmware to either flash Atmega or SiLabs chips. Do you think this is possible?

    I have purchased two of these http://www.ebay.com/itm/160719113471?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649

    Can one be used to program the other with a bootloader, then be used stand alone to change its own flash?

    I hope this makes sense. Any help is appreciated.

    ReplyDelete
    Replies
    1. Britt, very interesting idea.

      But there are a couple of things to take into consideration here. Quick answer: it should be possible, but it isn't that simple.

      First of all, take a look at the hardware. The Arduino uses a dedicated USB-to-serial chip to communicate with the PC.

      The USBasp on the other hand uses software to do this (V-USB by obdev). So the SiLABs programmer firmware would have to be modified for that. (B.T.W. is this the silprog software by OlliW?)

      Also, there is the bootloader to take into consideration. So I think that the firmware would have to be completely rewritten.

      But the USBasp hardware would be definitely capable to program SiLABs chips.

      Perhaps you can get OlliW interested? It might not be too dificult for him to do.

      To be honest, I see no point to use the bootloader feature of USB AVR Lab to swap Atmel/Silab programmer software, since you can buy the hardware for about 3-4 €/USD.

      Delete
  5. Hi, the USB AVR Lab project IS open source. Read http://www.mikrocontroller.net/topic/234004 about the sources. Sourceforge has killed this project, not the author.

    ReplyDelete
    Replies
    1. Thanks for clearing that up. I have to have a look. I am dreaming of a USBasp AVR Lab fusion project, which uses cheap USBasp hardware from china with the USB AVR Lab software.

      Delete
  6. Tom
    i use the ProgISP V1.72 to program MCU but when i strart to erase MUC it said "Chip Enable Program Error" Question is,what i need to do next. thanks

    ps. i use USBasp with a J2 jumper

    ReplyDelete
    Replies
    1. Ton, you definitely have to remove the J2 jumper. It connects the RESET line of the ISP programmer to the programmers own controller. So instead of resetting the ATMega8L, which you are trying to write to, it will reset the programmer itself.

      The jumper is only needed when re-programming the programmer itself. Normally, you don't need to use this.

      Delete