http://mcuee.blogspot.com/
I know it is not formatted very well ;-(
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.
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.
Jeff
I am not an USB expert and actually I just restart my real
USB learning using PICkit 2.
http://forum.microchip.com/tm.aspx?m=267849
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.
Xiaofan
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).
Ubuntu: apt-get install libusb libusb-devel
Fedora core: yum install libusb libusb-devel
Read some Faqs for Linux distributions will help.
http://www.fedorafaq.org/
http://ubuntuguide.org/
For Piklab, you need to install more packages.
http://piklab.sourceforge.net/wiki/index.php/Compilation_for_Linux
Regards,
Xiaofan
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).
>
> Ubuntu: apt-get install libusb libusb-devel
> Fedora core: yum install libusb libusb-devel
>
> Read some Faqs for Linux distributions will help.http://www.fedorafaq.org/http://ubuntuguide.org/
>
> For Piklab, you need to install more packages.http://piklab.sourceforge.net/wiki/index.php/Compilation_for_Linux
>
> Regards,
> Xiaofan
On Jul 27, 10:02 pm, "Xiaofan Chen" <xiaof...@gmail.com> wrote:
> 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).
>
> Ubuntu: apt-get install libusb libusb-devel
> Fedora core: yum install libusb libusb-devel
>
> Read some Faqs for Linux distributions will help.http://www.fedorafaq.org/http://ubuntuguide.org/
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
mark...@midwesttelecine.com
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.
>
If you do not want to run pk2/piklab as root, you need to set up
udev rules under FC5/FC6 (hopefully the same rules work
under FC7). Please try it and report back. Thanks.
http://piklab.sourceforge.net/wiki/index.php/Port_connection_problems
Thanks for sharing your experiences. I will add some notes to the
Howto when I get the time.
Xiaofan
> 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:
>
> $ yum whatprovides /usr/include/usb.h
This will be a very handy tip. Thanks Mark!
Best Regards,
Darrell
> 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.
Thanks again everyone!
Darrell ...
> If you do not want to run pk2/piklab as root, you need to set up
> udev rules under FC5/FC6 (hopefully the same rules work
> under FC7). Please try it and report back. Thanks. http://piklab.sourceforge.net/wiki/index.php/Port_connection_problems
Yes, this works just as advertised Xiaofan. I tried pk2 and piklab and
both work without being root.
Thanks again all for the help!
Darrell ...
Xiaofan
(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.
Xiaofan
Thanks,
Jesse
On Aug 7, 7:32 pm, "Xiaofan Chen" <xiaof...@gmail.com> wrote:
I don't know if it works, but here's a link to old firmware versions
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en023073