I thought this mailing list is dead, seems not yet...
I think this might not be really a pk2cmd problem, it might well be
a Linux USB problem.
You might want to try to switch to a different port (e.g.: switch
port with your mouse) to see if that helps.
--
Xiaofan
You might also try using the shortest USB cable you can find.
Jeff
So the hardware is good.
> I think you are correct that this is a
> problem with my compilation and/or the Linux USB libraries.
No I am not saying that. Rather you can try to switch to
a different USB port and change to a shorter cable to
see if that helps first.
> I was only able to get it to compile under 64 bit, using libusb-1.0-
> devel and libusb-compat-devel ( Suse packages ). The compatibility
> library included usb.h and libusb.so. My guess
> is that the compatibility is less than perfect.
The compatibility layer should be good enough and it is
now shipped as standard for major distro except Debian/Ubuntu
where the legacy libusb-0.1 packages are still the default.
> I tried various configurations/changes to the make file and the source
> itself, but I couldn't quite get it to compile. I'm not a C++
> developer, so it was a bit beyond my capabilities. Any
> thoughts on where I should go from here? I really don't want to have
> to boot in to Windows for embedded development.
>
You need to install the development package of the
libusb-compat package to build from source. I am not
using Suse but the name should be "libusb-devel"
or similar.
https://build.opensuse.org/package/show?package=libusb-devel&project=hardware
--
Xiaofan
I don't think you've missed anything. While my crystal ball never did work,
I'm inclined to think it's a software problem, in particular something didn't
translate well going from 32 bit to 64 bit. Could be something as simple as
an alignment problem. Could be either in the pk2cmd code or the libusb code.
Has anyone else who might be listening tried pk2cmd on a 64 bit Linux system?
If so, how did it go?
Tom, I likely won't have time for the next few months to delve into the code,
so you might have to dual boot for a while. When I do find time, I trust
you'll be willing to be a guinea pig for testing?
Dan, if you're here, have you tested pk2cmd on 64 bit Linux systems?
Jeff
Last time I tried it under 64bit Ubuntu Linux there is no issue to get
pk2cmd to work.
> Tom, I likely won't have time for the next few months to delve into the code,
> so you might have to dual boot for a while. When I do find time, I trust
> you'll be willing to be a guinea pig for testing?
>
> Dan, if you're here, have you tested pk2cmd on 64 bit Linux systems?
--
Xiaofan
For MPLAB X, you need to take note the version of Java.
On the other hand, I tend to think this is not a pk2cmd problem.
You can try this more-up-to-date pk2cmd version to see if
it helps anything or not.
http://www.microchip.com/forums/tm.aspx?m=540021
--
Xiaofan
The other option to debug whether this is related to OpenSuse
Linux x86_64 version you use, is to try a different Linux distro,
e.g. 32bit version of the same distro, Ubuntu 11.10 32bit and
64bit, you can use Live CD or Flash drive.
If none of the 64bit Linux OS works whereas the 32bit version
works, then the problem clearly point to pk2cmd.
If none of the 32bit and 64bit Linux works, then the problem
seems to be your machine.
If only the OpenSuse Linux x86_64 version you use does
not work, then it is the problem related to the particular
distro.
I know this may take some time though...
--
Xiaofan
I just tried an OpenSuse 12.1 x86_64 installation (VirtualBox
VM under Mac Mini 2011 running OS X Lion) and it works
fine with the 1.21-RC1. I do not have the 18F2455 now so
I use the PIC18F2620 which should be similar in terms of
programming specification.
mcuee@linux-hbxz:~/Desktop/build/pk2cmd> lsb_release -a
LSB Version: n/a
Distributor ID: SUSE LINUX
Description: openSUSE 12.1 (x86_64)
Release: 12.1
Codename: Asparagus
mcuee@linux-hbxz:~/Desktop/build/pk2cmd> ./pk2cmd -PPIC18F2620 -GFtest.hex
Read successfully.
Operation Succeeded
mcuee@linux-hbxz:~/Desktop/build/pk2cmd> ./pk2cmd -PPIC18F2620 -Y -Ftest.hex
PICkit 2 Verify Report
25-3-2012, 9:35:26
Device Type: PIC18F2620
Verify Succeeded.
Operation Succeeded
--
Xiaofan
If so, that is not a valid test of the low-level hardware interface.
Jeff
I am running 64bit Intel OpenSuse under a Virtual Machine. The Mac
Hardware is Mac Mini 2011 which runs on Intel Core i5. Therefore
the VM should also run on Intel Core i5. But I am not a VirtualBox
expert.
http://www.apple.com/macmini/specs.html
mcuee@linux-hbxz:~> cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 42
model name : Intel(R) Core(TM) i5-2415M CPU @ 2.30GHz
stepping : 7
cpu MHz : 2309.714
cache size : 6144 KB
fpu : yes
fpu_exception : yes
cpuid level : 5
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush mmx fxsr sse sse2 syscall nx lm constant_tsc up
rep_good nopl pni monitor ssse3 lahf_lm
bogomips : 4619.42
clflush size : 64
cache_alignment : 64
> If so, that is not a valid test of the low-level hardware interface.
>
That is right. It is not a valid test for the low-level hardware.
The test is to say that OpenSuse x64 and pk2cmd may
well be not the problem. But rather the low level hardware
interface is the problem.
The low level hardware interface problem can be:
1) PICkit 2 connection to the PIC chips
In the case of PIC18F2455, this tip might help.
http://www.microchip.com/forums/fb.ashx?m=335515
2) OpenSuse Linux kernel driver for the Host USB chipsets
of Tom's PC.
That is the one my test can not cover.
--
Xiaofan
When you call an os api that in effect says, here's a string of bytes to send
to device x on usb bus y, the VM is then out of the picture. There is no
guarantee that the kernel code on the Mac handles it the same way the kernel
code in Suse processes the data.
Having the same (or similar) cpu does tend to give one confidence that pk2cmd
is not the issue, however, I think the most important clue here is that it
works for Tom *on the exact same hardware* running Windows (or did I misread
something?). That's a clear indication that it's not a hardware problem per
se (caps, cable length, voltages, etc.)
Seems to me the most likely explanation is the libusb code, and if that's the
case there may be a way to work around the problem in the pk2cmd code. Too
little is known at this time, but that's the direction I'm leaning.
Jeff
libusb-compat and libusb-1.0 codes may indeed not that
stable since there are a lot of fix not integrated and 1.0.9
release takes forever to release under the leadership
of Peter Stuge. But I doubt they are the problems.
http://libusb.6.n5.nabble.com/libusb-1-0-9-release-td5581933.html
pk2cmd libusb codes may have some minor issues indeed.
#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
The detection of HAVE_LIBUSB_INTERRUPT_MODE
may not be correct and it is not necessary for most
of the distro out there (unless the distro runs Linux 2.2.x).
So probably we can change the above just to one line.
define PICKIT_USB(direction) usb_interrupt_##direction
The other bug is mentioned here.
http://groups.google.com/group/pickit-devel/browse_thread/thread/de9693363e43c9a0
However, my thinking leans on issues with Tom's
particular PC and the particular kernel used.
--
Xiaofan
If you can try the Ubuntu 11.10 32bit build to rule out
problems in pk2cmd with regard to 32bit/64bit.
> Results seem mixed. It looks like it may be a combination of the
> program working with the Linux usb libraries on my hardware ( which
> mixes usb 2 and 3 ).
If you want to pursue that route, you can try to ask in the linux-usb
mailing list. They are quite helpful. But they may ask you to try the
latest Linux kernel.
http://www.linux-usb.org/mailing.html
--
Xiaofan
Jeff
Great. So now at least you have a working setup now.
And since you mentioned that Ubuntu 11.10 64bit does not
work, that does potentially point the problem to pk2cmd.
--
Xiaofan
Could you install libusb 32bit libraries as well using Zypper
or the GUI Add/Remove Software?
> I pulled in libusb-0.1.so.4.4.4 with zypper. It put it in the /lib
> directory. I made a symbolic link to my /usr/lib directory:
> ln -s /lib/libusb-0.1.so.4.4.4 libusb.so
>
> The code linked successfully. I used make install. Voila! The 32-
> bit version works for my 18F2455 and 16F88.
So again the 32bit version works. That again points some
potential problem with pk2cmd codes even though pk2cmd
seems to work for me under 64bit Linux OS but maybe
my tests did not trigger the problems like your tests.
> While this solves my immediate needs, it does leave the original
> problem in place. I don't know if it's worth pursuing further. I
> think time would be better spent developing software for the next
> generation of programmers. I'll be happy to be a guinea pig for
> those. I doubt you'd want my help developing it unless you want
> to do it in Java! :-) (Java and USB? Eeeech! )
>
> Thanks again to you both for all your help.
>
Thanks for your reports as well. Yes indeed the original
problem is still there why 64bit pk2cmd does not work
for you for some chips. Probably pk2cmd codes are the
problem here. If I happen to find something suspicions
(I am not a programmer myself but rather a hardware
designer engineer) I will inform the list.
--
Xiaofan
One easy thing to do is to enable usb debug by modifying
one line in pk2usb.h.
#define USB_DEBUG_FLAGS 0
Change 0 to 1 and you will have debug logs.
Compare the debug logs of the 32bit version of
pk2cmd and 64bit of pk2cmd to see where the
64bit pk2cmd fails on your system. Post the
details and maybe we can identify the problems.
--
Xiaofan
Which version of libusb are you using under 64 bit Linux? On my 32 bit Linux I
have libusb 0.1, not 1.0.
Jeff
Jeff
libusb-0.1 and libusb-1.0 are different and you can have
both of them on either 32bit or 64bit Linux.
libusb-0.1 can be the legacy libusb-0.1 or the libusb-compat
compatibility layer on top of libusb-1.0, depending on the
distros.
More information about libusb.
http://www.libusb.org/ (the website can be dead from time to time)
--
Xiaofan