User Tools

Site Tools


xilinx:impact

Cable locked

Occasionally something may happen that causes you to need to force an unlock

impact -batch
cleancablelock
exit

Batch mode

Examples for various boards. Basically use the GUI to figure out how the scan chain is setup and copy/paste the commands from the window

“-p 1” means program at boundary scan position one (starting with number 1). Use the GUI to figure out where in the chain your device is

Sample output:

#!/usr/bin/env bash

date

# Digilent Spartan 3E500
# KC705 (Kintex 7)
# Nexys4 Artix-7 FPGA Board
POS=1
# ML605 (Virtex 6)
#POS=2

if grep -Hn 'Your design did not meet timing' *.par
then
  echo 'Timing failed'
  exit 1
fi

echo
impact -batch /dev/stdin <<EOF
setMode -bs
setCable -port auto
Identify -inferir 
identifyMPM 
assignFile -p 2 -file "$PWD/my.bit"
Program -p 2
EOF
echo
date |tee _program.txt

Board hints

Spartn 3 Starter (S3E500)

With ISE 14.5 + Ubuntu 12.04, the built in digilent drivers do not work. I also tried latest adept SDK. What did work was to install the usb_driver per instructions below.

Linux driver

Traditionally using impact has been a pain on Linux but has gotten better in recent years. Seems that FTDI chips generally work well out of the box (ex: Nexys4) using the Digiilent Adept API while the older Cypress based controllers (ex: ML605, S3E500) can be hit or miss. Try impact as is first…if an't broke, don't fix it!

Example healthy output

Example unhealthy output

pcusb

Test with platform cable USB II and ISE 14.5, Ubuntu 12.04

sudo apt-get install fxload libusb-0.1-4 libusb-dev
cd /opt/Xilinx/14.5/ISE_DS/common/bin/lin64/install_script/install_drivers/linux_drivers/pcusb
sudo bash ./setup_pcusb
# sudo cp xusbdfwu.rules /etc/udev/rules.d/
# sudo sed -i -e s/SYSFS/ATTR/g /etc/udev/rules.d/xusbdfwu.rules
# sudo sed -i -e 's/BUS=="usb"/SUBSYSTEMS=="usb"/g' /etc/udev/rules.d/xusbdfwu.rules

# Original file has old style udev rules not compatible with Ubuntu 12.04 (unclear when it broke)
sudo tee /etc/udev/rules.d/xusbdfwu.rules >/dev/null <<EOF
# version 0003
ATTRS{idVendor}=="03fd", ATTRS{idProduct}=="0008", MODE="666"
SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="03fd", ATTRS{idProduct}=="0007", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusbdfwu.hex -D $tempnode"
SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="03fd", ATTRS{idProduct}=="0009", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xup.hex -D $tempnode"
SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="03fd", ATTRS{idProduct}=="000d", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_emb.hex -D $tempnode"
SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="03fd", ATTRS{idProduct}=="000f", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xlp.hex -D $tempnode"
SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="03fd", ATTRS{idProduct}=="0013", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xp2.hex -D $tempnode"
SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="03fd", ATTRS{idProduct}=="0015", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xse.hex -D $tempnode"
EOF

sudo cp /etc/hotplug/usb/xusbdfwu.fw/*.hex /usr/share/

Troubleshooting

If dmesg doesn't renumerate the usb device (“new full-speed USB device” several times) you don't have fxload and/or the rules setup correctly

install the libusb package

If you get:

If you are using the Platform Cable USB, please refer to the USB Cable
Installation Guide (UG344) to install the libusb package.

Does /usr/lib/x86_64-linux-gnu/libusb.so exist and is valid? Make sure you have BOTH usb and usb-dev as indicated above installed.

NOTE: xusbdfwu.rules gets deleted by the top level install_drivers as it fails. This can cause a previously successful pcusb to fail. Additionally, setup_pcusb only installs xusbdfwu.rules if the hex file didn't already exist. But it does since it was installed earlier. This copy step works around this bug to make sure that you always get a good installation

Digilent driver

cd /opt/Xilinx/14.5/ISE_DS/common/bin/lin64/digilent
sudo ./install_digilent.sh
sudo apt-get install fxload

Replug the USB device if its already plugged in

Watch out for this message:

INFO:Cse - The fxload application is not installed. This application is required
   when using the Platform Cable USB. This warning should be ignored if you are
   using the Parallel Cable III or Parallel Cable IV. Please download and
   install the fxload-2002_04_11 package. Note that root access is required to
   perform the installation.

usb_driver

When the built in drivers don't work I've had the best luck with this

Steps are something like:

cd /opt/Xilinx
git clone git://git.zerfleddert.de/usb-driver
cd usb-driver
make
./setup_pcusb /opt/Xilinx/14.5/ISE_DS/ISE/

Built in libsub

Starting with ISE 10.1, Xilinx started to bundle libusb support but it had to be manually activated. Modern ISE versions (13+?) use it automatically. Before starting impact:

export XIL_IMPACT_USE_LIBUSB=1

For the older Cypress boards I had to do something like this:

LIB_XILINX_USB_OPEN_SOURCE_DIR=~/usb-driver
LIB_XILINX_USB_OPEN_SOURCE_LIB=$LIB_XILINX_USB_OPEN_SOURCE_DIR/libusb-driver.so
LIB_XILINX_USB_OPEN_SOURCE_LIB_DEBUG=$LIB_XILINX_USB_OPEN_SOURCE_DIR/libusb-driver-DEBUG.so
export LD_PRELOAD=$LIB_XILINX_USB_OPEN_SOURCE_DEBUG

There was also some libusb environment variable but don't have it handy…

Manual fxload

For debugging

cat >~/bin/pc2fxload <<EOF
# Bus 001 Device 020: ID 03fd:0013 Xilinx, Inc.
LS=$(lsusb |grep Xilinx)
bus=$(echo $LS |cut -c 5-7)
dev=$(echo $LS |cut -c 16-18)
sudo /sbin/fxload -v -t fx2 -I /usr/share/xusb_xp2.hex -D /dev/bus/usb/$bus/$dev

# Bus 001 Device 022: ID 03fd:0008 Xilinx, Inc. 
LS=$(lsusb |grep Xilinx)
bus=$(echo $LS |cut -c 5-7)
dev=$(echo $LS |cut -c 16-18)
sudo chown $USER /dev/bus/usb/$bus/$dev
EOF
chmod +x ~/bin/pc2fxload

lsusb to see something like

Bus 003 Device 007: ID 03fd:0013 Xilinx, Inc.

then

/sbin/fxload -v -t fx2 -I /usr/share/xusb_xp2.hex -D /dev/bus/usb/003/007
microcontroller type: fx2
single stage:  load on-chip memory
open RAM hexfile image /usr/share/xusb_xp2.hex
stop CPU
write on-chip, addr 0x0fd9 len   39 (0x0027)
write on-chip, addr 0x06aa len    5 (0x0005)
...
write on-chip, addr 0x09da len    1 (0x0001)
write on-chip, addr 0x0c20 len  115 (0x0073)
... WROTE: 7962 bytes, 90 segments, avg 88
reset CPU

Now you should see

Bus 003 Device 009: ID 03fd:0008 Xilinx, Inc.

and the light should turn green. Although really should figure out why fxload isn't working

Finally set the permissions

sudo chown johnm /dev/bus/usb/003/008

Not great but got me going in a pinch

References

xilinx/impact.txt · Last modified: 2016/06/01 13:17 by mcmaster-guest