Summary.
I'm documenting with a video how I upgraded device firmware using a PIC programmer (generic Chinese PICKit 2). pic.twitter.com/bYD1ZnFOny
— The Mike Kasprzak⢠(@mikekasprzak) January 26, 2016
The PICkit connector is 6 pins, but the last pin is the Auxiliary pin.

This pin doesn’t seem to be used that often. The setup could be simplified by snipping the 6th pin.
https://www.kickstarter.com/projects/1897710270/digirule-the-interactive-binary-ruler/posts/1444571
http://www.bradsprojects.com/the-digirule/
After looking in to it, it seems the PICkit 2 is discontinued.
http://www.microchip.com/Developmenttools/ProductDetails.aspx?PartNO=DV164121
There isn’t even a download link there for the software.
I found the source code a rather backwards way. The link is here:
http://ww1.microchip.com/downloads/en/DeviceDoc/PICkit2_PK2CMD_WIN32_SourceV1-21_RC1.zip
A newer device file is here (just overwrite):
http://www.microchip.com/forums/download.axd?file=0;749972
I discovered it by grabbing this package, opening the PKGBUILD file. As it turns out, they still have the files on their website, they’re just not linked publicly.
I’m not entirely convinced this is the latest version, but it is what I found.
Build like so.
1 2 3 4 5 6 7 8 9 10 |
sudo apt-get install libusb-dev libusb-1.0-0-dev libudev-dev cd pk2cmd cd pk2cmd make linux cp pk2cmd ../release # we need to be alongside PK2DeviceFile.dat cd ../release # running as root is required, or you wont see the device sudo ./pk2cmd -?v |
That should output this:
1 2 3 4 5 6 |
Executable Version: 1.21.00 Device File Version: 1.61.00 OS Firmware Version: 2.32.00 Operation Succeeded |
You can then program a hex file. Before you start, figure out the PIC chip you’re programming, the name of your hex file, and adjust this accordingly.
1 |
sudo ./pk2cmd -PPIC18F43K20 -M -F DigiRule\ 18F43K20\ Modified\ 15\ Dec\ 2015.HEX |
References:
http://hsblog.mexchip.com/en/2010/07/how-to-use-the-pickit2-programmer-under-linux/
http://curuxa.org/en/Program_PICs_with_a_PICkit2_using_the_command_line_on_Linux
http://www.waveguide.se/?article=programming-pics-using-the-pickit2-and-pk2cmd
http://askubuntu.com/questions/434948/install-archlinux-package-pk2cmd-plus-on-ubuntu-12-04-64bit