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
If that doesn't turn up anything interesting, change it to USB_DEBUG_MAX and
the USB driver will provide addtional information.
Jeff
Jeff
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
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
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
Jeff
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
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
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
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
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
Jeff
Thanks for the updates.
> One of several reasons it's always better to build from source :-)
>
I agree. ;-)
Xiaofan
Please run as root first to see if that helps. Please also post
the output of "lsusb -vvv".
--
Xiaofan http://mcuee.blogspot.com
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
> 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
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
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
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
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
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
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
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
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
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
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
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 http://mcuee.blogspot.com
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
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