Main menu

Category Archives: Mikrokontroler

Programmer is one of the first things to think of when starting to deal with microcontrollers. Luckily it is not hard to build fully working programmer almost for any microcontroller as there are tons of open source projects around. So I decided to build stk500 compatible programmer which is actually taken from tuxgraphics.com. I decided not to search for same parts as in original schematics but use what’s on desk. As result I got mix of through hole and SMD soldered board that works great.

Short info about STK500 V2 programmer

This programmer is a clone of original AVR STK500 programmer. It works on all main platforms including Windows, Linux, BSD and MacOS X. This is mainly because as USB to serial converter there is a FT232RL chip used with full driver support. Probably main reason to build it is that programmer works in AVRstudio where microcontrollers can be programmed fluently from same IDE. Also it works fine with AVRDude – which would be main application for Linux users. This clone gained quite big popularity so you can find lots of variations – mostly different PCB versions. So mine is yet another one PCB.

STK500 programmer hardware

As I mentioned this is quick build from parts found on shelf, this isn’t best PCB. Because it uses a mix of SMD and through hole parts. Anyway it works as supposed so no problem with that at all. Let’s get in to some details. I found a FT232BL chip that wasn’t used in some earlier project, so I decided to use it instead newer FT232RL. It is pretty same chip but older generation. Additionally you need to use external 6 MHz crystal and couple more components. Drivers are still supported up to Win 7 so it can be still used actively.

Atmega8 is in DIP package which is easier to remove and program with other programmer – which can be a bit problem if building first programmer at all. Ask friends to program chip or use dirty parallel port programmer to flash it.

In this programmer I used an USB miniB SMD Connector that came to my hands. There is also a solder holes left in case you want to solder an USB cable directly. Programmer has 10 pin and 6 pin programmer headers. I usually use 6 pin ISP header, so I made cable only for this one.

Flashing Atmega8

Is I mentioned – you need to program ATmega8 first before use. Latest firmware for it can be found here. And don’t forget to set fuse bits correctly. FYI fuse bits in PopnyProg should be as follows:

Or simply pass them to AVRdude as follows:

Low byte: 0xEE;

High byte: 0xE9.

Running programmer on AVRStudio

When running programmer in AVRStudio, select STK500 platform and COM port which was to USB – serial converter assigned. In my case it is COM5. After clicking Connect… it suggests to upgrade programmer firmware – just skip by pressing Cancel as upgrade function won’t work for it. Next screen you’ll see is a STk500 programming dialog where you can select device and program it.

Just a little note about ISP mode settings! If you are trying to flash new AVR where default 1MHz clock is running, you should select proper ISP frequency as it has to be less than ¼ the target.

To flash 1MHz Atmega you should go with 115.2 kHz while 8MHz will do fine with 1.845 MHz.

Since the output buffer of P1 can sink 20mA (each output pin, but maximum IOL for all outputs was limited at 80mA), thus we can use P1 to drive LED display directly. As shown in the circuit, Two common-anode 7-segment LEDs are connected to P1 with 180 Ohms current limiting resistor. Each segment of two LED are tied in parallel to P1. Q1 and Q2 are activated by logic low of P3.0 and P3.1, sourcing +5V to common anode pins. P3.4 read logic low if either S1 or S2 was pressed while scanning period have made.