No PICKit 2 found on linux

955 views
Skip to first unread message

grokakin

unread,
Mar 30, 2009, 9:24:04 AM3/30/09
to pickit-devel
Hi,
I am using a Pic Kit 2 clone, that works on Windows and that I would
like to use as well on linux .
I am using a PC with Ubuntu Gutsy .

I ckecked through the Gnome menu : System->Harware information , that
the PIC Kit 2 appears , and it does as :

PicKit 2 Microcontroller Programmer

When I type as root:
pk2cmd -V

The answer is :

No PICKit 2 found

How can I solve that ?

Thanks for your help,
Cédric

Xiaofan Chen

unread,
Mar 30, 2009, 10:47:39 AM3/30/09
to pickit...@googlegroups.com

Firstly try to use "sudo".

If that works, then you can set up udev rules so that you do not need
to use sudo.

Reference:
http://piklab.wiki.sourceforge.net/USB+Port+Problems
http://mcuee.blogspot.com/2008/04/pk2cmd-linux-port-under-ubuntu.html

Regards,
Xiaofan

grokakin

unread,
Mar 31, 2009, 7:40:56 AM3/31/09
to pickit-devel
Thanks for your help Xiaofan ,

I tried sudo pk2cmd -P
and I still get the same error :

No PICkit 2 found.

I got the same error with pk2cmd logged as root .

Here is what I get typing lsusb :

Bus 002 Device 001: ID 0000:0000
Bus 001 Device 003: ID 046d:c505 Logitech, Inc. Cordless Mouse
+Keyboard Receiver
Bus 001 Device 004: ID 04d8:0033 Microchip Technology, Inc.
Bus 001 Device 002: ID 05e3:0608 Genesys Logic, Inc.
Bus 001 Device 001: ID 0000:0000

The PICKit2 is linked to a hub and I had the same problem with PICKit2
directly linked to the USB port .

Thanks for your help


On 30 mar, 16:47, Xiaofan Chen <xiaof...@gmail.com> wrote:

Jeff Post

unread,
Mar 31, 2009, 11:40:37 AM3/31/09
to pickit...@googlegroups.com
On Tuesday 31 March 2009 04:40, grokakin wrote:
> Thanks for your help Xiaofan ,
>
> I tried sudo pk2cmd -P
> and I still get the same error :
>
> No PICkit 2 found.
>
> I got the same error with pk2cmd logged as root .
>
> Here is what I get typing lsusb :
>
> Bus 002 Device 001: ID 0000:0000
> Bus 001 Device 003: ID 046d:c505 Logitech, Inc. Cordless Mouse
> +Keyboard Receiver
> Bus 001 Device 004: ID 04d8:0033 Microchip Technology, Inc.
> Bus 001 Device 002: ID 05e3:0608 Genesys Logic, Inc.
> Bus 001 Device 001: ID 0000:0000
>
> The PICKit2 is linked to a hub and I had the same problem with PICKit2
> directly linked to the USB port .
>
In the file pk2usb.h, change #define USB_DEBUG_FLAGS to
#define USB_DEBUG_FLAGS USB_DEBUG_FULL
then recompile and let's see what's going on on the USB bus.

If that doesn't turn up anything interesting, change it to USB_DEBUG_MAX and
the USB driver will provide addtional information.

Jeff

grokakin

unread,
Mar 31, 2009, 6:22:50 PM3/31/09
to pickit-devel
Hi Jeff,

What do I should recompile ?

Actually, I typed as root slocate -u to update from / the slocate file
database and slocate did'nt find any file named pk2usb.h .

Anyway , with the PICKit2 linked to the PC directly through the USB
port, without any hub plugged, I get the same problem .

What are the files I should download and compile with these
modifications on pk2usb.h ?

I am using pk2cmd version 1.20.00 and Device file version is 1.55.00

Thanks for your help,
Cédric


Jeff Post

unread,
Mar 31, 2009, 11:44:58 PM3/31/09
to pickit...@googlegroups.com
On Tuesday 31 March 2009 15:22, grokakin wrote:
> Hi Jeff,
>
> What do I should recompile ?
>
> Actually, I typed as root slocate -u to update from / the slocate file
> database and slocate did'nt find any file named pk2usb.h .
>
> Anyway , with the PICKit2 linked to the PC directly through the USB
> port, without any hub plugged, I get the same problem .
>
> What are the files I should download and compile with these
> modifications on pk2usb.h ?
>
> I am using pk2cmd version 1.20.00 and Device file version is 1.55.00
>
You need to download the Linux/Mac source code, not just the binary zip file.
When unzipped, the source code will include everything you need to build the
binary. In the source directory just type "make linux" (after modifying the
pk2usb.h file).

Jeff

Xiaofan Chen

unread,
Apr 1, 2009, 1:10:05 AM4/1/09
to pickit...@googlegroups.com
On Tue, Mar 31, 2009 at 7:40 PM, grokakin <cedric...@tele2.fr> wrote:
>
> Thanks for your help Xiaofan ,
>
> I tried sudo pk2cmd -P
> and I still get the same error :
>
> No PICkit 2 found.
>
What is the kernel version you are using? Do you have
CONFIG_USB_SUSPEND enabled in the kernel? If yes then
that might be a problem (lsusb can see PICkit 2 but libusb based
pk2cmd can not see PICkit 2).

I suspect you are suffering this problem as you are
using Ubuntu 7.10 (Gutsy), I think the problem is similar to
the problem I saw in 7.04 (Feisty).
http://www.microchip.com/forums/tm.aspx?m=275422&mpage=2

Kernel version between 2.6.20 and 2.6.22 are both
suffering from this problem. 2.6.23 onwards should be ok.

Possible Solutions:
1) If you have not done it, try update to the latest kernel of 7.10.
2) If 1) fails, rebuild the kernel and disable CONFIG_USB_SUSPEND
3) Ubuntu 7.10 is no longer supported. Maybe you want to consider
upgrading. 8.04 LTS is good and has long support. 8.10 is also
not bad. 9.04 is coming.


Regards,
Xiaofan

Xiaofan Chen

unread,
Apr 1, 2009, 1:17:41 AM4/1/09
to pickit...@googlegroups.com

I remember I have no problems with pk2cmd under
Ubuntu 6.06 and 7.10 last time.
http://mcuee.blogspot.com/search/label/PICKit
So you should still try Jeff's suggestion. Maybe there are
some other things going on here.

Now I am running Ubuntu 8.04 and 8.10 (along with
Fedora 10) and no long has the old versions to test.

Regards,
Xiaofan

grokakin

unread,
Apr 1, 2009, 5:11:00 PM4/1/09
to pickit-devel
Hi ,
Actually I would prefer to keep my good old os :-) ...

Well, I downloaded the sources of pk2cmdv1.20 and modified pk2usb.h.
I modified also the makefile and added -I. in the following lines :

ifeq ($(TARGET),linux)
CFLAGS=$(OPTS) -I$(LIBUSB)/include -I. -DLINUX -DUSE_DETACH -
DCLAIM_USB
endif

as I got gcc telling that usb.h was missing .

Then from the directory I typed make linux .
And unfortunately there is an error :



root@lachez-moi:/home/cedric/electronique/programmation-pic/microchip/
pk2cmdv1.20LinuxMacSource# make linux
make TARGET=linux
make[1]: entrant dans le répertoire « /home/cedric/electronique/
programmation-pic/microchip/pk2cmdv1.20LinuxMacSource »
g++ -Wall -D_GNU_SOURCE -O2 -I/usr/local/include -I. -DLINUX -
DUSE_DETACH -DCLAIM_USB -o cmd_app.o -c cmd_app.cpp
g++ -Wall -D_GNU_SOURCE -O2 -I/usr/local/include -I. -DLINUX -
DUSE_DETACH -DCLAIM_USB -o DeviceData.o -c DeviceData.cpp
g++ -Wall -D_GNU_SOURCE -O2 -I/usr/local/include -I. -DLINUX -
DUSE_DETACH -DCLAIM_USB -o DeviceFile.o -c DeviceFile.cpp
g++ -Wall -D_GNU_SOURCE -O2 -I/usr/local/include -I. -DLINUX -
DUSE_DETACH -DCLAIM_USB -o ImportExportHex.o -c ImportExportHex.cpp
g++ -Wall -D_GNU_SOURCE -O2 -I/usr/local/include -I. -DLINUX -
DUSE_DETACH -DCLAIM_USB -o PICkitFunctions.o -c PICkitFunctions.cpp
g++ -Wall -D_GNU_SOURCE -O2 -I/usr/local/include -I. -DLINUX -
DUSE_DETACH -DCLAIM_USB -o PIC32PE.o -c PIC32PE.cpp
g++ -Wall -D_GNU_SOURCE -O2 -I/usr/local/include -I. -DLINUX -
DUSE_DETACH -DCLAIM_USB -o Pk2BootLoader.o -c Pk2BootLoader.cpp
g++ -Wall -D_GNU_SOURCE -O2 -I/usr/local/include -I. -DLINUX -
DUSE_DETACH -DCLAIM_USB -o pk2cmd.o -c pk2cmd.cpp
g++ -Wall -D_GNU_SOURCE -O2 -I/usr/local/include -I. -DLINUX -
DUSE_DETACH -DCLAIM_USB -o stdafx.o -c stdafx.cpp
g++ -Wall -D_GNU_SOURCE -O2 -I/usr/local/include -I. -DLINUX -
DUSE_DETACH -DCLAIM_USB -o pk2usbcommon.o -c pk2usbcommon.cpp
pk2usbcommon.cpp:50: erreur: «USB_DEBUG_FLAGS" was not declared in
this scope
make[1]: *** [pk2usbcommon.o] Erreur 1


Do you see what to do ?
Thanks once more,
Cédric

On 1 avr, 07:17, Xiaofan Chen <xiaof...@gmail.com> wrote:
> On Wed, Apr 1, 2009 at 1:10 PM, Xiaofan Chen <xiaof...@gmail.com> wrote:
> > On Tue, Mar 31, 2009 at 7:40 PM, grokakin <cedric_li...@tele2.fr> wrote:
>
> >> Thanks for your help Xiaofan ,
>
> >> I tried sudo pk2cmd -P
> >> and I still get the same error :
>
> >> No PICkit 2 found.
>
> > What is the kernel version you are using? Do you have
> > CONFIG_USB_SUSPEND enabled in the kernel? If yes then
> > that might be a problem (lsusb can see PICkit 2 but libusb based
> > pk2cmd can not see PICkit 2).
>
> > I suspect you are suffering this problem as you are
> > using Ubuntu 7.10 (Gutsy), I think the problem is similar to
> > the problem I saw in 7.04 (Feisty).
> >http://www.microchip.com/forums/tm.aspx?m=275422&mpage=2
>
> > Kernel version between 2.6.20 and 2.6.22 are both
> > suffering from this problem. 2.6.23 onwards should be ok.
>
> > Possible Solutions:
> > 1) If you have not done it, try update to the latest kernel of 7.10.
> > 2) If 1) fails, rebuild the kernel and disable CONFIG_USB_SUSPEND
> > 3) Ubuntu 7.10 is no longer supported. Maybe you want to consider
> > upgrading. 8.04 LTS is good and has long support. 8.10 is also
> > not bad. 9.04 is coming.
>
> I remember I have no problems with pk2cmd under
> Ubuntu 6.06 and 7.10 last time.http://mcuee.blogspot.com/search/label/PICKit

Jeff Post

unread,
Apr 1, 2009, 5:45:43 PM4/1/09
to pickit...@googlegroups.com
On Wednesday 01 April 2009 14:11, grokakin wrote:
>
> Well, I downloaded the sources of pk2cmdv1.20 and modified pk2usb.h.
> I modified also the makefile and added -I. in the following lines :

Don't modify the make file.


>
> as I got gcc telling that usb.h was missing .

It's in the same directory as everything else


>
> Then from the directory I typed make linux .
> And unfortunately there is an error :
>

> g++ -Wall -D_GNU_SOURCE -O2 -I/usr/local/include -I. -DLINUX -
> DUSE_DETACH -DCLAIM_USB -o pk2usbcommon.o -c pk2usbcommon.cpp
> pk2usbcommon.cpp:50: erreur: «USB_DEBUG_FLAGS" was not declared in
> this scope

It appears your compiler can't find pk2usb.h either. What version of g++ are
you using?

Jeff

grokakin

unread,
Apr 1, 2009, 6:03:11 PM4/1/09
to pickit-devel
g++ version is gcc 4.1.3 20070929 (prerelease) (Ubuntu
4.1.2-16ubuntu2)

according to g++ -v answer

Adding -I. enabled the error about missing usb.h being skipped .

Cédric

Jeff Post

unread,
Apr 1, 2009, 8:18:09 PM4/1/09
to pickit...@googlegroups.com
On Wednesday 01 April 2009 15:03, grokakin wrote:
>
> Adding -I. enabled the error about missing usb.h being skipped .
>
I'm unable to parse that sentence. Can you explain what you mean?

Jeff

grokakin

unread,
Apr 2, 2009, 11:17:35 AM4/2/09
to pickit-devel
I think you should use -Dfrench with your compiler :-) !

Well, I was just trying to tell that after having added -I. to gcc
command line options, the message error stating that usb.h was missing
didn't no show up again. It semt to me like a solution, even though
not ideal .
What do you think about g++ version ?

Matthew Nuzum

unread,
Apr 2, 2009, 12:06:34 PM4/2/09
to pickit...@googlegroups.com

I seem to remember having this problem a while back, does he need to
install a devel package like libusb-dev for this to work?

--
Matthew Nuzum
newz2000 on freenode, skype, linkedin, identi.ca and twitter

Jeff Post

unread,
Apr 2, 2009, 2:38:36 PM4/2/09
to pickit...@googlegroups.com
On Thursday 02 April 2009 08:17, grokakin wrote:
>
> Well, I was just trying to tell that after having added -I. to gcc
> command line options, the message error stating that usb.h was missing
> didn't no show up again. It semt to me like a solution, even though
> not ideal .
> What do you think about g++ version ?
>
I'm using 3.4.6. Can anyone with g++ version 4 verify whether or not that's a
problem?

Jeff

Jeff Post

unread,
Apr 2, 2009, 2:43:05 PM4/2/09
to pickit...@googlegroups.com
On Thursday 02 April 2009 09:06, Matthew Nuzum wrote:
>
> I seem to remember having this problem a while back, does he need to
> install a devel package like libusb-dev for this to work?

That very well may be a problem. Xiaofan can answer that better than I.
However, it seems to have nothing to do with his compiler not being able to
find a header file that's in the build directory.

(Scratches head and wonders if sometimes someone is pulling his leg.)

Jeff

Xiaofan Chen

unread,
Apr 2, 2009, 7:40:42 PM4/2/09
to pickit...@googlegroups.com
On Fri, Apr 3, 2009 at 12:06 AM, Matthew Nuzum <matt...@gmail.com> wrote:
> I seem to remember having this problem a while back, does he need to
> install a devel package like libusb-dev for this to work?
>
Yes he needs. "sudo apt-get install libusb-dev".

Somehow the source package has a version of usb.h from libusb-dev,
that is why he adds "-I." and find the usb.h file locally. That is not good.

He should use the above command under Ubuntu.

Regards,
Xiaofan

grokakin

unread,
Apr 3, 2009, 4:12:41 AM4/3/09
to pickit-devel
Hi ,
I've dowloaded libusb-dev as you recommended it and erased the
modifications done to the Makefile and tried to recompile after having
cleaned the directory (make clean)

Here is what I get :


root@lachez-moi:/home/cedric/electronique/programmation-pic/microchip/
pk2cmdv1.20LinuxMacSource# make linux
make TARGET=linux
make[1]: entrant dans le répertoire « /home/cedric/electronique/
programmation-pic/microchip/pk2cmdv1.20LinuxMacSource »
g++ -Wall -D_GNU_SOURCE -O2 -I/usr/local/include -DLINUX -DUSE_DETACH -
DCLAIM_USB -o cmd_app.o -c cmd_app.cpp
g++ -Wall -D_GNU_SOURCE -O2 -I/usr/local/include -DLINUX -DUSE_DETACH -
DCLAIM_USB -o DeviceData.o -c DeviceData.cpp
g++ -Wall -D_GNU_SOURCE -O2 -I/usr/local/include -DLINUX -DUSE_DETACH -
DCLAIM_USB -o DeviceFile.o -c DeviceFile.cpp
g++ -Wall -D_GNU_SOURCE -O2 -I/usr/local/include -DLINUX -DUSE_DETACH -
DCLAIM_USB -o ImportExportHex.o -c ImportExportHex.cpp
g++ -Wall -D_GNU_SOURCE -O2 -I/usr/local/include -DLINUX -DUSE_DETACH -
DCLAIM_USB -o PICkitFunctions.o -c PICkitFunctions.cpp
g++ -Wall -D_GNU_SOURCE -O2 -I/usr/local/include -DLINUX -DUSE_DETACH -
DCLAIM_USB -o PIC32PE.o -c PIC32PE.cpp
g++ -Wall -D_GNU_SOURCE -O2 -I/usr/local/include -DLINUX -DUSE_DETACH -
DCLAIM_USB -o Pk2BootLoader.o -c Pk2BootLoader.cpp
g++ -Wall -D_GNU_SOURCE -O2 -I/usr/local/include -DLINUX -DUSE_DETACH -
DCLAIM_USB -o pk2cmd.o -c pk2cmd.cpp
g++ -Wall -D_GNU_SOURCE -O2 -I/usr/local/include -DLINUX -DUSE_DETACH -
DCLAIM_USB -o stdafx.o -c stdafx.cpp
g++ -Wall -D_GNU_SOURCE -O2 -I/usr/local/include -DLINUX -DUSE_DETACH -
DCLAIM_USB -o pk2usbcommon.o -c pk2usbcommon.cpp
pk2usbcommon.cpp:50: erreur: «USB_DEBUG_FLAGS" was not declared in
this scope
make[1]: *** [pk2usbcommon.o] Erreur 1
make[1]: quittant le répertoire « /home/cedric/electronique/
programmation-pic/microchip/pk2cmdv1.20LinuxMacSource »
make: *** [linux] Erreur 2


What seams strange to me is -I/usr/local/include as this directory
doesn't exist on my PC .
The makefile refers also to /usr/local as being a directory that can
contain lib directory and on my PC that doesn't neither.

Should /usr/local contain certain sources ?


On 3 avr, 01:40, Xiaofan Chen <xiaof...@gmail.com> wrote:

Xiaofan Chen

unread,
Apr 3, 2009, 9:32:22 AM4/3/09
to pickit...@googlegroups.com
On Fri, Apr 3, 2009 at 4:12 PM, grokakin <cedric...@tele2.fr> wrote:
>
> root@lachez-moi:/home/cedric/electronique/programmation-pic/microchip/
> pk2cmdv1.20LinuxMacSource# make linux
> g++ -Wall -D_GNU_SOURCE -O2 -I/usr/local/include -DLINUX -DUSE_DETACH -
> DCLAIM_USB -o pk2usbcommon.o  -c pk2usbcommon.cpp
> pk2usbcommon.cpp:50: erreur: «USB_DEBUG_FLAGS" was not declared in
> this scope
> make[1]: *** [pk2usbcommon.o] Erreur 1
> make[1]: quittant le répertoire « /home/cedric/electronique/
> programmation-pic/microchip/pk2cmdv1.20LinuxMacSource »
> make: *** [linux] Erreur 2
>

Are you sure you modify pk2usb.h according to what Jeff told you?
It should like the following.


// Examples:
//#define USB_DEBUG_FLAGS (USB_DEBUG_XMIT | USB_DEBUG_RECV)

//Uncomment this line (Note by Xiaofan)
#define USB_DEBUG_FLAGS USB_DEBUG_FULL
//Comment out this line (note by Xiaofan)
//#define USB_DEBUG_FLAGS 0 // No USB debugging by default

> What seams strange to me is -I/usr/local/include as this directory
> doesn't exist on my PC .
> The makefile refers also to /usr/local as being a directory that can
> contain lib directory and on my PC that doesn't neither.
>
> Should /usr/local contain certain sources ?

This is not a problem. If you wish, you can change it to /usr instead.
By default, Ubuntu look at /usr/local/include (and /usr/local/lib)
first and then /usr/include (and /usr/lib). By default, Ubuntu
install libusb and libusb-dev under /usr. Many other Linux
distributions share the same thing.


Regards,
Xiaofan

grokakin

unread,
Apr 3, 2009, 6:05:13 PM4/3/09
to pickit-devel

Hi Xiaofan,
making a diff, I've found the bug .
I made a mistake modifying the pk2usb.h file, I typed USB_DEBUG_FLAG
instead of USB_DEBUG_FLAGS .
Sorry for that ...

Well now I've compiled it , and installed it and
here is what I get as typing ./pk2cmd -C -PPIC16F676 with PicKit 2
plugged to one USB port on the PC, not through a hub :


Get Firmware Version
USB> 76
USB< 02 20 00 ff fe ff fe ff
Get Firmware Version
USB> 76
USB< 02 20 00 ff fe ff fe ff fe 01 fe 01 fe 01 fe 01
fe 01 fe 01 fe 01 fe 01 fe 01 fe 01 fe 01 fe 01
fe 01 fe 01 fe 01 fe 01 fe 01 fe 01 fe 01 fe 01
fe 01 fe 01 fe 01 fe 01 fe 01 fe 01 fe 01 fe 01
Execute Script 2 bytes
fe VDD_OFF
fd VDD_GND_ON
USB> a6 02 fe fd ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

Set Vdd
USB> a0 80 2a d2 ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

Set Vpp
USB> a1 40 df 9c ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

Script Buffer Checksum
USB> af ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

USB< f3 00 10 76 fe ff fe ff fe 01 fe 01 fe 01 fe 01
fe 01 fe 01 fe 01 fe 01 fe 01 fe 01 fe 01 fe 01
fe 01 fe 01 fe 01 fe 01 fe 01 fe 01 fe 01 fe 01
Clear Script Buffer
USB> ab ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

Download Script SCR_PROG_ENTRY, 18 bytes
USB> a4 00 12 fa f7 f9 f5 f3 00 e8 14 f6 fb e7 7f f7
fa fb f6 e8 13 ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

Download Script SCR_PROG_EXIT, 8 bytes
USB> a4 01 08 fa f7 f8 f3 03 e8 0a f4 ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

Download Script SCR_RD_DEVID, 18 bytes
USB> a4 02 12 ee 06 00 f2 00 f2 00 ee 06 06 e9 03 05
ee 06 04 f0 f0 ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

Download Script SCR_PROGMEM_RD, 11 bytes
USB> a4 03 0b ee 06 04 f0 f0 ee 06 06 e9 08 1f ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

Download Script SCR_PROGMEM_ADDRSET, 16 bytes
USB> a4 05 10 fa f7 e7 5e f6 fb e7 2f e4 05 ee 06 06
dd 03 db ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

Download Script SCR_PROGMEM_WR, 13 bytes
USB> a4 07 0d ee 06 02 f1 f1 ee 06 08 e7 76 ee 06 06
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

Download Script SCR_EE_RD, 11 bytes
USB> a4 09 0b ee 06 05 f0 f0 ee 06 06 e9 08 1f ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

Download Script SCR_EE_WR, 13 bytes
USB> a4 0b 0d ee 06 03 f1 f1 ee 06 08 e8 01 ee 06 06
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

Download Script SCR_CONFIG_RD, 18 bytes
USB> a4 0d 12 ee 06 00 f2 00 f2 00 ee 06 06 e9 03 06
ee 06 04 f0 f0 ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

Download Script SCR_CONFIG_WR, 16 bytes
USB> a4 0f 10 ee 06 00 f1 f1 ee 06 06 e9 03 06 ee 06
08 e7 8d ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

Download Script SCR_USERID_RD, 18 bytes
USB> a4 11 12 ee 06 00 f2 00 f2 00 ee 06 04 f0 f0 ee
06 06 e9 08 03 ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
Download Script SCR_USERID_WR, 23 bytes
USB> a4 13 17 ee 06 00 f2 00 f2 00 ee 06 02 f1 f1 ee
06 08 e7 8d ee 06 06 e9 0d 03 ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

Download Script SCR_OSCCAL_RD, 13 bytes
USB> a4 14 0d e4 05 ee 06 06 dd 03 db ee 06 04 f0 f0
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

Download Script SCR_OSCCAL_WR, 18 bytes
USB> a4 15 12 e4 05 ee 06 06 dd 03 db ee 06 02 f1 f1
ee 06 08 e7 76 ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

Download Script SCR_ERASE_CHIP, 17 bytes
USB> a4 16 11 ee 06 00 f2 00 f2 00 ee 06 09 e8 02 ee
06 0b e8 02 ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

Download Script SCR_ERASE_PROGMEM, 12 bytes
USB> a4 17 0c ee 06 00 f2 00 f2 00 ee 06 09 e8 02 ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

Script Buffer Checksum
USB> af ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

fe 01 fe 01 fe 01 fe 01 fe 01 fe 01 fe 01 fe 01
fe 01 fe 01 fe 01 fe 01 fe 01 fe 01 fe 01 fe 01
fe 01 fe 01 fe 01 fe 01 fe 01 fe 01 fe 01 fe 01
Execute Script 2 bytes
ea 00 SET_ICSP_SPEED
USB> a6 02 ea 00 ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

Execute Script 2 bytes
fc VDD_GND_OFF
ff VDD_ON
USB> a6 02 fc ff ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

Clear Upload Buffer
Run Script SCR_PROG_ENTRY 1 time
USB> a9 a5 00 01 ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

\Clear Upload Buffer
Run Script SCR_PROGMEM_RD 2 times
Upload Data No Length
USB> a9 a5 03 02 ac ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

USB< fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
USB< f3 00 10 76 fe ff fe ff fe 01 fe 01 fe 01 fe 01

Upload Data No Length
USB> ac ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

USB< fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe 7f fe ff fe ff
Clear Upload Buffer
Run Script SCR_PROGMEM_RD 2 times
Upload Data No Length
USB> a9 a5 03 02 ac ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

USB< fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
Upload Data No Length
USB> ac ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

USB< fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
Clear Upload Buffer
Run Script SCR_PROGMEM_RD 2 times
Upload Data No Length
USB> a9 a5 03 02 ac ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

USB< fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
Upload Data No Length
USB> ac ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

USB< fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe 7f fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
Clear Upload Buffer
Run Script SCR_PROGMEM_RD 2 times
Upload Data No Length
USB> a9 a5 03 02 ac ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

USB< fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe 7f fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
Upload Data No Length
USB> ac ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

USB< fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
Clear Upload Buffer
Run Script SCR_PROGMEM_RD 2 times
Upload Data No Length
USB> a9 a5 03 02 ac ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

USB< fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
Upload Data No Length
USB> ac ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

USB< fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe 7f
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
Clear Upload Buffer
Run Script SCR_PROGMEM_RD 2 times
Upload Data No Length
USB> a9 a5 03 02 ac ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

USB< fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
Upload Data No Length
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

USB< fe ff fe ff fe ff fe ff fe ff fe 7f fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
Upload Data No Length
USB> ac ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

USB< fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
Clear Upload Buffer
Run Script SCR_PROGMEM_RD 2 times
Upload Data No Length
USB> a9 a5 03 02 ac ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

USB< fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
Upload Data No Length
USB> ac ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

USB< fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff

..........
..........

Execute Script 2 bytes
fe VDD_OFF
fd VDD_GND_ON
USB> a6 02 fe fd ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

Device is blank
Execute Script 1 bytes
f7 MCLR_GND_ON
USB> a6 01 f7 ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

Execute Script 2 bytes
fe VDD_OFF
fd VDD_GND_ON
USB> a6 02 fe fd ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

Read Status
USB> a2 ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad
ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad ad

USB< 05 00 03 ff fe ff fe ff fe 01 fe 01 fe 01 fe 01
fe 01 fe 01 fe 01 fe 01 fe 01 fe 01 fe 01 fe 01
fe 01 fe 01 fe 01 fe 01 fe 01 fe 01 fe 01 fe 01
fe 01 fe 01 fe 01 fe 01 fe 01 fe 01 fe 01 fe 01

Operation Succeeded




Seems like it works , doesn't it ?
I've seen written Device blank.
Maybe can I undef the USB_DEBUG_FLAGS
Thanks for your precious help once more,

Cédric





grokakin

unread,
Apr 3, 2009, 6:18:12 PM4/3/09
to pickit-devel
Well I could not wait your answers to see if it was ok .

It works :-) ) !!

So I would like to thank you very much Jeff and Xiaofan for your
help .

I will still be able, thanks to you, to keep using linux to program
the PICs and without getting to another Ubuntu :-) .

I prefer that than getting back to XP

Bye

Xiaofan Chen

unread,
Apr 3, 2009, 7:23:27 PM4/3/09
to pickit...@googlegroups.com
On Sat, Apr 4, 2009 at 6:18 AM, grokakin <cedric...@tele2.fr> wrote:
>
>  Well I could not wait your answers to see if it was ok .
>
>  It works :-) ) !!
>
>  So I would like to thank you very much Jeff and Xiaofan for your
> help .
>

Great. Just wondering if it is correct to say that the released
binary does not work for you and the binary you built from
source works. Is this right? Can you try the released binary
again to confirm this? Thanks.

Regards,
Xiaofan

grokakin

unread,
Apr 4, 2009, 2:54:17 PM4/4/09
to pickit-devel
Yes that's right ,
the released binary still doesn't work, I still get : "No PicKit2
found"

And the built form sources binary seems to work nice .

I haven't really used it up to now in detail to program a PIC, but
auto-detect functions as well as blank check, so I suppose It
works :-)

If you want some help to check some modifications, it will a pleasure
to help .

Cédric

On 4 avr, 01:23, Xiaofan Chen <xiaof...@gmail.com> wrote:

Jeff Post

unread,
Apr 4, 2009, 4:21:37 PM4/4/09
to pickit...@googlegroups.com
On Saturday 04 April 2009 11:54, grokakin wrote:
> Yes that's right ,
> the released binary still doesn't work, I still get : "No PicKit2
> found"
>
> And the built form sources binary seems to work nice .
>
One of several reasons it's always better to build from source :-)

Jeff

Xiaofan Chen

unread,
Apr 4, 2009, 8:20:17 PM4/4/09
to pickit...@googlegroups.com
On Sun, Apr 5, 2009 at 4:21 AM, Jeff Post <j_p...@pacbell.net> wrote:
>
> On Saturday 04 April 2009 11:54, grokakin wrote:
>> Yes that's right ,
>> the released binary still doesn't work, I still get : "No PicKit2
>> found"
>>
>> And the built form sources binary seems to work nice .

Thanks for the updates.

> One of several reasons it's always better to build from source :-)
>

I agree. ;-)

Xiaofan

grokakin

unread,
Apr 5, 2009, 4:34:06 PM4/5/09
to pickit-devel
Maybe building from source is the best solution, but not if you're
lazy and lucky :-)

jorgonl

unread,
May 5, 2009, 6:25:56 PM5/5/09
to pickit-devel
Hi...

I'm very interested in this conversation because I have a similar
problem here.
pk2cmd compiled well but i get the "No PICkit 2 found" message. I
recompiled like you posted for more detailed debug info and this is
what I get for pk2cmd -C -PPIC16F84:

usb_set_debug: Setting debugging level to 255 (on)
usb_os_init: Found USB VFS at /dev/bus/usb
usb_os_find_busses: Found 005
usb_os_find_busses: Found 003
usb_os_find_busses: Found 001
usb_os_find_busses: Found 004
usb_os_find_busses: Found 002
usb_os_find_devices: Found 003 on 005
usb_os_find_devices: Found 001 on 005
error obtaining child information: Inappropriate ioctl for device
usb_os_find_devices: Found 001 on 003
usb_os_find_devices: Found 001 on 001
usb_os_find_devices: Found 005 on 004
skipped 1 class/vendor specific interface descriptors
usb_os_find_devices: Found 001 on 004
error obtaining child information: Inappropriate ioctl for device
usb_os_find_devices: Found 003 on 002
skipped 1 class/vendor specific interface descriptors
usb_os_find_devices: Found 001 on 002
error obtaining child information: Inappropriate ioctl for device
USB error: could not get bound driver: No data available
Get Firmware Version
USB> 76
USB error: error submitting URB: Invalid argument
USB error: error submitting URB: Invalid argument
Get Firmware Version
USB> 76
USB error: error submitting URB: Invalid argument
No PICkit 2 found.

The programmer i'm using runs fine under windows and it is recognized
well by pk2 v3.0 alpha12

Any help i will apreciate
Thanks

Xiaofan Chen

unread,
May 5, 2009, 6:54:59 PM5/5/09
to pickit...@googlegroups.com
On Wed, May 6, 2009 at 6:25 AM, jorgonl <jor...@gmail.com> wrote:
>
> Hi...
>
> I'm very interested in this conversation because I have a similar
> problem here.
> pk2cmd compiled well but i get the "No PICkit 2 found" message. I
> recompiled like you posted for more detailed debug info and this is
> what I get for pk2cmd -C -PPIC16F84:
>

Please run as root first to see if that helps. Please also post
the output of "lsusb -vvv".

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

jorgonl

unread,
May 5, 2009, 7:25:07 PM5/5/09
to pickit-devel
No running as root was my firs guess and didn't work. The output from
lsusb -vvv is the following:

Bus 004 Device 006: ID 04d8:0033 Microchip Technology, Inc.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x04d8 Microchip Technology, Inc.
idProduct 0x0033
bcdDevice 0.02
iManufacturer 1
iProduct 2
iSerial 3
bNumConfigurations 2
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 41
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 2
bmAttributes 0x80
(Bus Powered)
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 3 Human Interface Devices
bInterfaceSubClass 0 No Subclass
bInterfaceProtocol 0 None
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 0.01
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 29
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 32
bNumInterfaces 1
bConfigurationValue 2
iConfiguration 4
bmAttributes 0x80
(Bus Powered)
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1

Thank you Xiaofan

Xiaofan Chen

unread,
May 5, 2009, 7:30:29 PM5/5/09
to pickit...@googlegroups.com
On Wed, May 6, 2009 at 7:25 AM, jorgonl <jor...@gmail.com> wrote:
>
> No running as root was my firs guess and didn't work. The output from
> lsusb -vvv is the following:

What is your Linux distro?
Please also post the message when plugging in PICKit 2? You can
post the last few lines of dmesg.

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

jorgonl

unread,
May 5, 2009, 7:43:19 PM5/5/09
to pickit-devel
My distro is Debian Etch. This is dmesg output when connecting the
programmer:

usb 4-1: new full speed USB device using uhci_hcd and address 7
usb 4-1: configuration #1 chosen from 2 choices
hiddev96: USB HID v0.01 Device [Microchip Technology Inc. PICkit 2
Microcontroller Programmer] on usb-0000:00:1d.3-1

Here it says configuration 1 is chosen and it really is when looking
at /proc/bus/usb/devices:

T: Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 7 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 2
P: Vendor=04d8 ProdID=0033 Rev= 0.02
S: Manufacturer=Microchip Technology Inc.
S: Product=PICkit 2 Microcontroller Programmer
S: SerialNumber=PICTRONICO.COM
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
I: If#= 0 Alt= 0 #EPs= 2 Cls=03(HID ) Sub=00 Prot=00 Driver=usbhid
E: Ad=81(I) Atr=03(Int.) MxPS= 64 Ivl=1ms
E: Ad=01(O) Atr=03(Int.) MxPS= 64 Ivl=1ms
C: #Ifs= 1 Cfg#= 2 Atr=80 MxPwr=100mA
I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=
E: Ad=81(I) Atr=03(Int.) MxPS= 64 Ivl=1ms
E: Ad=01(O) Atr=03(Int.) MxPS= 64 Ivl=1ms


But when i try something with pk2cmd the programmer changes to
configuration 2. This is after pk2cmd -P running as root

T: Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 7 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 2
P: Vendor=04d8 ProdID=0033 Rev= 0.02
S: Manufacturer=Microchip Technology Inc.
S: Product=PICkit 2 Microcontroller Programmer
S: SerialNumber=PICTRONICO.COM
C: #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
I: If#= 0 Alt= 0 #EPs= 2 Cls=03(HID ) Sub=00 Prot=00 Driver=
E: Ad=81(I) Atr=03(Int.) MxPS= 64 Ivl=1ms
E: Ad=01(O) Atr=03(Int.) MxPS= 64 Ivl=1ms
C:* #Ifs= 1 Cfg#= 2 Atr=80 MxPwr=100mA
I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
E: Ad=81(I) Atr=03(Int.) MxPS= 64 Ivl=1ms
E: Ad=01(O) Atr=03(Int.) MxPS= 64 Ivl=1ms

Xiaofan Chen

unread,
May 5, 2009, 7:55:27 PM5/5/09
to pickit...@googlegroups.com
On Wed, May 6, 2009 at 7:43 AM, jorgonl <jor...@gmail.com> wrote:
>
> My distro is Debian Etch. This is dmesg output when connecting the
> programmer:
>
> usb 4-1: new full speed USB device using uhci_hcd and address 7
> usb 4-1: configuration #1 chosen from 2 choices
> hiddev96: USB HID v0.01 Device [Microchip Technology Inc. PICkit 2
> Microcontroller Programmer] on usb-0000:00:1d.3-1
>
> Here it says configuration 1 is chosen and it really is when looking
> at /proc/bus/usb/devices:

> But when i try something with pk2cmd the programmer changes to


> configuration 2. This is after pk2cmd -P running as root
>

This should still be ok. But for debugging, please try this.

Change the line in pk2usb.h
#define CONFIG_VENDOR 2 // Vendor specific configuration
to
// do not use Vendor specific configuration, use only the HID Configuration
#define CONFIG_VENDOR 1

Rebuild and then check if things get better.

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

jorgonl

unread,
May 5, 2009, 8:08:18 PM5/5/09
to pickit-devel
I did and error is still there. Interface 1 is still the active
interface but hid driver has lost it:

T: Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 9 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 2
P: Vendor=04d8 ProdID=0033 Rev= 0.02
S: Manufacturer=Microchip Technology Inc.
S: Product=PICkit 2 Microcontroller Programmer
S: SerialNumber=PICTRONICO.COM
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
I: If#= 0 Alt= 0 #EPs= 2 Cls=03(HID ) Sub=00 Prot=00 Driver=(none)
E: Ad=81(I) Atr=03(Int.) MxPS= 64 Ivl=1ms
E: Ad=01(O) Atr=03(Int.) MxPS= 64 Ivl=1ms

Xiaofan Chen

unread,
May 5, 2009, 9:00:32 PM5/5/09
to pickit...@googlegroups.com
On Wed, May 6, 2009 at 8:08 AM, jorgonl <jor...@gmail.com> wrote:
>
> I did and error is still there. Interface 1 is still the active
> interface but hid driver has lost it:

This is normal since pk2cmd detaches the hiddev driver and use
libusb to communicate with PICkit 2. I am not so sure why pk2cmd
can not find PICkit 2 for you under Debian Etch.

>Get Firmware Version
>USB> 76
>USB error: error submitting URB: Invalid argument
>USB error: error submitting URB: Invalid argument
>Get Firmware Version
>USB> 76
>USB error: error submitting URB: Invalid argument
>No PICkit 2 found.

It seem that pk2cmd can not get the response from
PICkit 2. Strange. Now I can only suspect the cable or
things like that. Could you try a different cable? Could you
try without your target board connected first?

What is your kernel version? Debian Etch is a bit
old but it should work.

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

jorgonl

unread,
May 5, 2009, 9:17:24 PM5/5/09
to pickit-devel
My kernel version is 2.6.18. It can't be the cable since i already
programmed succesfuly using pk2 (http://home.pacbell.net/theposts/
picmicro/). Anyway thanks a lot. I'm thinking on upgrading to Debian
5.0 Lenny someday... maybe it works on it.

Thank you for your time

Xiaofan Chen

unread,
May 5, 2009, 9:27:00 PM5/5/09
to pickit...@googlegroups.com

Have you updated your firmware to V2.32?

I do not think the kernel is the problem since I used PICKit 2 under
Ubuntu 6.06 last time. I once installed Debian Etch and I think I
have PICkit 2 working under it as well. I did not like it so I removed
it after a short time.

You may want to consider switching to Ubuntu which just works
for me most of the times. Debian stable is said to be quite stable
but becomes old very soon.

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

Xiaofan Chen

unread,
May 5, 2009, 11:46:49 PM5/5/09
to pickit...@googlegroups.com
On Wed, May 6, 2009 at 9:27 AM, Xiaofan Chen <xiao...@gmail.com> wrote:
> On Wed, May 6, 2009 at 9:17 AM, jorgonl <jor...@gmail.com> wrote:
>>
>> My kernel version is 2.6.18. It can't be the cable since i already
>> programmed succesfuly using pk2 (http://home.pacbell.net/theposts/
>> picmicro/). Anyway thanks a lot. I'm thinking on upgrading to Debian
>> 5.0 Lenny someday... maybe it works on it.
>>
>
> Have you updated your firmware to V2.32?

One more idea, you can add the debug option to pk2 3.0 as
well. Then you can compare the debug output of pk2 3.0
and pk2cmd V1.20.


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

Jeff Post

unread,
May 6, 2009, 12:20:07 AM5/6/09
to pickit...@googlegroups.com
On Tuesday 05 May 2009 15:25, jorgonl wrote:
>
> I'm very interested in this conversation because I have a similar
> problem here.
> pk2cmd compiled well but i get the "No PICkit 2 found" message. I
> recompiled like you posted for more detailed debug info and this is
> what I get for pk2cmd -C -PPIC16F84:
>
> Get Firmware Version
> USB> 76
> USB error: error submitting URB: Invalid argument
> No PICkit 2 found.
>
> The programmer i'm using runs fine under windows and it is recognized
> well by pk2 v3.0 alpha12
>
The fact that it runs under windows (on the same machine?) and pk2 works
indicates it's not a cable or a voltage problem.

At first glance it looks like a driver problem, but if that were it, the
programmer wouldn't work with pk2.

So, what's left is the way pk2cmd and pk2 differ in how the driver interface
is set up. While I'd love to compare the code, I'm up to my ears in antelopes
for the next three weeks (at least). Anyone want to delve into what's
different about how pk2 and pk2cmd initialize and interface to the libusb
driver?

If Dan Butler is listening, will you be taking over maintenance of the pk2cmd
code for Microchip?

FWIW, I hope to have a Debian machine set up soon (he says with fingers
crossed) and I can test pk2cmd on it then.

Jeff

Dan.B...@microchip.com

unread,
May 6, 2009, 1:32:11 AM5/6/09
to pickit...@googlegroups.com
Hi Jeff -

Yes, I'm here and monitoring. However an new guy Mike Stuckey is taking over PICkit development including pk2cmd.
Sorry, I've been deficient in introducing Mike to the community. I'll do that in the AM (this web email interface is rather limited)

He's coming up to speed but it may be a while as there is alot to come up to speed on! Before Walter left, we spent a total of about 8 hours on the phone talking about what-is-where and clearly that wasn't enough. Fortunately W is still answering questions but we need to make that a last resort.

Mike will do fine, but we need to give him time to come up to speed. BTW, do you have a PICkit 3 yet?

Dan
winmail.dat

Xiaofan Chen

unread,
May 6, 2009, 2:03:21 AM5/6/09
to pickit...@googlegroups.com
On Wed, May 6, 2009 at 1:32 PM, <Dan.B...@microchip.com> wrote:
> Mike will do fine, but we need to give him time to come up to speed.
> BTW, do you have a PICkit 3 yet?

I am not so sure about Jeff. I do not have one yet. Right now it seems
that the firmware code is not open yet. The host software for PICKit 3
is buried within MPLAB and not open. The performance and feature is limited
compared to PICKit 2 as well. For example, there are no pk3cmd and
tandalone GUI program for PICKit 3.

But I am interested in PICKit 3 as well if the firmware source will be
open later.

ICD 3 looks more interesting but the cost is a bit high.

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

Jeff Post

unread,
May 6, 2009, 2:39:46 AM5/6/09
to pickit...@googlegroups.com
On Tuesday 05 May 2009 22:32, Dan.B...@Microchip.com wrote:
> Hi Jeff -
>
> Yes, I'm here and monitoring. However an new guy Mike Stuckey is taking
> over PICkit development including pk2cmd.

Ooh, the puns I could make. But I won't. My name's subject to even more puns,
especially from Canadians. ;-)

(BTW, whenever anyone gets killed, I tell 'em you did it :-)

>
> Mike will do fine, but we need to give him time to come up to speed.

I'm sure he'll do great. Microchip has a talent for picking good talent.

> BTW, do you have a PICkit 3 yet?
>

No, wanna send me one?

Jeff

Jorge Góngora Lara

unread,
May 6, 2009, 10:34:52 AM5/6/09
to pickit...@googlegroups.com
Hi all...

Well... I got my old laptop, put Debian Lenny on it, compiled pk2cmd, ran pk2cmd -P and it worked just well. So obviously it was some version problem or something like that. I will keep testing writing and reading the PIC.

Thanks



Xiaofan Chen

unread,
May 6, 2009, 10:40:26 AM5/6/09
to pickit...@googlegroups.com

Thanks for the reports. One of the first thing is to check the version
difference
of libusb. You may want to build libusb by yourself in your Debian Etch box
and then try pk2cmd again.

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

Xiaofan Chen

unread,
May 6, 2009, 10:55:32 AM5/6/09
to pickit...@googlegroups.com
On Wed, May 6, 2009 at 12:20 PM, Jeff Post <j_p...@pacbell.net> wrote:
>
> So, what's left is the way pk2cmd and pk2 differ in how the driver interface
> is set up. While I'd love to compare the code, I'm up to my ears in antelopes
> for the next three weeks (at least). Anyone want to delve into what's
> different about how pk2 and pk2cmd initialize and interface to the libusb
> driver?

I could only think of one thing which is the code to support multiple device.
The only difference was when I was testing FreeBSD. pk2cmd has problems
with multiple devices under FreeBSD. Unfortunately I could not test
FreeBSD after my old desktop died late last year. And the USB stack
for FreeBSD at that time was quite fragile. They have now a new stack
in beta.

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

Xiaofan Chen

unread,
May 6, 2009, 11:01:27 AM5/6/09
to pickit...@googlegroups.com

The other possibility is to remove the multiple device support code
from pk2usb.cpp in pk2cmd. You can try that.

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

Xiaofan Chen

unread,
May 9, 2009, 9:54:01 AM5/9/09
to pickit...@googlegroups.com
On Wed, May 6, 2009 at 10:34 PM, Jorge Góngora Lara <jor...@gmail.com> wrote:

Here is a report that pk2cmd works under Debian Etch. But it is using
pk2cmd v1.12. So you may want to try that first.
http://szokesandor.hu/index.php/WebEn.Pickit2Debian
The note about setuid is wrong. You do not need to do that with
the correct udev rules.

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

DavidEGrayson

unread,
May 15, 2009, 5:53:02 PM5/15/09
to pickit-devel
I was getting an error very similar to jorgonl's problem, and I fixed
it! All you need to do is add one line to pk2usb.cpp before compiling
it.

The symptom of the problem was that when I tried to run "pk2cmd -P" in
Linux it would say "No PICkit 2 found."

Get Firmware Version
USB> 76
Get Firmware Version
USB> 76
No PICkit 2 found.

I hooked up my Beagle USB Protocol Analyzer and discovered that indeed
the computer was NOT sending the byte 0x76 on endpoint 1. I
identified the line in sendUSB in pk2usb.cpp that was supposed to send
that byte:

r = PICKIT_USB(write)(...)

This PICKIT_USB() macro is defined in pk2usb.cpp:

#if HAVE_LIBUSB_INTERRUPT_MODE
// latest libusb: interrupt mode, works with all kernels
# define PICKIT_USB(direction) usb_interrupt_##direction
#else
// older libusb: bulk mode, will only work with older kernels
# define PICKIT_USB(direction) usb_bulk_##direction
#endif

By inserting a #warning directive I determined that my pk2cmd was
indeed compiling to call "usb_bulk_write" but that is definitely the
wrong function to call, because endpoint 1 on the PicKit2 is a
bidirectional interrupt-type endpoint, not bulk.

SOLUTION:
Add the following line to the top of pk2usb.cpp:
#define HAVE_LIBUSB_INTERRUPT_MODE 1
Then remake pk2cmd and it should work.

--David Grayson
http://www.DavidEGrayson.com/

Jorge Góngora Lara

unread,
May 15, 2009, 6:10:37 PM5/15/09
to pickit...@googlegroups.com
Thanks for your tip, unfortunatelly i have already installed Lenny
(where pk2cmd works fine) on my laptop so i can't verify if it works for
me, but i'm pretty sure it would have worked since it looks like the
problem was the same.

Xiaofan Chen

unread,
May 15, 2009, 9:27:16 PM5/15/09
to pickit...@googlegroups.com
On Sat, May 16, 2009 at 5:53 AM, DavidEGrayson <ela...@gmail.com> wrote:
>
> This PICKIT_USB() macro is defined in pk2usb.cpp:
>
> #if HAVE_LIBUSB_INTERRUPT_MODE
> // latest libusb: interrupt mode, works with all kernels
> #  define PICKIT_USB(direction) usb_interrupt_##direction
> #else
> // older libusb: bulk mode, will only work with older kernels
> #  define PICKIT_USB(direction) usb_bulk_##direction
> #endif
>
> By inserting a #warning directive I determined that my pk2cmd was
> indeed compiling to call "usb_bulk_write" but that is definitely the
> wrong function to call, because endpoint 1 on the PicKit2 is a
> bidirectional interrupt-type endpoint, not bulk.
>
> SOLUTION:
> Add the following line to the top of pk2usb.cpp:
> #define HAVE_LIBUSB_INTERRUPT_MODE 1
> Then remake pk2cmd and it should work.
>

Yes that is right. I guess we should just forget about
about the very old kernel and very old libusb. That
was code left from the V2.0/2.2 kernel area.

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

Xiaofan Chen

unread,
May 15, 2009, 9:31:14 PM5/15/09
to pickit...@googlegroups.com
On Sat, May 16, 2009 at 9:27 AM, Xiaofan Chen <xiao...@gmail.com> wrote:
>> SOLUTION:
>> Add the following line to the top of pk2usb.cpp:
>> #define HAVE_LIBUSB_INTERRUPT_MODE 1
>> Then remake pk2cmd and it should work.
>>
>
> Yes that is right. I guess we should just forget about
> about the very old kernel and very old libusb. That
> was code left from the V2.0/2.2 kernel era.
>
The original code is from here. I think libusb has
already evloved and everyone should use 0.1.10 or better
(now it is 0.1.12).
http://charm.cs.uiuc.edu/users/olawlor/projects/2003/microchip/

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

Jeff Post

unread,
May 15, 2009, 10:51:15 PM5/15/09
to pickit...@googlegroups.com
On Friday 15 May 2009 18:27, Xiaofan Chen wrote:
>
> Yes that is right. I guess we should just forget about
> about the very old kernel and very old libusb. That
> was code left from the V2.0/2.2 kernel area.

Some people still use old kernels, and may have good reasons for doing so. We
should still support it for a reasonable period of time (heck, I still get
bug reports for software I wrote for DOS way back when).

Why was HAVE_LIBUSB_INTERRUPT_MODE not defined on the system in question? Is
there some way we could detect which mode to use at runtime? I'm not a USB
guru and currently lack the time to do the research. Any ideas?

Jeff

Xiaofan Chen

unread,
May 15, 2009, 11:45:25 PM5/15/09
to pickit...@googlegroups.com

I think it is only available for very old version of libusb (and may be
for V2.0.x kernel) but I do not know the exact version.

I think I need that patch myself back in 2007.
http://mcuee.blogspot.com/2007/06/pickit-2-under-linux-mini-howto.html

The best way may be by default define it in pk2cmd/pk2. And for
people stuck with old kernel or libusb version (maybe some embedded
Linux distro), they can undefine it.

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

Reply all
Reply to author
Forward
0 new messages