I’ve been using the Microchip PICkit2 development programmer for a long time now, under Windows and Linux :), it’s a very good piece of hardware and I think the recommended companion for hobby PIC micro controller developers.
These days I had to install the software for Ubuntu Lucid (32 bits) at work, and I think I’ll list the required steps to have it working so that I don’t forget them ;), and maybe it can be of help.
- Download pk2cmd source code for Linux/Mac OS X (it’s a command line application), you can get the code from the official PICkit2 page under the Linux and Mac OS X Software section at the bottom of the page or using this link: pk2cmdv1.20LinuxMacSource.tar.gz
- Uncompress the file and cd to the directory
$ tar xzvf pk2cmdv1.20LinuxMacSource.tar.gz $ cd pk2cmdv1.20LinuxMacSource
- Make sure you have libusb development files:
$ sudo aptitude install libusb-dev
- Build the application for linux (this is for Linux kernels 2.6, for older kernels and/other systems (FreeBSD, Mac) check the ReadmeMakefile.txt file.)
$ make linux
- Make install as root
$ sudo make install
- The device definitions file is copied to /usr/share/pk2/ directory, in order to be able to access it this directory should be in your path. To add it, edit your .bashrc file (in your home directory) and add these lines at the beginning:
PATH=$PATH:/usr/share/pk2/ export PATH
- Test your installation:
$ pk2cmd -?v
If PICkit2 is not present (plugged in), you get:
Executable Version: 1.20.00 Device File Version: 1.55.00 OS Firmware Version: PICkit 2 not found Operation Succeeded
If PICkit is plugged:
Executable Version: 1.20.00 Device File Version: 1.55.00 OS Firmware Version: 2.32.00 Operation Succeeded
For instructions on how to use pk2cmd execute it using the -?h parameter. As an example, if you want to program a sample.hex file to a pic16f84a you’d execute:
$ pk2cmd -ppic16f84a -fsample.hex -m
The output would be
PICkit 2 Program Report 3-7-2010, 9:55:24 Device Type: PIC16F84A Program Succeeded.
That’s it. If you get an error message indicating that PK2DeviceFile.dat file can not be found, confirm whether /usr/share/pk2/ directory is in your path.
I have worked successfully with several micro controllers (12F508, 12F629, 12F683, 16F84, 16F628, 16F88, 18F2550 and 18F4550), under Ubuntu 32 and 64 bits without any major problem (sometime ago I read about some issues working under Ubuntu 64 bits, but I tried and didn’t find any).