The Lab Book Pages

An online collection of electronics information

http://www.labbookpages.co.uk

Dr. Andrew Greensted
Last modified: 17th June 2010

Hide Menu


Valid XHTML Valid CSS
Valid RSS VIM Powered
RSS Feed Icon

This site uses Google Analytics to track visits. Privacy Statement

FPGA Configuration

Some general information on FPGA configuration.


Impact Batch Files

Xilinx Impact has a reasonable GUI, however, if you're doing a lot of configuration, using a batch file is much easier.

The batch file below, identify.batch, set the cable mode to boundary scan (JTAG), selects the USB cable, then performs a identification of the devices on the JTAG chain.

File: identify.batch
setMode -bscan
setCable -p usb21
identify
quit

Note: When the devices are listed after the 'identify' command, they are listed in reverse order, with the last device in the chain listed first.

> impact -batch identify.batch

Configuring a Device

Given the device chain shown below (this happens to be from a XUP-V2Pro board), you can configure the FPGA using the batch script below. This basically assigns the file 'download.bit' to device 3 (the FPGA), then programs device 3.

JTAG chain for XUP-V2Pro Development board. FPGA in position 3

JTAG chain for XUP-V2Pro Development board. FPGA in position 3

File: download.batch
setMode -bscan
setCable -p usb21
identify
assignfile -p 3 -file download.bit
program -p 3
quit

Linux Configuration Setup

FPGA configuration under Linux has always been a pain. Especially if when using the windrvr bundled with the Xilinx tools. However, an open source cable driver is available. It is still possible to use the Xilinx Impact tool is using this alternative driver.

Download the driver from http://rmdir.de/~michael/xilinx. Look for the file named usb-driver-HEAD.tar.gz.

To compile you will need libusb installed on your system.

  • Gentoo: emerge libusb
> tar -zxf usb-driver-HEAD.tar.gz
> cd usb-driver
> make

You should now have a file called libusb-driver.so. You can test if it's working using the command below. Note: you need to specify the full path to the driver after LD_PRELOAD

> LD_PRELOAD=/files/src/libusb-driver.so lsmod

You should get something like this:

Module                  Size  Used by
windrvr6                   1  0 
parport_pc                 1  0 

What you can see is the new driver working as the modules that Impact expects to find.

Setting up udev

The 'Platform Cable USB' requires a firmware upload each time it is connected, as do most FPGA development boards with built in USB configuration circuits (Such as the XUP-V2Pro). This can easily be handled with udev.

You need the fxload tool installed for this to work.

  • Gentoo: emerge fxload

Copy the firmware files from your Xilinx install to somewhere handy:

> cp $XILINX/bin/lin/xusb*.hex /usr/share

Now create the udev rule. Create a file called /etc/udev/rules.d/99-xilinx.rules, with the contents shown below.

File: /etc/udev/rules.d/99-xilinx.rules
BUS=="usb", ACTION=="add", SYSFS{idVendor}=="03fd", SYSFS{idProduct}=="0008", MODE="666"
BUS=="usb", ACTION=="add", SYSFS{idVendor}=="03fd", SYSFS{idProduct}=="0007", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusbdfwu.hex -D $tempnode"
BUS=="usb", ACTION=="add", SYSFS{idVendor}=="03fd", SYSFS{idProduct}=="0009", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xup.hex -D $tempnode"
BUS=="usb", ACTION=="add", SYSFS{idVendor}=="03fd", SYSFS{idProduct}=="000d", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_emb.hex -D $tempnode"
BUS=="usb", ACTION=="add", SYSFS{idVendor}=="03fd", SYSFS{idProduct}=="000f", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xlp.hex -D $tempnode"
BUS=="usb", ACTION=="add", SYSFS{idVendor}=="03fd", SYSFS{idProduct}=="0013", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xp2.hex -D $tempnode"
BUS=="usb", ACTION=="add", SYSFS{idVendor}=="03fd", SYSFS{idProduct}=="0015", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xse.hex -D $tempnode"

It is now possible to use start impact. Either start the GUI, or use a batch script as described above.

> LD_PRELOAD=/files/src/libusb-driver.so impact
> LD_PRELOAD=/files/src/libusb-driver.so impact -batch identify

Book Logo