Using PICkit2 with pk2cmd (v. 1.20) in piKdev - Problem

472 views
Skip to first unread message

Nick Agianniotis

unread,
Jul 15, 2009, 5:28:11 AM7/15/09
to pickit-devel
Hi all!

I am trying to configure piKdev (the latest version) and pk2cmd (v.
1.20), so that I can use my PICkit2 programmer at my linux machine
(running Mandriva 2009.1). The programmer is working perfectly under
Windows OS.

While I am able to run pk2cmd as a root and operate PICkit2 normally
(read/erase/write program memory etc.), this is not possible through
the piKdev application.

More specifically, I have set the path to the pk2cmd correctly in the
piKdev Global Settings and I have chosen the pk2cmd (>=1.20) option
from the drop-down menu in the programmer configuration.

However, when I open the Programmer window, I cannot interact with my
PIC. No operation is working and I always get a message that no device
is detected (I have also manually configured the type of PIC that I
use). So, I assume that there is problem in the communication. Either
the USB port cannot be accessed or the pk2cmd needs more options to be
set, in order to work properly.

Can anybody give me a hint about this? Can it be only a matter of
permissions, or something else is wrong?

Thanks in advance!

Xiaofan Chen

unread,
Jul 16, 2009, 2:58:55 AM7/16/09
to pickit...@googlegroups.com
On Wed, Jul 15, 2009 at 5:28 PM, Nick Agianniotis<nick...@gmail.com> wrote:

> While I am able to run pk2cmd as a root and operate PICkit2 normally
> (read/erase/write program memory etc.), this is not possible through
> the piKdev application.

So pk2cmd is working. Have you try to run pikdev as root to
see if that works?

It is better you try to set up udev rules so that you do not
need to run pk2cmd as root.

You can try the udev rules here.
http://piklab.wiki.sourceforge.net/USB+Port+Problems

> More specifically, I have set the path to the pk2cmd correctly in the
> piKdev Global Settings and I have chosen the pk2cmd (>=1.20) option
> from the drop-down menu in the programmer configuration.
>
> However, when I open the Programmer window, I cannot interact with my
> PIC. No operation is working and I always get a message that no device
> is detected (I have also manually configured the type of PIC that I
> use). So, I assume that there is problem in the communication. Either
> the USB port cannot be accessed or the pk2cmd needs more options to be
> set, in order to work properly.
>
> Can anybody give me a hint about this? Can it be only a matter of
> permissions, or something else is wrong?
>

I do not use Pikdev but you can try my suggestion above. For pikdev
specific problem, the author should be able to help you. I think he is
a list member.

--
Xiaofan http://mcuee.blogspot.com

Wilhem

unread,
Jul 16, 2009, 3:40:17 AM7/16/09
to pickit...@googlegroups.com
Hallo Nick,
                  I'm not really a fan of Pikdev, but I want to help you and other guys to "support" PIC & Linux (I'm a biiiiiigg fan of Linux (Debian)).
Please, have  a look to Pikdev site. In the index page states:

"Pikdev V1.0.0 supported a modified version of pk2cmd (still available on my download page). "

I think you schould forget downloading and installing pk2cmd from microchip site ( I mean the official version), but u have to download the modified version from here: http://pikdev.free.fr/download.php3 and download this file: pk2cmd-pikdev V1.10     Special version of Microchip pk2cmd for pikdev V1.0

Let us know what is going on.

Hope that helped you :)

Bye!

Dave
--
Wilhem

Nick Agianniotis

unread,
Jul 16, 2009, 5:16:11 AM7/16/09
to pickit-devel
First of all, thank you both for your reply!

@Xiaofan :

I think that the wrong permissions for the USB port is the most
possible reason for my problem. I will try today to set the udev rules
and run the pk2cmd as a normal user. I will let you know about this!
However, I think that it is not possible to run pikdev under root. I'm
not really sure about that, though. I will check this, too.

@ Wilhem :
I think that what you say about the "modified version of the pk2cmd"
is valid for the pikdev v.1.0.0 only. As it says one line below, since
pikdev v.1.1.0 the "official" version of the pik2cmd 1.20 from
Microchip is supported, too! However, because I am also fan of Linux
and do not want to switch back to Windows only for programming my
PICs, I am really interested to what you are personally using. Of
course there is always the solution of MPLAB through wine. However, I
would like to try a more linux-based solution (pikdev and the gputils
tools in general)


Wilhem wrote:
> Hallo Nick,
> I'm not really a fan of Pikdev, but I want to help you and
> other guys to "support" PIC & Linux (I'm a biiiiiigg fan of Linux (Debian)).
> Please, have a look to Pikdev site. In the index page states:
>
> "Pikdev V1.0.0 supported a *modified version of pk2cmd *(still available on

Wilhem

unread,
Jul 16, 2009, 7:38:59 AM7/16/09
to pickit...@googlegroups.com
Hi Nick,
             I didn't realize you donwloaded tha latest version of Pikdev. U are right, there should be any problem running it with the latest pk2cmd version.
Check your Usb rights and let us know.
I don't know Mandriva, never used it. Pesonally I installed on my laptop the latest Debian 5.0.2 Lenny amd64, but I switched definately since 3 years to debian only. Pk2cmd compiled on it works wonderfulllllllllllll, but I don't like Pikdev (even if it is a very good sfotware!!!), I prefer Piklab, because: contains gpsim for simulation (very good for few micros but useful), allow me to use sdcc compiler for C project, and then has lots of useful things like: the register view (You don't need the deatasheet anymore for register bank positions...) and its toolchain is really huge.
Pikdev looks nicer and more supported, but many thing I don't like.

Keep in mind that I usually need to simulate my micros, so I installed the latest version of virtualbox and I emulate winxp on it. It works really good even through usb, and alllows me to burn pic directly via MPLAB.
I know, it's a shame, but it is not possible to have  an integrated IDE on linux yet. I would give support to gpsim but it seems to be not more supported.

Let us know what's going on!

Bye!
--
Wilhem

Jeff Post

unread,
Jul 16, 2009, 9:33:38 AM7/16/09
to pickit...@googlegroups.com
On Thursday 16 July 2009 04:38, Wilhem wrote:
>
> but it is not possible to have an integrated IDE on
> linux yet
>
It's possible, but it's a massive amount of work. It would have to been done
either by someone who's getting paid to do it, or by collaboration of a large
number of people who can each commit some free time.

Personally, I'd love to do it, but I've got bills to pay.

Jeff

Wilhem

unread,
Jul 16, 2009, 2:15:25 PM7/16/09
to pickit...@googlegroups.com
Jeff has right,
                   this work takes so much resources and require specify attention.
To me, negative factors are: some developers spread their resources thoruh many different programs and projects (very close each other (see Piklab and Pikdev) ) named forks, the insensibility of Microchip for the opensource community.
Even a IDE develop requires too much and linux doesn't offer the same prerspectives as microsoft, why don't allow the community to take benefits of open protocolls (between SOs and development board, for istance ICDx) and open projects?
I 'm really thinking to abandon PIC in favor of AVR, still an annoying question, but the lack of software for linux is still too evident.
I don't know what's behind their political and economical views, but I strongly hope that the linux community will be well rrespected and considered in the immediate future.

Sorry for the boring post.

Nick, what#s going on?

Dave
--
Wilhem

Nick Agianniotis

unread,
Jul 16, 2009, 3:04:36 PM7/16/09
to pickit...@googlegroups.com
Hallo again!

Well, I am back home from the office and just tried some things at my PC. Actually, I realized that I can perfectly run pk2cmd as a simple user (obviously, the udev rules had been set by default during installation to the right options).

Unfortunately, I do not have now any more solutions in mind. Thus, I will probably turn to Piklab! It seems to be really good (as far as I have seen at a glance). And I hope that I can use it! I can also create the .hex file in MPLAB (in wine) and then write the PIC with the pk2cmd. No matter what it takes, I will not turn to Windows!! ;-)

Anyway, thanks a lot for your willing to help!

Jeff and Wilhem, about what you said regarding the IDE development : I also think that such a project would be time consuming. However, I do believe that such things usually hang up, due to lack of initiave. I mean, someone has to make the start and then more will probably follow! Personally I am pretty new in the field to do something like that now, but I would be willing to help.

Anyway...that is all from me now!
--
Nikolaos Agianniotis
Electrical and Computer Engineer
Graduate of National Technical University of Athens

Wilhem

unread,
Jul 16, 2009, 3:18:18 PM7/16/09
to pickit...@googlegroups.com
Hi Nick,
           could be a problem specifically for your distribution (Mandriva) who doesn't reconginze the right path to pk2cmd.
By the way, you could give another try by installing pkp (pikdev from command line) from command line and see what happens.
Or switch to Piklab (but if you want to use the IDE to burn your pics u must downgrade the version of your PICKit to version 1.xx). The latter is a stupid solution I think, so the best (what I usually do) is to write your program in Piklab and form the integrated konsole give the command pk2cmd -<command>
Its very fast and very pratical... hope this help

Bye!
--
Wilhem

Nick Agianniotis

unread,
Jul 16, 2009, 3:29:53 PM7/16/09
to pickit...@googlegroups.com
Yeah, this can always be the case. I may try another (more "standard") distro, like Debian. Just to check what is going on!

Thanks a lot for your advice Wilhem!
Bye!


On Thu, Jul 16, 2009 at 10:18 PM, Wilhem <pav...@gmail.com> wrote:
Hi Nick,
           could be a problem specifically for your distribution (Mandriva) who doesn't reconginze the right path to pk2cmd.
By the way, you could give another try by installing pkp (pikdev from command line) from command line and see what happens.
Or switch to Piklab (but if you want to use the IDE to burn your pics u must downgrade the version of your PICKit to version 1.xx). The latter is a stupid solution I think, so the best (what I usually do) is to write your program in Piklab and form the integrated konsole give the command pk2cmd -<command>
Its very fast and very pratical... hope this help

Bye!



Alain Gibaud

unread,
Jul 16, 2009, 6:40:58 PM7/16/09
to pickit...@googlegroups.com

That's true Xiaofan !
But since I was not at home yesterday, I was not able to respond

From my experience, 100% of problems with pikdev and pk2cmd come
from a defective installation of pk2cmd.
In fact, 100% means it has been true 3 times, for 3 persons who sent me an
email about a similar problem.

I personally build pk2cmd from sources, and I use the install option of the
makefile.

For persons who prefer to install from precompiled pk2cmd, here is the
procedure which mimics the behavior of the install option.

1) got to the directory which contains the pk2cmd executable , then su root
2)
mkdir -p /usr/share/pk2
cp pk2cmd /usr/local/bin
chmod u+s /usr/local/bin/pk2cmd
cp PK2DeviceFile.dat /usr/share/pk2/PK2DeviceFile.dat

3) go back to user mode

pk2cmd should work from CLI and from pikdev.

It works perfectly on my debian unstable, and also under Ubuntu 9.04
(tested by a person who had the same problem).
However, since I am not an USB guru, I cannot guarantee it will solve your
problem.

Alain

Alain Gibaud

unread,
Jul 16, 2009, 6:56:23 PM7/16/09
to pickit...@googlegroups.com
Le Thursday 16 July 2009 20:15:25 Wilhem, vous avez écrit :
> Jeff has right,
> this work takes so much resources and require specify
> attention.

The main problem is that is is impossible for a little group of persons
(wich can be reduced to 1 person !!) to follow new products. This is why
the pic emulators are restricted to a very small number of devices.

> To me, negative factors are: some developers spread their resources thoruh
> many different programs and projects (very close each other (see Piklab and
> Pikdev) )

I agree on this point. Ask Nicolas Hadacek why he have decided to fork pikdev
without any proposition of collaboration. Sadly, we are are both french, so
the communication could have been be technically easy.


Alain

Wilhem

unread,
Jul 16, 2009, 7:15:30 PM7/16/09
to pickit...@googlegroups.com
Ask Nicolas Hadacek why he have decided to fork pikdev
without any proposition of collaboration. Sadly, we are are both french, so
the communication could have been be technically easy.


Ohhhh!!!!!!!!! I thought that YOU left the main "branch" and pikdev was a fork from Piklab.
EHehhe it seem I misunderstood.

Anyaway, there is a specific reason? From my point of view Piklab seems well supported than Pikdev (but it's just my impression)
Anyway it's a pity...

I'm not a strong programmer, I was looking through the net about support for gpsim (To me the biggest lack for a IDE develop on Linux).

Ok, bye!

 
 
On Fri, Jul 17, 2009 at 12:56 AM, Alain Gibaud <alain....@free.fr> wrote:

Le Thursday 16 July 2009 20:15:25 Wilhem, vous avez écrit :
> Jeff has right,
>                    this work takes so much resources and require specify
> attention.

The main problem is that is is impossible for a little group of persons
(wich can be reduced to 1 person !!) to follow  new products. This is why
the pic emulators are restricted to a very small number of devices.

> To me, negative factors are: some developers spread their resources thoruh
> many different programs and projects (very close each other (see Piklab and
> Pikdev) )

I agree on this point.

Alain



--
Wilhem

Nick Agianniotis

unread,
Jul 16, 2009, 7:23:01 PM7/16/09
to pickit...@googlegroups.com
Well, as I said before, I am going to test pikdev and pk2cmd at another distro (Debian or Ubuntu) and see if I can make it work. Maybe it is something wrong with Mandriva (although this wouldn't make much sense).

Nevertheless, I also prefer to build applications from sources and this is what I have done this time with pk2cmd, too. I think, it would be good to un-install and then build again the pk2cmd sources, just in case something wrong has happened there.

Xiaofan Chen

unread,
Jul 17, 2009, 12:50:25 AM7/17/09
to pickit...@googlegroups.com
On Fri, Jul 17, 2009 at 3:04 AM, Nick Agianniotis<nick...@gmail.com> wrote:
> Well, I am back home from the office and just tried some things at my PC.
> Actually, I realized that I can perfectly run pk2cmd as a simple user
> (obviously, the udev rules had been set by default during installation to
> the right options).

Ok, this rules out usb permission problem.

> Unfortunately, I do not have now any more solutions in mind. Thus, I will
> probably turn to Piklab! It seems to be really good (as far as I have seen
> at a glance). And I hope that I can use it! I can also create the .hex file
> in MPLAB (in wine) and then write the PIC with the pk2cmd. No matter what it
> takes, I will not turn to Windows!! ;-)

Piklab does not support pk2cmd. In fact, it does not support PICKit 2
firmware version 2. It only supports the old PICkit 2 firmware version 1.

Piklab has many functionality beyond Pikdev. But in terms of PICkit 2
support, it is a pity that Piklab still does not support PICKit 2.
http://piklab.sourceforge.net/


--
Xiaofan http://mcuee.blogspot.com

Jeff Post

unread,
Jul 17, 2009, 2:07:07 AM7/17/09
to pickit...@googlegroups.com
On Thursday 16 July 2009 11:15, Wilhem wrote:
>
> To me, negative factors are: ... the insensibility of Microchip for the
> opensource community.

Actually, Microchip is far more receptive to the open source community than
most companies. That's why I was willing to collaborate with them. I *never*
would do such work for Microsoft. I think Microchip is owed a well-deserved
thank you for being so open and supportive of third party software. It shows
a very enlightened attitude that is far too rare in American corporations. It
also shows that they are focused on their customers' needs, not on gouging
customers for every nickel they could get. The world would be a far better
place if most companies where like that.


> Even a IDE develop requires too much and linux doesn't offer the same
> prerspectives as microsoft,
>

That's because Windows is a mono-culture, whereas Linux has many different
distributions that differ in various ways. Choice is a Good Thing.

I've given some thought to developing an IDE and I think QT version 3 would be
the best choice for a GUI toolkit. Unfortunately I lack the time to persue it
further, but I'd like to help anyone who does. Anyone interested?

Jeff

(Totally off-topic comment: If you can't write cross-platform code, you
shouldn't write code.)

Alain Gibaud

unread,
Jul 17, 2009, 3:39:13 AM7/17/09
to pickit...@googlegroups.com
Le Friday 17 July 2009 01:15:30 Wilhem, vous avez écrit :
> > Ask Nicolas Hadacek why he have decided to fork pikdev
> > without any proposition of collaboration. Sadly, we are are both french,
> > so the communication could have been be technically easy.
>
> Ohhhh!!!!!!!!! I thought that YOU left the main "branch" and pikdev was a
> fork from Piklab.
> EHehhe it seem I misunderstood. [?]

See dates, copyright and contributors list.

>
> Anyaway, there is a specific reason? From my point of view Piklab seems
> well supported than Pikdev (but it's just my impression)

I have stopped the development of important features after the fork for two
reasons: The first one is I was not pleased by this fork, but the most
important one is the development of my C compiler for pic18 devices (cpik).
However, since cpik is now perfectly usable, a pikdev 1.2 will be available
soon (I have to package it) with improved support of C language.

But the key problem is I do not have enough time to do all I wish to do.

Alain

Alain Gibaud

unread,
Jul 17, 2009, 3:41:45 AM7/17/09
to pickit...@googlegroups.com
Le Friday 17 July 2009 01:23:01 Nick Agianniotis, vous avez écrit :
> Well, as I said before, I am going to test pikdev and pk2cmd at another
> distro (Debian or Ubuntu) and see if I can make it work. Maybe it is
> something wrong with Mandriva (although this wouldn't make much sense).
>

I am pretty sure it can works on ANY recent distribution .

> Nevertheless, I also prefer to build applications from sources and this is
> what I have done this time with pk2cmd, too. I think, it would be good to
> un-install and then build again the pk2cmd sources, just in case something
> wrong has happened there.

OK, let know us the results.

Alain

Nick Agianniotis

unread,
Jul 17, 2009, 4:00:07 AM7/17/09
to pickit...@googlegroups.com
On Fri, Jul 17, 2009 at 7:50 AM, Xiaofan Chen <xiao...@gmail.com> wrote:
Ok, this rules out usb permission problem.


Exactly...

I think that I will make a fresh installation of both pk2cmd and pikdev, just in case I have done something wrong during the current installation.



Piklab does not support pk2cmd. In fact, it does not support PICKit 2
firmware version 2. It only supports the old PICkit 2 firmware version 1.

Piklab has many functionality beyond Pikdev. But in terms of PICkit 2
support, it is a pity that Piklab still does not support PICKit 2.
http://piklab.sourceforge.net/

Yeah, unfortunately I have realized this while trying to use piklab and it is really a pity.

Anyway, I do not have neither difficulties nor problems to use the command line tools. I just wanted to see what possibilities are given by the existing IDE tools, since I have just started using the PIC microcontrollers and I usually use Linux at home.

Xiaofan Chen

unread,
Jul 17, 2009, 4:17:49 AM7/17/09
to pickit...@googlegroups.com
On Fri, Jul 17, 2009 at 3:39 PM, Alain Gibaud<alain....@free.fr> wrote:
>
> Le Friday 17 July 2009 01:15:30 Wilhem, vous avez écrit :
>> > Ask Nicolas Hadacek why he have decided to fork pikdev
>> > without any proposition of collaboration. Sadly, we are are both french,
>> > so the communication could have been be technically easy.
>>
>> Ohhhh!!!!!!!!! I thought that YOU left the main "branch" and pikdev was a
>> fork from Piklab.
>> EHehhe it seem I misunderstood. [?]
>
> See dates, copyright and contributors list.
>

You are right. Actually Nicolas list you as the author as well.
http://piklab.sourceforge.net/devel.php

I am listed as a contributor since I did a lot of tests for Piklab. But
to be honest, I have not really used Piklab since early 2008. That was
when the development of Piklab slowed down by a lot. We were trying
to support PICKit 2 version 2 firmware in December 2007 together
with Hector Martin.

>> Anyaway, there is a specific reason? From my point of view Piklab seems
>> well supported than Pikdev (but it's just my impression)
>
> I have stopped the development of important features after the fork for two
> reasons: The first one is I was not pleased by this fork,

I am not so sure what happened at the time of the fork. But I think
this happens quite often in the open source world.

> but the most
> important one is the development of my C compiler for pic18 devices (cpik).
> However, since cpik is now perfectly usable, a pikdev 1.2 will be available
> soon (I have to package it) with improved support of C language.

Glad to know that.

> But the key problem is I do not have enough time to do all I wish to do.
>

I think that is the major issue for every one. We all have bills to pay
and better things to do in life. ;-)

The development of Piklab has also significantly slowed down since
Nicolas has a new job and does not have much time on the project.

It is much better if there are a team of developers, testers and
a vibrant user community. Unfortunately it is not so easy for
project like Pikdev and Piklab.

Right now I put my main attention at ARM MCUs and OpenOCD
projects. Again I am not a coder but I can help on quite some
issues like testing and documentation side. Being OS neutral,
I can help on both Linux and Windows.
http://openocd.berlios.de/web/
https://lists.berlios.de/pipermail/openocd-development/2009-July/thread.html

--
Xiaofan http://mcuee.blogspot.com

Jeff Post

unread,
Jul 17, 2009, 10:30:55 AM7/17/09
to pickit...@googlegroups.com
On Friday 17 July 2009 00:39, Alain Gibaud wrote:
>
> but the most
> important one is the development of my C compiler for pic18 devices (cpik).
> However, since cpik is now perfectly usable, a pikdev 1.2 will be available
> soon (I have to package it) with improved support of C language.

Yay!

>
> But the key problem is I do not have enough time to do all I wish to do.
>

Trust me, I know the feeling :-)

Jeff

Wilhem

unread,
Jul 17, 2009, 5:25:03 PM7/17/09
to pickit...@googlegroups.com
(Totally off-topic comment: If you can't write cross-platform code, you
shouldn't write code.)

If you mean me Jeff, no...I'm not able to develop nor write cross platform code.
I have knowledge of C++ and C (and PIC assembler) but it was not subject in my study at the university.
I studied C and assembler on my own and I had a C++ course during my University studies.

I know, for such tasks (I mean sim or IDE develop) a more deeper knowledge and practice on languages.

I could help maybe in testing or something like that.
For this reason I would like to help writing code, but as you suggest I'm not able to do that.

Anyway I strongly hope to more sensibility to the open source world or...at least...to more support.
Many companies release software for different SOs, why it couldn't happen to the microcontroller field? We are not speaking about cooking or crochet hook works, everything around "electronics" should be more flexible and innovative.

Ok.

See you all
Bye!


 
--
Wilhem

Jeff Post

unread,
Jul 17, 2009, 8:05:06 PM7/17/09
to pickit...@googlegroups.com
On Friday 17 July 2009 14:25, Wilhem wrote:
> > (Totally off-topic comment: If you can't write cross-platform code, you
> > shouldn't write code.)
>
> If you mean me Jeff, no...I'm not able to develop nor write cross platform
> code.
>
Nope, I didn't mean anyone in particular. Just a general observation. I've
found in a quarter century of development that those who can write cross
platform code almost always have a better grasp of good code design.

And not to rag on anyone in particular, but it seems that way too many who can
write code only for Windows have some really bizarre ideas about software. I
suspect that's because Microsoft provides tools that make it easy for script
kiddies to "write code".

If you want someone who can produce Really Good Code, get someone who can
write a compiler :-)

Jeff

Reply all
Reply to author
Forward
0 new messages