How it works

In a normal data flow, when we have the physical STK500 programmer board, the microcontroller code (firmware) produced by the compiler is sent to STK500 software. The STK500 software will produce ISP commands for the STK500 board, and will transmit those commands through physical serial port COM1, to the STK500 board. Based on the received ISP commands, the STK500 board will produce the MISO/MOSI/CLK pulses required to program the Atmel microcontroller.

In order to use a PICkit instead of a STK500 board, we will hijack the ISP commands. We will trick the STK500 software to send the ISP commands to our virtual COM3 port instead of the real COM1 port.

From the virtual port COM3, the ISP commands will travel through a virtual cable inside of the com0com software, and will arrive to virtual COM4.

At the virtual COM4 we will connect another software, PK2AVRISP, which is in fact an ISP commands translator. PK2AVRISP will translate the STK500 ISP commands into PICkit commands. From here, the PICkit commands will travel through a real USB port, and the commands will arrive to PICkit 2.

PICkit will execute these translated commands into MOSI/MISO/CLK pulses necessary to program our Atmel microcontroller.

Download software components

Install downloaded software

1. Install BASCOM-AVR

BASCOM-AVR is an IDE that allows to write programs in BASIC language and compile them for AVR microcontrollers like ATtiny13, ATmega8, MEGA328 (last two also used in Arduino boards) and other Atmel MCUs. BASCOM-AVR is a copyrighted commercial program created by MCS Electronics company. MCS Electronics offer a free BASCOM-AVR Demo version for hobby, educational and noncommercial use. This version is limited to less then 4K of compiled code. Usually, 4k is enough for noncommercial use. If you need more, you can buy the unlimited version.

Unzip downloaded file 'bcavrdmo.zip', then run 'setupdemo.exe'. Follow the installer instructions

2. Unzip PK2AVRISP.zip

PK2AVRISP is a program that will intercept the ISP programming commands destined to STK500 AVR programmer, and will translate them into commands for PICkit programmer. This way, we can later use an PICkit 2 programmer instead of a STK500 programmer. PK2AVRISP is free (but not open), and it was written by kcsoft.

Just extract the 'PK2AVRISP.exe' from the 'PK2AVRISP.zip', it does not need an installation.

3. Install com0com

com0com is an open source software that can create pairs of virtual COM ports linked together, written by vfrolov (Vyacheslav Frolov). com0com will be used to redirect all ISP commands from the IDE to the PK2AVRISP.exe translator.

To install com0com is a little tricky, because the virtual COM ports drivers are not digitally signed for Windows. com0com can be used without problems with Windows XP, but for newest Windows flavors, like Windows 7, we need to disable the digital signature enforcement for drivers. The most easy way to do this is by restarting Windows and boot into disabled enforcement mode.

Restart your computer, and during the computer restart continuously pump the F8 key until you arrive to the following boot screen:


Using Up and Down keyboard arrows, highlight the entry "Disable Driver Signature Enforcement", then press Enter to boot into disabled enforcement mode.

This mode will stay active only until the next Windows restart. Please remember to boot into this mode each time you need to use com0com.

Now we can start installing com0com:

Software and Hardware Setup

1. Create the virtual COM paired ports

By now, you should have a pair of virtual serial ports, COM3 and COM4, linked together with a virtual serial cable. To test them, open two terminals (e.g. two instances of PuTTY) and connect one to COM3 and the other to COM4. What you type in COM3 should be seen in COM4 and vice-versa. Connection speed and other handshake parameters of the serial communication doesn't matter for this two virtual ports. You can now close both terminals (both PuTTY instances), this was just to test that com0com was proper installed and setup.

There is also a GUI setup, you can start it from Start -> All Programs -> com0com -> Setup. My setup is looking like this:

2. Setup BASCOM-AVR to use STK500 and virtual COM3

3. Setup PK2AVRISP.exe

You can minimize it, but DO NOT CLOSE PK2AVRISP.exe


4. Connect the PICkit 2 programmer to an Atmel microcontrolle

Images from kcsoft


5. Program it

Create a new BASCOM-AVR project and write a small Blink program (in this example I used ATtiny13 MCU):

Press F7 to compile, then F4 to download the code into microcontroller. In the programmer window, identify your chip.

Now, the ATtiny13 microcontroller was identified:

Press "Erase and program chip"

If you powered your MCU from the PICkit, power your MCU by pressing VDD on button, in order to see the LEDs blinking.

3D Printing AVR Arduino Art Audio Automation BeagleBone Bluetooth Cameras Clock Drones Environment Hardware IoT LED Medical Music Radio Raspberry Pi Remote Control Robotics Rockets Satellites Science Security Software Virtual Reality Wearables