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
- Go to http://sourceforge.net/projects/com0com/ and download 'com0com-3.0.0.0-i386-and-x64-unsigned.zip'
- Download PK2AVRISP.exe (by kcsoft) from http://www.mediafire.com/download/12jmtmynhgw/PK2AVRISP.zip
- Download free BASCOM-AVR from http://www.mcselec.com/index.php?option=com_docman&task=doc_download&gid=139
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:
- Unzip 'com0com-3.0.0.0-i386-and-x64-unsigned.zip'
- Right click on 'setup.exe' and run it as Administrator
- At the step 'Select components to install:', uncheck the last two lines:
CNCA0 <-> CNCB0
COM# <-> COM# - At the Windows Security warning dialogue, allow...
Any possibility of using a signed drivers? Turning off Windows signing is not good for security.
http://freevirtualserialports.com/ is a signed driver, closed source, but $0 "free" software for creating/emulating serial ports under current Windows.