Introduction
When I started this blog I meant to do so mainly in order to document my own projects. I found that when I wanted to re-use parts of one of my projects I sometimes couldn't remember why I had made certain decisions. So I needed to document my work. And if anyone else could benefit from it, why not publish all in a blog?
But I never intended to bore anybody with my opinions on anything. This post is an exception, because I think I came across someone's project (or product) I really like. It is open source, so you don't have to buy anything. Also, I won't post any links to a store, etc.
How I flash my Firmware on 8-bit Atmel Controllers
I made my first steps in the old days, when PCs used to have a serial port. And my first programmer was a ponyprog serial programmer. It worked well, but some time later I decided to buy the STK500 from Atmel. This allowed me to use all existing programming modes and to directly flash from the AVR Studio. For a very long time, this was my main development tool. And it still sits on my desk. But it has disadvantages. It isn't really mobile. It needs a mains power supply. And nowadays you need a USB-to-serial converter to connect it.
I sometimes write programs on my netbook. So the way to go these days is to use a USB based programmer. There are lots on offer. But I found one that suits my needs really well. It is based on the USBasp project. This is an open source USB programmer, which is small and simple. It gets powered and controlled by the USB port. It uses standard components (e.g. an ATmega8), so you can build it yourself. A piece of perf board will do, really. Although various optimised layouts are available for download, if you want to make a PCB. Kits are available, too.
But what really surprised me was the fact that some Chinese companies manufacture USBasp compatible hardware. They are sold through the well known channels. And you can get them for almost no money. I bought two different devices for under 3 € each. And this includes shipping!
I don't know how they can sell them at such a low price. As an end user I would pay more than 4 € for the components, let alone shipping. This was an offer I could not resist, so I ordered two different versions, apparently from different manufacturers.
The Hardware
And this is what I got after waiting for a couple of weeks:
(bottom view)
Both programmers are about the size of a standard USB memory stick, but with an ISP connector at the end. Both came with a standard 10-pin ISP cable. The upper device in these pictures is apparently from a manufacturer called LCSoft Studio, the lower device by a manufacturer called betemcu.
Both work and both work well, but there are a few differences and details worth mentioning.
Differences
I do prefer the LCSoft version. And here is the reason why: It sticks closer to the original USBasp schematic and it is more flexible. What do I mean by that? Firstly, both designs include a low-drop 3,3 Volts regulator. This is not part of the original USBasp design, but can be found in various improved versions of the schematic. The main advantage is that you can power your target device through the ISP cable and you can use the programming interface at the right voltage levels.
But the betemcu part has a resistor to select the Voltage. I believe that you have to remove it in order to switch to 3.3 Volt operation.
What you can not do however is to disable the power supply. This can be inconvenient or even destructive, if the power pin on the target's ISP connector is already connected to a power supply.
The LCSoft part has a three-way jumper, so you can easily choose between 3.3 / 5 Volt operation and you can disconnect the power pin.
See the detail here:
The Voltage jumper is marked in orange. But this version has two more jumpers. They were not actually populated, but this is easy to do. Jumper two is marked green in my photo. It connects the ATmega8's reset pin to the ISP header. What is this good for? Actually, this is quite clever. All ISP header pins are connected to the controller (MISO, MOSI, SCK and optionally: RESET). So it is possible to re-program the firmware on the programmer itself by using a second programmer.
The third jumper (marked red) is really obsolete. It was used in earlier versions of the firmware to reduce the programming speed in case your target systems speed was below 1.5 MHz. In newer versions this is controlled by software.
A minor flaw of the LCSoft ISP cable can be seen in the picture above. By convention, the ribbon cable's pin 1 should be marked red. This is the other way round in the cable I got. But electrically, everything is fine. Be careful though, if the header on your target board is not keyed!
Reprogramming the betemcu part is also possible. However there is no jumper, but a solder bridge. Again, here is a photo:
You needn't necessarily solder a wire across those contacts. I held a piece of wire in place during programming. That worked just as well. But I do prefer the LCSoft solution with a proper jumper.
One final difference is that the LCSoft part actually connects the ATmega's UART lines (TX/RX) to pin 4 and pin 6 of the ISP header. This was done in the USBasp project for future extensions (like debugging). On the betemcu device, those pins are connected to GND.
So from a hardware point of view alone I would recommend the LCSoft variant of the programmer.
Perhaps it is worth mentioning that both programmers have a fuse on the power supply line, but I doubt that would save your motherboard if really try something stupid. And both parts have the projects two status LEDs.
In part 2 I will take a look at the available software options for this programmer.
hey sir
ReplyDeletei am new with microcontrollers.
i have developed some gud programs for led blinking ,lfr, hex keyapad but my basics seems to be weak..
so i wanna know what is this stk500.
its there on net that stk500 kit n all
also what are diff types of programmers and whats the diff??? like usb asp usb isp n all
Hey,
ReplyDeleteThe STK500 is a starter/evaluation kit by Atmel.
See http://www.atmel.com/tools/STK500.aspx
For the AVRISP, see
http://www.atmel.com/tools/AVRISPMKII.aspx also by Atmel.
USB ASP is a third party project.
Hallo Sir,
ReplyDeleteI also baught the betemcu version of the programmer.
And now I have minimum 1 big problem.
When stick in the device into the USB, there happens nothing.
In the so called driver software I found a film, where is opened a window for the divice by itself, when sticking in the usb. So not in my case......
Do you have an idea, what could be the problem?
Thanks!
Best Regards
Steven
P.S.:
ReplyDeleteAfter sticking in Windows reports:
device not identified
device not found
Seems to be a driver problem....?
How can I solve?
Many thanks again!
Steven
Steve, I would agree that there seems to be a driver problem. Did you install the driver?
ReplyDeleteAlso, check out the driver's homepage: http://sourceforge.net/projects/libusb-win32/
Hi,
ReplyDeleteI have problem with my lcsoft programmer.
I couldn't flash attiny84 with it.
avrdude complained that chip is not responding.
the tiny itself is perfect, i've flashed it many times with arduino. i've checked wires and everything 100 times with no luck. I decided to try updating firmware (using arduino as isp) to the latest from fischl.de (usbasp.2011-05-28.tar.gz atmega8) and now when i plug it into usb i get "device malfunctioning" and the led does not lit. when i try to reprogram it, avrdude says that signature is 00000000. if i -F it does something(i see the flashing progress) but this does not change anything. when i first flashed i did not specified any fuses. in the end avrdude said that both fuses got 0 value and asked if i want to try to restore them. i said yes. it hanged for some seconds and said "restore failed, sorry".
is there any chance to revive it or it is permanently dead now? :)
iTake,
Deleteit is hard to tell, what went wrong. But it is possible that your controller isn't accessible via ISP anymore. It sounds like you messed up the fuse settings.
In some cases recovery is possible.
Just google "avr fuses recover"
I found
http://www.logikdev.com/2011/02/15/reset-clock-fuse-bits-on-avr/
Also, if you have access to a parallel programmer, like the STK500, resetting the fuses is no problem.
In general, if the programmer can't read the device signature bytes, you should look for the problems and avoid any programming.
Good luck!
I have an ancient STK500 (2005 vintage) that I used to use when I had parallel and serial ports. Can I use a usbasp programmer and its 10-pin cable to plug into the STK500's 10-pin ISP port, thereby programming a chip in the STK500's socket? I'd like to use the STK500's breadboard capability (the LEDs, pushbuttons, etc.) Also, I see 6-pin to 10-pin adapters advertised for use with the STK500 - why are these needed? The STK500 has both 6-pin and 10-pin ISP ports. Tx!
ReplyDeleteI think, it is possible to connect a USBasp to the STK500 - as long as you keep the onboard ISP disconnected. But why not use the onboard ISP? Oh, and don't forget to disconnect Vcc on the USBasp.
DeleteAs for the 6pin/10pin, it is just a matter of what your target system uses. You really only need 6 pins. But for some reason, most systems use the 10pin connector. So this is what these cheap programmers use.
The STK500's ISP doesn't have a USB interface: that's why I'm interested to know if I can use the USBasp. And as far as I can tell, it has a 10-pin to 6-pin converter. Then you use a 6-pin to 6-pin cable to one of three connectors (red, blue or green) to match whichever socket your target device is plugged into.
ReplyDeleteOh, I see. I think you have two possibilities:
DeleteA) Use a USB-to-serial connector. I am not entirely sure but I think this works. I can try if you are interested.
B) Buy a passive 10-pin to 6-pin converter. Again, if that is your preferred option, I could test it.
In my opinion, A) is better, because the STK500 programmer is a very good piece of kit. Not only can you change operating voltage and clock frequency, but you can also use HV parallel programming. This is important to reset clock fuses for example.
Is it possible to use the betemcu in AVR-Studio?
ReplyDeleteNot in its original state. Do read part 2 for more about the issue.
DeleteDo you have a link to the schematic LCsoft version with the 3.3V regulator shown?
ReplyDeleteYes: http://www.yourportablelab.com/downloads/schematics/USBASP2_SCH.pdf
DeleteThanks for the schematic link. I have ordered two of the LCsoft 2.0 versions to test. Having the TX and RX on the 10 pin IDC connector of the LCsoft version is definitely a plus.
ReplyDelete>> One final difference is that the LCSoft part actually connects the ATmega's UART lines (TX/RX) to pin 4 and pin 6 of the ISP header.
ReplyDeleteCan I still use Pin 4 as a ground?
It wouldn't destroy the programmer. The USBasp project doesn't use that pin. It might some day be used as output, but there is a 1 kOhm resistor to prevent damage.
DeleteAnyway, the pin is not connected to GND on the programmer, so you need another GND pin in addition.
i bought a betemcu version programmer as you have shown above but i can't seem to get it working....probably due to driver issue...please help.
ReplyDeletethanks
aditya
Why do you think it is a driver issue?
Deletesorry..for being late.....i got the programmer through my friend...and he did not bring its drivers..and said that i will find it on net...but till now i couldn't get it working...i am trying to install it windows 8 and still no luck...
DeleteHi Adiya,
Deleteno problem. Did you read my blog post on "How to Do ISP Programming – Part 3: Software Usage" ? I have a short description on where to get the driver and how to install it. If you need more details, please let me know and I will add them. I can confirm that I installed the very same drivers on Windows8 and that they work.
sorry sir.. is this usbisp support for BASCOM AVR too?
ReplyDeleteUnfortunately I don't know which programmers are supported by BASCOM directly.In fact, I have never used BASCOM.
DeleteBut at least it should be possible to create standard .hex files in BASCOM. These could then be written to the controller with several other programs (like AVRdude, etc.).
can u please send me schematic for lc-soft usbasp
ReplyDelete