Xilinx Platform cable USB and impact on linux without windrv

M

Michael Gernoth

Guest
Hello,
after being bitten by windrvr once again (it did not compile after a
kernel upgrade), I decided to see if I could get the Xilinx USB cable
and impact working without a kernel module.
To achieve this, I have written a wrapper library for impact which
maps calls to windrvr to the userspace libusb-library which should be
available on all modern linux distributions.

With this wrapper I am able to program a XC3S1500 in 2 seconds, which
is the same time it takes when using windrvr.
The library has been developed and solely tested against impact from
ISE Webpack 9.1i SP1 and will very likely not work with older versions
(pre 9.1i).

The library source can be downloaded at:
http://cvs.zerfleddert.de/cgi-bin/viewcvs.cgi/usb-driver.tar.gz?view=tar
or browsed at:
http://cvs.zerfleddert.de/cgi-bin/viewcvs.cgi/usb-driver/

I have also put a precompiled version (built on Debian Etch) at:
http://www.rmdir.de/~michael/xilinx/

Please report back if this library is useful and works for you.
Maybe this helps XILINX to decide that they do not need to use windrvr
for easy USB access, as most parts of my library are only there to
provide a compatible replacement for windrvr functions and are not
needed when directly accessing libusb from within an application
program.

Regards,
Michael
 
On 2007-02-25, Michael Gernoth <mike@gernoth.net> wrote:
Please report back if this library is useful and works for you.
Maybe this helps XILINX to decide that they do not need to use windrvr
for easy USB access, as most parts of my library are only there to
provide a compatible replacement for windrvr functions and are not
needed when directly accessing libusb from within an application
program.
This sounds excellent, especially if it, as you say, can convince xilinx
to use libusb directly :)

I'll have to try this tomorrow at work.

/Andreas
 
On Feb 25, 2:22 am, Michael Gernoth <m...@gernoth.net> wrote:
Hello,
after being bitten by windrvr once again (it did not compile after a
kernel upgrade), I decided to see if I could get the Xilinx USB cable
and impact working without a kernel module.
To achieve this, I have written a wrapper library for impact which
maps calls to windrvr to the userspace libusb-library which should be
available on all modern linux distributions.
This is great! Especially as libusb got ported to Windows as well.

http://libusb-win32.sourceforge.net/

Hope this convinces Xilinx to go a smoother way.
 
On 2007-02-25, Andreas Ehliar <ehliar@lysator.liu.se> wrote:
I'll have to try this tomorrow at work.
Just following up to say that I have successfully tested this on a Suse
10.0 based distribution on i386 to program a Virtex-4 using the platform
USB cable. Great work!

/Andreas
 
Hi Michael,

On 25 Feb., 02:22, Michael Gernoth <m...@gernoth.net> wrote:
To achieve this, I have written a wrapper library for impact which
maps calls to windrvr to the userspace libusb-library which should be
available on all modern linux distributions.
You just made true one of my dreams. Finally! :)) I'll give it a try
ASAP.

Greetings, Torsten
 
On Feb 24, 6:22 pm, Michael Gernoth <m...@gernoth.net> wrote:
Hello,
Please report back if this library is useful and works for you.
Maybe this helpsXILINXto decide that they do not need to use windrvr
for easy USB access, as most parts of my library are only there to
provide a compatible replacement for windrvr functions and are not
needed when directly accessing libusb from within an application
program.
Brilliant! Seems to work for me. I can't test it fully right now
because impact complains with "ERROR:iMPACT:583 - '2': The idcode read
from the device does not match the idcode in the bsdl File." when I
try to download to my ml403 board (which happens when I use the kernel
driver too). But it correctly scans the JTAG chain and reports back
the number/type of devices.

I wasn't able to get it to work on an x86_64 system, but in a i386
chroot I had no problems.

Have you passed on your utility to anyone at Xilinx?

Cheers,
g.
 
Grant Likely wrote:
On Feb 24, 6:22 pm, Michael Gernoth <m...@gernoth.net> wrote:
Hello,
Please report back if this library is useful and works for you.
Maybe this helpsXILINXto decide that they do not need to use windrvr
for easy USB access, as most parts of my library are only there to
provide a compatible replacement for windrvr functions and are not
needed when directly accessing libusb from within an application
program.
Hey Grant, seems we hang out at the same spots ;)


Brilliant! Seems to work for me.

I wasn't able to get it to work on an x86_64 system, but in a i386
chroot I had no problems.
Yes this tool is _great_

It works fine for me with ISE9.1 x86_64.

I decided to install the .hex in /usr/share/usb instead of /usr/share but Impact seemed to look for it in /usr/share so I just needed to add a hook to redirect the "open" to the right place.


Again, Nice work ;)

Sylvain
 
Hi,

On Tue, 13 Mar 2007 14:34:14 +0100, Sylvain Munaut wrote:
Grant Likely wrote:
I wasn't able to get it to work on an x86_64 system, but in a i386
chroot I had no problems.
It works fine for me with ISE9.1 x86_64.
Nice to hear that it now works on x86_64. I had no chance to test it on
such a machine with a connected cable, so I just got the driver to the
point to not detect a cable when I got access to such a machine.

Again, Nice work ;)
Thanks :)

Regards,
Michael
 
On 25 fév, 02:22, Michael Gernoth <m...@gernoth.net> wrote:
Hello,
after being bitten by windrvr once again (it did not compile after a
kernel upgrade), I decided to see if I could get the Xilinx USB cable
and impact working without a kernel module.
[...]
Please report back if this library is useful and works for you.
[...]
Just to add another positive feedback :
* It works like a charm for me !
* I find it very usefull !

My configuration :
* OS : Ubuntu Dapper 6.06
* cable : Xilinx parallel IV
* Xilinx Tool : ISE Webpack 9.1 SP02
* programmed chip : Virtex4 LX25 (of an ML401 board)

For me, it works in "compatibility mode" only, as with "windrvr"
driver.

Many thanks for your work !

Luzerne GANHIR
 
Luzerne <luzerne.ganhir@gmail.com> wrote:
On 25 fév, 02:22, Michael Gernoth <m...@gernoth.net> wrote:
....
[...]
Please report back if this library is useful and works for you.
[...]
Just to add another positive feedback :
* It works like a charm for me !
* I find it very usefull !

My configuration :
* OS : Suse 10.2
* cable : Home brewed parallel cable III derivat
* Xilinx Tool : ISE Webpack 9.1 SP02
* programmed chip : XC95XL72

Thanks
--
Uwe Bonnes bon@elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
 
Please report back if this library is useful and works for you.
Maybe this helps XILINX to decide that they do not need to use windrvr
for easy USB access, as most parts of my library are only there to
provide a compatible replacement for windrvr functions and are not
needed when directly accessing libusb from within an application
program.

Regards,
Michael
Hello

I have been trying to program a Xilinx spartan FPGA board using the
parallel port (jtag) and the ISE webpack 9.1i and I cannot get it to
work with windrvr.

I'm very new to linux but I undestand that you propose an alternative
to windrvr that seems to work well.

I've spent many hours trying to get the windrvr and your driver to
work without success.

Besides i cannot get the windrvr to wort, I don't know how to install
your driver. I downloaded the files compiled them, did export
LD_PRELOAD=/path/to/libusb-driver.so as stated in the README but it
doesn't work. I still get an error saying the windrvr module is not
loaded when I try to program the board.

I would really appreciate some help. I'm new to Linux and I use
Kubuntu 6.10.

Thanks a lot
 
On 23 mar, 07:25, carlos.as...@gmail.com wrote:
I'm very new to linux but I undestand that you propose an alternative
to windrvr that seems to work well.
[...]
I've spent many hours trying to get the windrvr and your driver to
work without success.
[...]
I would really appreciate some help. I'm new to Linux and I use
Kubuntu 6.10.
Here is my "step by step newbie" installation howto for Ubuntu Dapper
6.06 :)

Open a terminal (Application menu : Accessory > Terminal), where you
can enter the given commands (line starting with the $ prompt symbol).

We suppose we are in your prefered directory. For you it is probably
something like "/home/carlos". For this tutorial il will be replaced
by a generic "/path" :

$ pwd
/path

First, you donwload the program's archive in your prefered "/path/
Download" directory.

$ mkdir Download
$ wget "http://cvs.zerfleddert.de/cgi-bin/viewcvs.cgi/usb-
driver.tar.gz?view=tar" -O Download/usb-driver.tar.gz

Now you go in your prefered work directory (for me it is called
"Travail" :) and you decompress the archive.

$ cd /path/Travail
$ tar zxvf /path/Download/usb-driver.tar.gz
$ cd usb-driver

First thing to do is to check if README or INSTALL files exist, and
_READ_ them.

$ ls -l
$ more README

Now you know what to do. First you check the required module are
loaded.

$ lsmod | grep parport
parport_pc 38340 1
parport 39560 3 ppdev,lp,parport_pc

If you get something like that, it's ok. You can compile.

$ make

You may get this kind of error :

gcc -fPIC -Wall usb-driver.c -o libusb-driver.so -ldl -lusb -lpthread -
shared
usb-driver.c:36:17: erreur: usb.h : Aucun fichier ou répertoire de ce
type

It's because you have not installed one of the required libusb and
libusb-dev library.
You can install libusb-dev this way :

$ sudo apt-get install libusb-dev

Now you can retry the compilation.

$ make
gcc -fPIC -Wall usb-driver.c -o libusb-driver.so -ldl -lusb -lpthread -
shared
gcc -fPIC -DDEBUG -Wall usb-driver.c -o libusb-driver-DEBUG.so -ldl -
lusb -lpthread -shared

This time, if everything goes right, you can try impact :) As
explained in the README, set the preload environnement variable (this
will be set only for the current terminal) :

$ export LD_PRELOAD=/path/Travail/usb-driver/libusb-driver.so

Now, you can run impact. But you may get an error :

Can't open /dev/parport0: Permission denied
LPT port is already in use. rc = 0h
Cable connection failed.
Reusing 79063641 key.
Reusing FD063641 key.

It means you have not the required right on the /dev/parport0 device.
You can check this this way :

$ ls -l /dev/parport0
crw-rw 1 root lp 99, 0 2007-03-16 07:48 /dev/parport0

A fast work arround solution is to change the owner of this device :

$ whoami
luzerne
$ sudo chown luzerne /dev/parport0

Before retrying to program a device with impact, it may be necessary
to disbale the eventual impact cable locking. This can be done this
way :

$ impact -batch
setMode -bscan
cleancablelock
quit
Now, you can retry to program a device with impact. This was my "step
by step" personnal log.

http://www.chezmoicamarche.org / YMMV / HTH

Luzerne GANHIR
 
On 22 Mar 2007 23:25:59 -0700, carlos.asmat@gmail.com wrote:
Besides i cannot get the windrvr to wort, I don't know how to install
your driver. I downloaded the files compiled them, did export
LD_PRELOAD=/path/to/libusb-driver.so as stated in the README but it
doesn't work.
I suppose you replaced /path/to/ with the real path to the library and
started ISE or Impact from the shell where you did the LD_PRELOAD?
To make sure that this is the case, you can put the export line in
the settings.sh file generated by the ISE installer.

I still get an error saying the windrvr module is not loaded when I
try to program the board.
If you get that message, then the basic preloading of the library did
not work, as it should tell impact that the windrvr module is loaded.
What happens if you run "lsmod" after running the export LD_PRELOAD?
You should get the following output:

Module Size Used by
windrvr6 1 0
parport_pc 1 0

Regards,
Michael
 
On Thu, 22 Mar 2007 21:01:37 +0000 (UTC), Uwe Bonnes wrote:
My configuration :
* OS : Suse 10.2
* cable : Home brewed parallel cable III derivat
* Xilinx Tool : ISE Webpack 9.1 SP02
* programmed chip : XC95XL72
Thanks Luzerne and Uwe for testing with a parallel cable. I am happy to
hear that it works for other people, too and that even the parallel
cable 4 works (in compatibility mode).

Regards,
Michael
 
Grant Likely wrote:
Brilliant! Seems to work for me. I can't test it fully right now
because impact complains with "ERROR:iMPACT:583 - '2': The idcode read
from the device does not match the idcode in the bsdl File." when I
try to download to my ml403 board (which happens when I use the kernel
driver too).
In that case, try lowering the speed in the cable setup menu. The ID
code problem often happens when the cable speed is too high.
Initializing the JTAG chain works most of the time, but after that
transfers fail. Lowering the speed fixes that for me in most cases.

--
My email address is only valid until the end of the month.
Try figuring out what the address is going to be after that...
 
On Mar 23, 4:16 am, "Luzerne" <luzerne.gan...@gmail.com> wrote:
On 23 mar, 07:25, carlos.as...@gmail.com wrote:

I'm very new to linux but I undestand that you propose an alternative
to windrvr that seems to work well.
[...]
I've spent many hours trying to get the windrvr and your driver to
work without success.
[...]
I would really appreciate some help. I'm new to Linux and I use
Kubuntu 6.10.

Here is my "step by step newbie" installation howto for Ubuntu Dapper
6.06 :)

Open a terminal (Application menu : Accessory > Terminal), where you
can enter the given commands (line starting with the $ prompt symbol).

We suppose we are in your prefered directory. For you it is probably
something like "/home/carlos". For this tutorial il will be replaced
by a generic "/path" :

$ pwd
/path

First, you donwload the program's archive in your prefered "/path/
Download" directory.

$ mkdir Download
$ wget "http://cvs.zerfleddert.de/cgi-bin/viewcvs.cgi/usb-
driver.tar.gz?view=tar" -O Download/usb-driver.tar.gz

Now you go in your prefered work directory (for me it is called
"Travail" :) and you decompress the archive.

$ cd /path/Travail
$ tar zxvf /path/Download/usb-driver.tar.gz
$ cd usb-driver

First thing to do is to check if README or INSTALL files exist, and
_READ_ them.

$ ls -l
$ more README

Now you know what to do. First you check the required module are
loaded.

$ lsmod | grep parport
parport_pc 38340 1
parport 39560 3 ppdev,lp,parport_pc

If you get something like that, it's ok. You can compile.

$ make

You may get this kind of error :

gcc -fPIC -Wall usb-driver.c -o libusb-driver.so -ldl -lusb -lpthread -
shared
usb-driver.c:36:17: erreur: usb.h : Aucun fichier ou répertoire de ce
type

It's because you have not installed one of the required libusb and
libusb-dev library.
You can install libusb-dev this way :

$ sudo apt-get install libusb-dev

Now you can retry the compilation.

$ make
gcc -fPIC -Wall usb-driver.c -o libusb-driver.so -ldl -lusb -lpthread -
shared
gcc -fPIC -DDEBUG -Wall usb-driver.c -o libusb-driver-DEBUG.so -ldl -
lusb -lpthread -shared

This time, if everything goes right, you can try impact :) As
explained in the README, set the preload environnement variable (this
will be set only for the current terminal) :

$ export LD_PRELOAD=/path/Travail/usb-driver/libusb-driver.so

Now, you can run impact. But you may get an error :

Can't open /dev/parport0: Permission denied
LPT port is already in use. rc = 0h
Cable connection failed.
Reusing 79063641 key.
Reusing FD063641 key.

It means you have not the required right on the /dev/parport0 device.
You can check this this way :

$ ls -l /dev/parport0
crw-rw 1 root lp 99, 0 2007-03-16 07:48 /dev/parport0

A fast work arround solution is to change the owner of this device :

$ whoami
luzerne
$ sudo chown luzerne /dev/parport0

Before retrying to program a device with impact, it may be necessary
to disbale the eventual impact cable locking. This can be done this
way :

$ impact -batch

setMode -bscan
cleancablelock
quit

Now, you can retry to program a device with impact. This was my "step
by step" personnal log.

http://www.chezmoicamarche.org/ YMMV / HTH

Luzerne GANHIR
Thank you very much Luzerne for taking the time of explaining it step
by step really clearly and slowly. I really really appreciate it.

What I was doing wrong was doing "export LD_PRELOAD=/path/Travail/usb-
driver/libusb-driver.so" in another terminal session since I thought
this was a kind of global setting.

Again thanks a lot for everything you have done.

Carlos
 
On 25 mar, 22:17, carlos.as...@gmail.com wrote:
Thank you very much Luzerne for taking the time of explaining it step
by step really clearly and slowly. I really really appreciate it.

What I was doing wrong was doing "export LD_PRELOAD=/path/Travail/usb-
driver/libusb-driver.so" in another terminal session since I thought
this was a kind of global setting.

Again thanks a lot for everything you have done.

Carlos
You're welcome. My post was in fact more a contribution given back to
Michael GERNOTH's work than to you :) but I'm happy to know it helps
someone, and to discover this someone is so grateful :)
But I think your greets are misplaced, as Michael GERNOTH deserves all
of them.

Luzerne GANHIR
 
I found some feedback on the microblaze-uclinux mailing list :
http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/archive/2007/03/msg00101.html

This is a mail from Paul-Armand Verhaegen, and it explains the 16
steps he followed to use this usb lib with ISE 8.2 SP3 on Ubuntu, to
download the Virtex2 of a XUPV2P board.

Luzerne GANHIR
 
Getting following error at make step:

adityapappu@adityapappu-NV55C:/opt/Xilinx/usb-driver$ make
cc -Wall -fPIC -DUSB_DRIVER_VERSION="\"2016-07-23 20:34:57\"" usb-driver..c xpcu.c parport.c config.c jtagmon.c -o libusb-driver.so -ldl -lusb -lpthread -shared
parport.c: In function ‘parport_transfer’:
parport.c:21:23: warning: variable ‘last_pp_write’ set but not used [-Wunused-but-set-variable]
static unsigned char last_pp_write = 0;
^
/usr/bin/ld: cannot open output file libusb-driver.so: Permission denied
collect2: error: ld returned 1 exit status
Makefile:28: recipe for target 'libusb-driver.so' failed
make: *** [libusb-driver.so] Error 1
adityapappu@adityapappu-NV55C:/opt/Xilinx/usb-driver$
 
On 07/25/2016 08:03 PM, adityaishwar1994@gmail.com wrote:
Getting following error at make step:

adityapappu@adityapappu-NV55C:/opt/Xilinx/usb-driver$ make cc -Wall
-fPIC -DUSB_DRIVER_VERSION="\"2016-07-23 20:34:57\"" usb-driver.c
xpcu.c parport.c config.c jtagmon.c -o libusb-driver.so -ldl -lusb
-lpthread -shared parport.c: In function ‘parport_transfer’:
parport.c:21:23: warning: variable ‘last_pp_write’ set but not used
[-Wunused-but-set-variable] static unsigned char last_pp_write = 0;
^ /usr/bin/ld: cannot open output file libusb-driver.so: Permission
denied collect2: error: ld returned 1 exit status Makefile:28: recipe
for target 'libusb-driver.so' failed make: *** [libusb-driver.so]
Error 1 adityapappu@adityapappu-NV55C:/opt/Xilinx/usb-driver$
The first one is a warning and may be harmless, the second one says
it can not open libusb-driver.so: Permission denied.
check the permissions. Perhaps you had run the build before as root.
and now it can not overwrite the file, but that is just a guess...
 

Welcome to EDABoard.com

Sponsor

Back
Top