If you're getting "No PICKit2 found." on your SECOND programming attempt (linux)...

66 views
Skip to first unread message

anr...@gmail.com

unread,
Feb 5, 2019, 7:02:03 PM2/5/19
to pickit-devel
I was using a PicKit2 happily with a Fedora 14 x64 distro some years ago.
I moved to Fedora 23 x64 on a different machine.

On this machine it always had the same problem: it wouldn't find the PicKit2 on the second time you try to use it on this USB port.

E.g.
1. Plug your PicKit2 to a USB port (call it port #1)
2. Issue a pk2cmd command, e.g. program a PIC. Works without a hitch.
3. Issue the same command; it fails after waiting ~20 seconds, with "No PICkit 2 found.". This happens on e.g. PIC12F683. On some PIC types (e.g. PIC16F1704), it works, but the 20 second delay is always present.
4. Change the PicKit2 to a different USB port (call it port #2)
5. Issue the same pk2cmd command. It works immediately (no delay)
6. Issue the same pk2cmd command. It either doesn't work, or has the same 20 second delay.
7. Go back to port #1. Works immediately.
8. Go back to port #2. Works immediately.
9. Just unplugging and plugging back the PICKit2 doesn't help.

So you could work-around the issue if you kept changing the USB port the PICKit2 is connected to, but this is quite inconvenient (not to mention USB ports have some life, measured in number of matings... and when you have to program 500 PICs, this is a problem).

SOLUTION

The solution I found was to download the 1.21 sources and do the following modifications:

1. Delete usb.h (use system usb.h supplied)
2. Replace the linux CFLAGS with "$(OPTS) -I$(LIBUSB)/include -DLINUX -DUSE_DETACH -DHAVE_LIBUSB_INTERRUPT_MODE"

(i.e. replace -DCLAIM_USB with -DHAVE_LIBUSB_INTERRUPT_MODE)

This fixes the problem for me. YMMV.

CONCLUSION

If anyone is curious to reach the bottom of this problem, please feel free to reach out, I can try on different modifications on the problematic machine. Otherwise this post is just to help any random soul on the Internet hitting the same problem :) It took me quite a while to figure it out, so I felt obliged to share.

Kind regards,
Veselin Georgiev

francisperea

unread,
Feb 6, 2019, 2:34:18 AM2/6/19
to pickit-devel
Hi Veselin,

Thanks a lot for your information and experience.

It may help some of us in any moment.

Have a great day,

Regards,

Francis Perea
Reply all
Reply to author
Forward
0 new messages