Friday, April 17, 2009

PICkit 2 under Arch Linux with pk2cmd

Now that Microchip released pk2cmd source codes for Windows, Linux and Mac OS X, things become very easy to get PICkit 2 to work under Linux. I just tried it under Arch Linux and it works very well.

Source code download: http://www.microchip.com/pickit2 (now it is of version V1.20)

It is recommended that you build the binary by yourself since the released binary may not work for certain Linux distributions. You need to have gcc and libusb installed to build the source. Just type "make linux" and you will get the binary. For me I prefer to copy pk2cmd and PK2DeviceFile.dat to my ~/bin directory. You can also put them to places like /usr/local/bin.

In order to run pk2cmd as normal user, then you need to write the udev rules as following. You can use the following page. I've added the section for Arch Linux.
http://piklab.wiki.sourceforge.net/USB+Port+Problems

[mcuee@myhost rules.d]$ cd
[mcuee@myhost ~]$ cat /etc/udev/rules.d/26-microchip.rules
#PICKit 1
ATTR{idVendor}=="04d8", ATTR{idProduct}=="0032", OWNER:="root", GROUP:="microchip",MODE:="0660"
#PICKit 2
ATTR{idVendor}=="04d8", ATTR{idProduct}=="0033", OWNER:="root", GROUP:="microchip",MODE:="0660"
#ICD2
ATTR{idVendor}=="04d8", ATTR{idProduct}=="8000", OWNER:="root", GROUP:="microchip",MODE:="0660"
#ICD21
ATTR{idVendor}=="04d8", ATTR{idProduct}=="8001", OWNER:="root", GROUP:="microchip",MODE:="0660"
#PICDEM FS USB Bootloader
ATTR{idVendor}=="04d8", ATTR{idProduct}=="000b", OWNER:="root", GROUP:="microchip",MODE:="0660"

[mcuee@myhost ~]$ groups mcuee
lp wheel network video audio optical storage hal camera fuse microchip users

[mcuee@myhost ~]$ pk2cmd -PPIC16F690 -I
Device ID = 1400
Revision = 0003
Device Name = PIC16F690

Operation Succeeded

1 comment:

solarwind said...

Oh, snap! This reminds me - I almost forgot, I finished the first release of my gui. I'll send it to you via email/post it on piclist soon.