Using Xilinx USB cable on LinuxMint / Ubuntu without windvr

This post is based on information found at the Xilinx JTAG information page . Using the Xilinx JTAG usb programmer without using the proprietary windvr.o (which no longer seems to work with modern kernel’s) kernel module requires that we use the open source libusb driver. There are a number of ways to obtain the driver but I prefer to install from source. The source can be obtained by using the command shown below and as the cable driver will be installed into the /opt/xilinx directory which my normal account (patrickd) doesn’t have write permissions to (/opt/xilinx must be written to using the sudo command or I could sudo to root and install from there, I could also allow write access to the /opt/xilinx but patrickd account but I prefer not to).

patrickd@patrickd-desktop:/opt/xilinx$ sudo git clone git://git.zerfleddert.de/usb-driver

Which generates the following error because git isn’t installed yet;

sudo: git: command not found

To install the Git source control system, run the following command;

patrickd@patrickd-desktop:/opt/xilinx$ sudo apt-get install gitk git-gui
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages were automatically installed and are no longer required:
nautilus-actions
Use ‘apt-get autoremove’ to remove them.
The following extra packages will be installed:
git-core libdigest-sha1-perl liberror-perl tcl8.4 tk8.4
Suggested packages:
git-arch git-cvs git-svn git-email git-daemon-run gitweb cogito tclreadline
Recommended packages:
git-doc curl
The following NEW packages will be installed
git-core git-gui gitk libdigest-sha1-perl liberror-perl tcl8.4 tk8.4
0 upgraded, 7 newly installed, 0 to remove and 2 not upgraded.
Need to get 6206kB of archives.
After unpacking 14.6MB of additional disk space will be used.
Do you want to continue [Y/n]?

Once git is installed its time to try and reinstall the libusb driver, by running the previous command;

patrickd@patrickd-desktop:/opt/xilinx$ sudo git clone git://git.zerfleddert.de/usb-driver

Which will generate the following output although the actual values may differ;

Initialized empty Git repository in /opt/xilinx/usb-driver/.git/
remote: Counting objects: 551, done.
remote: Compressing objects: 100% (325/325), done.
Indexing 551 objects…
remote: Total 551 (delta 315), reused 417 (delta 226)
100% (551/551) done
Resolving 315 deltas…
100% (315/315) done

Change into the lib usb-driver directory then read the README file and attempt to ‘make’ or build the libusb driver;

patrickd@patrickd-desktop:/opt/xilinx$ cd usb-driver/
patrickd@patrickd-desktop:/opt/xilinx/usb-driver$ gedit README
patrickd@patrickd-desktop:/opt/xilinx/usb-driver$ sudo make

Unfortunately this will generate the following set of errors;

patrickd@patrickd-desktop:/opt/xilinx/usb-driver$ make
cc -Wall -fPIC -DUSB_DRIVER_VERSION=”\”2008-04-08 22:39:18\”” usb-driver.c parport.c config.c jtagmon.c -o libusb-driver.so -ldl -lusb -lpthread -shared
usb-driver.c:26:19: error: dlfcn.h: No such file or directory
usb-driver.c:28:20: error: stdlib.h: No such file or directory
usb-driver.c:29:20: error: string.h: No such file or directory
usb-driver.c:30:20: error: unistd.h: No such file or directory
usb-driver.c:31:19: error: fcntl.h: No such file or directory
usb-driver.c:32:23: error: sys/types.h: No such file or directory
usb-driver.c:33:22: error: sys/stat.h: No such file or directory
usb-driver.c:34:22: error: sys/time.h: No such file or directory
usb-driver.c:35:19: error: stdio.h: No such file or directory
usb-driver.c:36:17: error: usb.h: No such file or directory
usb-driver.c:37:20: error: signal.h: No such file or directory
usb-driver.c:38:21: error: pthread.h: No such file or directory
usb-driver.c:39:19: error: errno.h: No such file or directory
usb-driver.c:40:22: error: inttypes.h: No such file or directory
usb-driver.c:41:23: error: sys/ioctl.h: No such file or directory
usb-driver.c:42:25: error: sys/utsname.h: No such file or directory
usb-driver.c:43:27: error: bits/wordsize.h: No such file or directory
In file included from usb-driver.c:44:
usb-driver.h:253: error: expected specifier-qualifier-list before ‘uint32_t’
usb-driver.c:47: error: ‘NULL’ undeclared here (not in a function)
usb-driver.c:52: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
usb-driver.c:53: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
usb-driver.c:58: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
usb-driver.c:62: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘int_wait’
usb-driver.c: In function ‘hexdump’:
usb-driver.c:70: warning: implicit declaration of function ‘fprintf’
usb-driver.c:70: warning: incompatible implicit declaration of built-in function ‘fprintf’
usb-driver.c:70: error: ‘stderr’ undeclared (first use in this function)
usb-driver.c:70: error: (Each undeclared identifier is reported only once
usb-driver.c:70: error: for each function it appears in.)
usb-driver.c:74: warning: incompatible implicit declaration of built-in function ‘fprintf’

In order to build the libusb driver, the libusb-dev files are required. Fortunately these files are currently available in the Debian archives and can be installed via the following command;

patrickd@patrickd-desktop:/opt/xilinx/usb-driver$ sudo apt-get install libusb-dev
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages were automatically installed and are no longer required:
nautilus-actions
Use ‘apt-get autoremove’ to remove them.
The following extra packages will be installed:
libc6-dev linux-libc-dev
Suggested packages:
glibc-doc manpages-dev
The following NEW packages will be installed
libc6-dev libusb-dev linux-libc-dev
0 upgraded, 3 newly installed, 0 to remove and 2 not upgraded.
Need to get 3978kB of archives.
After unpacking 17.6MB of additional disk space will be used.
Do you want to continue [Y/n]?

Now to re-run the ‘make’ command;

patrickd@patrickd-desktop:/opt/xilinx/usb-driver$ sudo make
cc -Wall -fPIC -DUSB_DRIVER_VERSION=”\”2008-04-08 22:39:18\”” usb-driver.c parport.c config.c jtagmon.c -o libusb-driver.so -ldl -lusb -lpthread -shared
cc -DDEBUG -Wall -fPIC -DUSB_DRIVER_VERSION=”\”2008-04-08 22:39:18\”” usb-driver.c parport.c config.c jtagmon.c -o libusb-driver-DEBUG.so -ldl -lusb -lpthread -shared

Once the driver has been build it must be added to the environment variables, this is done by adding the following to .bashrc;

export LD_PRELOAD=/opt/xilinx/usb-driver/libusb-driver.so

Once this step has been completed the final step is to add the USB driver to the udev rules set, this is achieved by (taken from http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/archive/2007/03/msg00101.html );

5) Make a new udev rule set file
$ sudo vi /etc/udev/rules.d/50-xilinx-usb-pav.rules # a new file with
arbitrary name (“50″ is recommended)
6) paste the following into this file, and save it
ACTION==”add”, BUS==”usb”, SYSFS{idVendor}==”03fd”, MODE=”666″
7) restart udev with:
$ /etc/init.d/udev restart

13 Responses to Using Xilinx USB cable on LinuxMint / Ubuntu without windvr

  1. Stefan says:

    I’m having problems compiling usb-driver on fc8
    In file included from xpcu.c:9:
    usb-driver.h:253: error: expected specifier-qualifier-list before ‘uint32_t’
    make: *** [libusb-driver.so] Error 1

    libusb-driver is installed. Any ideas? I’m using the git version of usb-driver.

  2. Paddy says:

    Hi,

    This error appears to only happen with Fedora 8. The fix for this appears to be, change uint32_t to u_int32_t at line 253 in usb-driver.h and change uint64_t to u_int64_t at line 254 in usb-driver.h.

  3. Matt says:

    I still get:

    WARNING:iMPACT:923 – Can not find cable, check cable setup !

    when I run iMPACT and try to do anything with the cable. My cable is USB to USB (one end is the standard USB terminator, the other end is like the one printers use). Does that count as JTAG? Is JTAG just the protocol?

    Any help?

    Spartan-3E Starter Board
    Xilinx ISE WebPack 11.1
    32-bit Ubuntu 9.04

    • Paddy says:

      Hi Matt, It sounds like your still missing the JTAG programmer, you need to connect the Red device in this picture to the USB cable (printer connection side) and then connect the JTAG programmer to your development board.

  4. George Smart says:

    The line

    export LD_PRELOAD=/opt/xilinx/usb-driver/libusb-driver.so

    needs to be changed to

    export LD_PRELOAD=/opt/Xilinx/usb-driver/libusb-driver.so
    (such that Xilinx has a capital)

    Else I get problems about it not being able to preload the driver and thus it gets ignored.

    • Paddy says:

      It looks like Xilinx have changed the installation path in newer release’s of ISE. So, I’ve added you comment here for future reference.

  5. George Smart says:

    I too am having the same problem.

    Spartan-3E Starter Board
    Xilinx ISE WebPack 11.1
    Linux Mint 7 Gloria – Main Edition (i686/32bit)

    I got everything installed okay, and with bo problems noticeable. Apart from that noted above, that is.

    However, I go to iMPACT and try to do anything, I get

    WARNING:iMPACT:923 – Can not find cable, check cable setup !

    I have tried under cable setup, to select the USB one, and get the following:

    PROGRESS_START – Starting Operation.
    Reusing A0035551 key.
    Reusing 24035551 key.
    OS platform = i686.
    Connecting to cable (Usb Port – USB21).
    Checking cable driver.
    File version of /opt/Xilinx/11.1/ISE/bin/lin/xusbdfwu.hex = 1030.
    File version of /usr/share/xusbdfwu.hex = 1030.
    Using libusb.
    Cable connection failed.
    PROGRESS_END – End Operation.
    Elapsed time = 0 sec.
    WARNING:iMPACT – The cable selected is not avaliable, please select a different one.

    Any help would be greatly appreciated. Kind Regards

    George Smart
    Department of Electronic and Electrical Engineering
    University College London

    • Paddy says:

      George,

      I haven’t upgraded to Gloria yet. However, I vaguely remember an error message something like this and I think the way I got round it was to shut my machine down, plug the cable into a windows machine and download a bitstream to a board then connect the cable backup to the linux machine and power up again. Everything seemed to work fine after that.

      If you discover any other solutions to this problem drop a comment here, so that others can benefit from your debugging🙂

      P.

  6. […] libusbドライバは、ISE付属のものがあるはずなのですが、うまくいかないので、こちらを参考にインストールします。 […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: