How-To: STK500 Clone on Linux

If you need how-tos for making it work on Mac OS, or Windows, see here.

Here is a quick little how to for getting any STK500 Clone to work under most Linux systems. I am not going to be specific to any distro, as this has worked in Ubuntu, Gentoo, Debian, and Arch. I have no reason to believe that it would not work in anything else. All this guide assumes is that you know how to obtain and install packages for your specific distro. Also, if your STK500 Clone has a built in USB to Serial converter you need to figure out how to get that working on your own. Most USB->UART chips are supported in teh kernel by defualt, so be dure to check before you go out on a quest to compile drivers. For instance, the CP2102 on my STK500 clone worked out of the box. I have also heard good things about FTDI’s FT232.

Step 1:Install, Compile, or in any other way obtain the following packages:

  • gcc-avr: A port of the GNU C Compiler to the AVR Architecture
  • avr-libc: AVR Library for stuff like accessing and manipulating registers
  • binutils-avr: Converts the object code into AVR-readable hex files
  • avrdude: The software that actually drives the programmer

I know these are in the Debian, Ubuntu and Arch repositories, so you can just use apt to get them. I don’t know about any other distros, as I needed the latest version of GCC-AVR, so I compiled it from source.

Step 2: I use the following makefile for my development, so I do not need to type in a long cryptic code. You will need to modify it to suite your needs, such as changing the target AVR and main target file name. You should be able to just download it and point it to your avr and target file without any further configuration. I distrobute it under the terms of the GNU Public License Agreement.

Step 3: To compile and download the code all you need is the makefile in your project directory with the correct AVR and target file set. THen cd into that directory from terminal and type “make”. You should see an output similar to below:

>make
/usr/bin/avrdude -c avrispv2 -p m32 -P /dev/ttyUSB0 -e

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9502
avrdude: erasing chip

avrdude done. Thank you.

/usr/bin/avrdude -c avrispv2 -p m32 -P /dev/ttyUSB0 -U flash:w:main.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9502
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file “main.hex”
avrdude: input file main.hex auto detected as Intel Hex
avrdude: writing flash (5054 bytes):

Writing | ################################################## | 100% 1.91s

avrdude: 5054 bytes of flash written
avrdude: verifying flash memory against main.hex:
avrdude: load data flash data from input file main.hex:
avrdude: input file main.hex auto detected as Intel Hex
avrdude: input file main.hex contains 5054 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 1.63s

avrdude: verifying …
avrdude: 5054 bytes of flash verified

avrdude done. Thank you.

>Exit code: 0


If you see an output similar to this make sure you have the makefile set to the right serial port, and that the programmer is indeed plugged in:

>make
/usr/bin/avrdude -c avrispv2 -p m32 -P /dev/ttyUSB0 -e
avrdude: ser_open(): can’t open device “/dev/ttyUSB0”: No such file or directory
make: *** [program] Error 1
>Exit code: 2

.If your text editor supports a makefile shortcut like Scite or Eclipse, then as long as the makefile is in your working directory you can use that shortcut to download to the AVR,

If you have any further questions or problems please do not ask me, as I do not have the time to answer them. Look no further then AVRfreaks. It is a very active community waiting to help you over every bump you may find on your path to all AVR knowledge.

No comments yet

Leave a comment