Xiaofan, I was real excited to see this post. But, alas, I think my issues are more fundamental.
Is there a particular location to put the pk2 source code? The reason is that I have tried both FC6 and FC7 and keeping running into issues of not finding certain .h files in the search path. Probably incorrectly, I add another -I option which fixes one "no such .h file" only to create another. So, I add another -I for that one, and so on. This surely is incorrect. It would seem that most folks just type "make" and things progress.
For example, the first one I encounter is not finding usb.h. However, I find it at /usr/src/kernels/2.6.20-1.2962.fc6-i686/include/linux so add a -I for this path. Next compile attempt it seems that it can't find compiler.h which is in the directory above where I found usb.h. So, I add a -I option for that. And on and on. Clearly, this is nuts. What am I missing that is so fundamental here?
Is the an easy way to check if libusb is installed correctly? Is usb.h part of this or is it separate? Why would Fedora be so different from Ubuntu when it comes to compiling the source?
So, this is where I can use some help. Seems that "make" is a pretty big leap! It's probably obvious stuff to you experts but not for all of us ... some hints would be greatly appreciated in the Mini How-To.
By the way, I tried Piklab too but got as far as the error "usb.h not found, use ./configure LIBUSB_CFLAGS=..." which isn't helping me much other than maybe confirming that my directories are not quite right. Typing locate usb.h does indeed find the file.
I've tried on different computers, one on a fresh install and always have this same problem. I should get points for consistency.
While I've got some experience with C for scientific computing, building code within an environment such as Linux is a new experience. The documentation available is overwhelming to the point of overload when you don't know what you're doing. That seems to be the root of my problems.
On Jun 10, 10:00 am, "Xiaofan Chen" <xiaof...@gmail.com> wrote:
> Is there a particular location to put the pk2 source code?
Nope. Put it anywhere you want.
> For example, the first one I encounter is not finding usb.h.
Xiaofan is the USB expert, so hopefully he has some ideas on this. I wonder though, is usb.h really so different on various Linux installations? Could we not include usb.h in the pk2 distribution and expect it to work on all or most systems? Xiaofan, what do you think?
BTW, work on pk2 version 3 has once again been delayed due to unforeseen obligations on my part. I apologize for the excessive delays, but I am trying to get at least a beta version available as soon as I can. Part of the problem is trying to hit the moving target of features in releases of Microchip's application code. I've decided to lock onto version 2.30 and ignore any further enhancements in their code until after the first release of pk2 v3.
> > Is there a particular location to put the pk2 source code?
> Nope. Put it anywhere you want.
> > For example, the first one I encounter is not finding usb.h.
> Xiaofan is the USB expert, so hopefully he has some ideas on this. I wonder > though, is usb.h really so different on various Linux installations? Could we > not include usb.h in the pk2 distribution and expect it to work on all or > most systems? Xiaofan, what do you think?
I think he did not install libusb and libusb-devel. The two is needed to compile and run pk2. pk2 should not include usb.h since it is changing.
> BTW, work on pk2 version 3 has once again been delayed due to unforeseen > obligations on my part. I apologize for the excessive delays, but I am trying > to get at least a beta version available as soon as I can. Part of the > problem is trying to hit the moving target of features in releases of > Microchip's application code. I've decided to lock onto version 2.30 and > ignore any further enhancements in their code until after the first release > of pk2 v3.
Yeah I agree. Microchip is fast in improving the functionality of PICKit 2.
On 7/27/07, Darrell <dust...@barabashtx.us> wrote:
> For example, the first one I encounter is not finding usb.h. However, > I find it at /usr/src/kernels/2.6.20-1.2962.fc6-i686/include/linux so > add a -I for this path. Next compile attempt it seems that it can't > find compiler.h which is in the directory above where I found usb.h. > So, I add a -I option for that. And on and on. Clearly, this is nuts. > What am I missing that is so fundamental here?
That is not libusb.
> Is the an easy way to check if libusb is installed correctly? Is usb.h > part of this or is it separate? Why would Fedora be so different from > Ubuntu when it comes to compiling the source?
You need to install libusb and libusb-devel. There are no big differences even though the package installation method is different (rpm vs deb, yum vs apt).
Problem solved ... the error was indeed that libusb was not installed (correctly). It appears to be installed but needs to be reinstalled. Or, at least, that is what I found on three different PCs using either FC6 or FC7.
On a PC with a fresh Fedora FC6 installation it looks like libusb is already there: [darrell@garage ~]$ rpm -qa | grep usb libusb-0.1.12-5.1 xorg-x11-drv-sisusb-0.8.1-4.1 usbutils-0.71-2.1
But, I am unable to "make" pk2 or piklib with this installation. Downloaded a fresh version of libusb from Sourceforge and followed the provided instructions exactly. % gzip -cd libusb-0.1.12.tar.gz | tar xvf - # unpack the sources % cd libusb-0.1.12 # change to the toplevel directory % ./configure # run the `configure' script % make # build libusb [ Become root if necessary ] % make install # install libusb
With this done, everything compiles fine. However, when I run pk2 I get the following error: [root@pluto darrell]# pk2 --config PK2 version 2.04 - 2006/12/17 pk2 --config Locating USB Microchip PICkit2 (vendor 0x04d8/product 0x0033) Found USB PICkit as device '012' on USB bus 003 sendUSB() PICkit write : Invalid argument Fatal error> sendUSB() PICkit USB write failed
Not deterred, I was able to build piklab and it works fine and without any errors as long as I run as root. It communicates properly with either pickit1 or pickit2 programmers.
I was also able to build usb_pickit_1.5-jeb. It too works fine with the pickit1 programmer but needs the patch that Xiaofan had posted last year: > You can try to patch usb_pickit.c under Linux. > if (d){ > /* add the following to detach the kernel HID driver under Linux */ > int retval; > char dname[32] = {0}; > retval = usb_get_driver_np(d, 0, dname, 31); > if (!retval) > usb_detach_kernel_driver_np(d, 0); > /* End of added code */
Thanks everyone for the hints. They really helped! Maybe these notes will help someone else too.
Best regards, Darrell ...
On Jul 27, 10:02 pm, "Xiaofan Chen" <xiaof...@gmail.com> wrote:
> You need to install libusb and libusb-devel. There are no big differences > even though the package installation method is different (rpm vs deb, > yum vs apt).
> On 7/27/07, Darrell <dust...@barabashtx.us> wrote:
> > For example, the first one I encounter is not finding usb.h. However, > > I find it at /usr/src/kernels/2.6.20-1.2962.fc6-i686/include/linux so > > add a -I for this path. Next compile attempt it seems that it can't > > find compiler.h which is in the directory above where I found usb.h. > > So, I add a -I option for that. And on and on. Clearly, this is nuts. > > What am I missing that is so fundamental here?
> That is not libusb.
> > Is the an easy way to check if libusb is installed correctly? Is usb.h > > part of this or is it separate? Why would Fedora be so different from > > Ubuntu when it comes to compiling the source?
> You need to install libusb and libusb-devel. There are no big differences > even though the package installation method is different (rpm vs deb, > yum vs apt).
On 7/29/07, Darrell <dust...@barabashtx.us> wrote:
> Problem solved ... the error was indeed that libusb was not installed > (correctly). It appears to be installed but needs to be reinstalled. > Or, at least, that is what I found on three different PCs using either > FC6 or FC7.
> On a PC with a fresh Fedora FC6 installation it looks like libusb is > already there: > [darrell@garage ~]$ rpm -qa | grep usb > libusb-0.1.12-5.1 > xorg-x11-drv-sisusb-0.8.1-4.1 > usbutils-0.71-2.1
You need to install the Fedora "libusb-devel" package to get the headers to be able to compile against libusb.
Installing from source (what you did) works too, but now you have two packages: the Fedora one and your custom one. Sometimes this causes problems, but that's not likely in this case, since the versions are the same.
For future reference, the command to see which package holds a header file looks like this:
$ yum whatprovides /usr/include/usb.h
Regards, Mark markrages@gmail -- Mark Rages, Engineer Midwest Telecine LLC markra...@midwesttelecine.com
On 7/29/07, Darrell <dust...@barabashtx.us> wrote:
> With this done, everything compiles fine. However, when I run pk2 I > get the following error: > [root@pluto darrell]# pk2 --config > PK2 version 2.04 - 2006/12/17 > pk2 --config > Locating USB Microchip PICkit2 (vendor 0x04d8/product 0x0033) > Found USB PICkit as device '012' on USB bus 003 > sendUSB() PICkit write : Invalid argument > Fatal error> sendUSB() PICkit USB write failed
Did you try it as root? It should work. Did you patch the file pk2usb.c as per the mini-howto? You need to do that under later Linux distributions and Mac. Eg: http://forum.microchip.com/tm.aspx?m=241692
> Not deterred, I was able to build piklab and it works fine and without > any errors as long as I run as root. It communicates properly with > either pickit1 or pickit2 programmers.
On Jul 29, 1:44 pm, "Mark Rages" <markra...@gmail.com> wrote:
> You need to install the Fedora "libusb-devel" package to get the > headers to be able to compile against libusb.
> Installing from source (what you did) works too, but now you have two > packages: the Fedora one and your custom one. Sometimes this causes > problems, but that's not likely in this case, since the versions are > the same.
Darn, I guess I was lucky. I don't suppose there is any easy recovery?
> For future reference, the command to see which package holds a header > file looks like this:
On Jul 29, 1:55 pm, "Xiaofan Chen" <xiaof...@gmail.com> wrote:
> Did you try it as root? It should work. > Did you patch the file pk2usb.c as per the mini-howto? You need > to do that under later Linux distributions and Mac.
Yes, the problem was that I didn't apply the patch. With that it then pk2 runs fine as root. I will try setting up the udev rules and report back.
On 8/7/07, sullivan.t <sulliva...@gmail.com> wrote:
> Has anyone been able to successfully get this to work (piklab and > such) with a pickit2 that has firmware > 2.0?
> (I don't mind going back, I was just curious.)
Not yet. Jeff is working on pk2-3.0 and it will support V2.x firmware. Nicolas tried to add the support to piklab but he has not the time to finish the work.
I have similar firmware issue but was unable to find the < 2.0 version firmware. Will older version firmware work with PICkit 2 debug express programmer (has the red button, I read somewhere that's important). If so, can anyone point me in right direction for old firmware?
Thanks, Jesse
On Aug 7, 7:32 pm, "Xiaofan Chen" <xiaof...@gmail.com> wrote:
> On 8/7/07, sullivan.t <sulliva...@gmail.com> wrote:
> > Has anyone been able to successfully get this to work (piklab and > > such) with a pickit2 that has firmware > 2.0?
> > (I don't mind going back, I was just curious.)
> Not yet. Jeff is working on pk2-3.0 and it will support V2.x firmware. > Nicolas tried to add the support to piklab but he has not the time to > finish the work.
On Sep 8, 11:56 am, Kiddjmadd <mad...@alum.rpi.edu> wrote:
> I have similar firmware issue but was unable to find the < 2.0 version > firmware. Will older version firmware work with PICkit 2 debug express > programmer (has the red button, I read somewhere that's important). If > so, can anyone point me in right direction for old firmware?
I don't know if it works, but here's a link to old firmware versions