May 12, 2022

FPGA - Spartan 3E board - ISE software

Round 3 with the cable drivers

It has been almost 2 weeks since I installed ISE. I am still puzzling over the cable drivers. I have learned a lot and am ready to try it again. First, I am going to try just carefully following the Ubuntu setup guide.

Zerfleddert USB driver

I fetch and build this. Somewhat mysteriously, the only thing that gets done is that it copies the collection of hex files from the ISE distribution and then installs the rules into /etc/udev/rules.d. The driver we compile never seems to get used.
cd /u1/Xilinx
git clone git://git.zerfleddert.de/usb-driver
cd usb-driver
make
I get a few warnings and take a look at them. They are bogus stupid rubbish the compiler should just ignore and accept.

The driver gets used as follows. This line should go into the "ise" script before launching ise. If you have a separate script to launch "impact", it should go there too before launching impact.

export LD_PRELOAD=/u1/Xilinx/usb-driver/libusb-driver.so
su
./setup_pcusb /u1/Xilinx/14.7/ISE_DS/ISE/
This yields:
Looking for USB cable files: /u1/Xilinx/14.7/ISE_DS/ISE//bin/lin64
Copying firmware to /usr/share:
'/u1/Xilinx/14.7/ISE_DS/ISE//bin/lin64/xusbdfwu.hex' -> '/usr/share/xusbdfwu.hex'
'/u1/Xilinx/14.7/ISE_DS/ISE//bin/lin64/xusb_emb.hex' -> '/usr/share/xusb_emb.hex'
'/u1/Xilinx/14.7/ISE_DS/ISE//bin/lin64/xusb_xlp.hex' -> '/usr/share/xusb_xlp.hex'
'/u1/Xilinx/14.7/ISE_DS/ISE//bin/lin64/xusb_xp2.hex' -> '/usr/share/xusb_xp2.hex'
'/u1/Xilinx/14.7/ISE_DS/ISE//bin/lin64/xusb_xpr.hex' -> '/usr/share/xusb_xpr.hex'
'/u1/Xilinx/14.7/ISE_DS/ISE//bin/lin64/xusb_xse.hex' -> '/usr/share/xusb_xse.hex'
'/u1/Xilinx/14.7/ISE_DS/ISE//bin/lin64/xusb_xup.hex' -> '/usr/share/xusb_xup.hex'
Installing udev rules:
done
I might have put the hex files into /usr/local/share, but what the heck. The udev rules are the file /etc/udev/rules.d/xusbdfwu.rules which is:
# 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"
This attemps "/sbin/fxload -v -t fx2 -I /usr/share/xusb_emb.hex -D /dev/bus/usb/001/018", which now fails since I have no file /sbin/fxload on my system. I can fix that, but before I do I get rid of these new udev rules and replug my board just for the record and get:
May 12 16:15:50 trona kernel: usb 1-1.2: New USB device found, idVendor=03fd, idProduct=000d, bcdDevice= 0.00
May 12 16:15:50 trona kernel: usb 1-1.2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
Now I do "su; dnf install fxload", replace the udev script, and I get:
May 12 16:18:37 trona kernel: usb 1-1.2: USB disconnect, device number 25
May 12 16:18:39 trona kernel: usb 1-1.2: new high-speed USB device number 26 using ehci-pci
May 12 16:18:39 trona kernel: usb 1-1.2: New USB device found, idVendor=03fd, idProduct=000d, bcdDevice= 0.00
May 12 16:18:39 trona kernel: usb 1-1.2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
....
May 12 16:18:39 trona systemd-udevd[118647]: 1-1.2:1.0: Process '/sbin/fxload -v -t fx2 -I /usr/share/xusb_emb.hex -D ' failed with exit code 255.
May 12 16:18:39 trona kernel: usb 1-1.2: USB disconnect, device number 26
May 12 16:18:41 trona kernel: usb 1-1.2: new full-speed USB device number 27 using ehci-pci
May 12 16:18:41 trona kernel: usb 1-1.2: not running at top speed; connect to a high speed hub
May 12 16:18:41 trona kernel: usb 1-1.2: New USB device found, idVendor=03fd, idProduct=0008, bcdDevice= 0.00
May 12 16:18:41 trona kernel: usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
May 12 16:18:41 trona kernel: usb 1-1.2: Product: XILINX
May 12 16:18:41 trona kernel: usb 1-1.2: Manufacturer: XILINX
May 12 16:18:44 trona kernel: usb 1-1.2: USB disconnect, device number 27
May 12 16:18:46 trona kernel: usb 1-1.2: new high-speed USB device number 28 using ehci-pci
May 12 16:18:46 trona kernel: usb 1-1.2: New USB device found, idVendor=03fd, idProduct=0008, bcdDevice= 0.00
May 12 16:18:46 trona kernel: usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
May 12 16:18:46 trona kernel: usb 1-1.2: Product: XILINX
May 12 16:18:46 trona kernel: usb 1-1.2: Manufacturer: XILINX
Notably, a green LED next to the USB port lights up a few seconds after the board is powered on (when the firmware download finishes).

So, everything now seems to work fine! But it would rather be on a higher speed port. Full speed is 480 mbit/sec, whereas high speed is 12 mbit/second. Both are USB 2.0 -- The ports on my machine certainly ought to be full speed 2.0. I try a different cable and get the same result. And even using a USB 3.0 port on my machine. Well, this is the least of my problems, so never mind for now (or maybe forever?)

Note that nothing is permanently flashed by fxload -- it just loads fimware for this plug of the device. And note that the product number changes from 000d to 0008, which is what xc3sprog software expects.

Digilent Adept utilities

The above Digilent forum post by Atilla (from 2014) discusses the Adept runtime from Digilent. My Ubuntu guide mentions this, and discussed installing .deb files, which had me worried, but the forum post suggests that .rpm and .tar files are also available. He tells me that I need just the runtime and the utility packages, not the system and SDK.

I download the runtime, both as RPM and tar -- version 2.26.1

I download the utilities, both as RPM and tar -- version 2.7.1

I put all this stuff into /u1/Xilinx/Adept

The utilities RPM installs just fine using "dnf install", but the runtime indicates an error with a post install script, which is not entirely surprising. The utilities are dependent on the runtime, so when I remote the utilities, the runtime goes also.

See below. The reason the runtime "failed" is because I am not running firewalld, and as near as I can tell the RPM installed fine, but was unable to open the port for mdns. So probably I could have just used the RPM files and ignored the error, but how was I to know?

So, I untar the runtime and then "su ; ./install.sh"

It puts libraries into /usr/lib64/digilent/adept
It puts system binaries into /usr/sbin
It puts data files into /usr/share/digilent/adept/data

It puts configuration stuff in /etc

The only executable it puts in sbin is "dftdrvdtch".

Into /etc it places:

/etc/digilent-adept.conf
/etc/udev/rules.d/52-digilent-usb.rules
/etc/ld.so.conf.d/digilent-adept-libraries.conf

The error it gets is because FirewallD is not running, and it may not be able to run something called the "mdns" service. What it tries to do is:

firewall-cmd --permanent --add-service=mdns
firewall-cmd --reload

Now the utilities tarball. I untar it and run "su; ./install.sh"

It puts binaries into /usr/local/bin

Installing binaries.....
    installed dadutil: "/usr/local/bin/dadutil"
    installed djtgcfg: "/usr/local/bin/djtgcfg"
    installed dsumecfg: "/usr/local/bin/dsumecfg"
Successfully installed binaries in "/usr/local/bin"
Installing bitstreams.....
    installed bitstreams for dsumecfg: "/usr/share/digilent/dsumecfg/bitstreams"
Successfully installed bitstreams in "/usr/share/digilent"
Installing manuals.....
    installed dadutil.1: "/usr/local/share/man/man1/dadutil.1"
    installed djtgcfg.1: "/usr/local/share/man/man1/djtgcfg.1"
    installed dsumecfg.1: "/usr/local/share/man/man1/dsumecfg.1"
Successfully installed manuals in "/usr/local/share/man"
Successfully installed Adept Utilities

Tips from Atilla

In the forum post mentioned above, Atilla from Digilent makes some valuable comments about the Adept runtime, in particular how to do things from the command line as follows:
To program the FPGA (from Windows or Linux) you can use:
 - iMpact from Xilinx ISE Design Suite which contains and installs Adept Runtime automatically.
 - djtgcfg from Adept Utilities

Enumerate the attached devices using:

    dadutil enum
    djtgcfg enum

Initialize the scan chain:

    djtgcfg -d Nexys3 init

Program the FPGA:

    djtgcfg -d Nexys3 -i 0 prog -f myproject.bit
Sadly, after all this, I type:
su
djtgcfg enum
No devices found
dadutil enum
No devices found
My Spartan 3E starter is sitting here happy with the green light lit next to the USB cable.

Try impact now

I add the line to include the usb_drive to my ise and impact scripts and type "impact" to launch impact. After dismissing a bunch of dialogs, I double click on "boundary scan", right click the blue text and select "initialize chain" and it works!! It shows 3 devices in a cute little diagram:
xc3s500e
xcf04s
xc2c64a

Feedback? Questions? Drop me a line!

Tom's Computer Info / [email protected]