Program the opensensor in Linux

Thanks to Rasmus Jacobsen from Aalborg University for this howto.


Howto program OpenSensor v3 using PICkit2 with firmware >= 2


Makefile can be downloaded here makefile

The following was performed with PICKit firmware version 2.10.0

First: Be sure that you are a member of the usb group. Otherwise nothing will work.

For ubuntu: you need build-essential and libusb-dev.

Then download pk2cmd for linux from (check for newer version).
Untar the file and modify cmd_app.cpp.
Go to line 151 and set the string PIC to nothing, e.g. substitute
_TCHAR partString[MAX_PATH] = "PIC";
_TCHAR partString[MAX_PATH] = "";

Modify Makefile.
Uncomment line 39 if you are using Linux 2.6.x

Compile using make.

Now pk2cmd is ready to run!

To install pk2cmd copy
pk2cmd and PK2DeviceFile.dat to /usr/local/bin

To erase/clear the device
./pk2cmd -pdsPIC30F3013 -erase
check that it was erased
./pk2cmd -pdsPIC30F3013 -clear

To program the device type
./pk2cmd -pdsPIC30F3013 -M -Fthe_file_to_program.hex

Department of Electronic Systems | Aalborg University | Niels Jernes Vej 12 | DK-9220 Aalborg | Denmark
Phone: (+45) 9635 8695 | Fax (+45) 9815 1583 | E-mail ies(at)
Copyright © 2006 Department of Electronic Systems

Last update:07-07-2008