As part of that course we got to use Matlab/Simulink on a trial basis, and received a Xilinx Spartan-3AN Starter Kit that we get to keep.
I have 2 other FPGA boards, the Nexys and Nexys 2 from Digilent. The 3AN board is also made by Digilent, and it's kind of a big brother to the Nexys boards. It adds an Ethernet interface, RS-232 drivers, PS2 keyboard/mouse ports, LCD display, and other things. One of my goals is to build a collection of open source VHDL to access the features of the board.
Fortunately, the recent 10.1 release of ISE supports an optional libusb-based interface to the development system. Once I got that working, things seem stable. I had some initial problems with getting the protections set right, but now that that's resolved I haven't had any more problems.
The normal software install inserts a udev file
/etc/udev/rules.d/xusbdfwu.rules
That sets up the USB interface.
As I understand it, the USB interface comes up in a default state when first
powered on. The UDEV rules detect this event and execute the fxload program
to load appropriate firmware into the USB chip. This means the fxload
program needs to be present (In Debian, apt-get install fxload
).
The USB chip then disconnects and reappears as a new USB device with a new
Product ID (008). If all goes well, it appears in
/proc/bus/usb/devices
like this:
T: Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 5 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=03fd ProdID=0008 Rev= 0.00
S: Manufacturer=XILINX
S: Product=XILINX
The protections for the USB device need to be set so that a non-root user
can access them. This should happen automatically:
xusbdfwu.rules
contains
a line
Which should set the protections properly. The USB device appears
at both
SYSFS{idVendor}=="03fd", SYSFS{idProduct}=="0008", MODE="666"
/proc/bus/usb/001/005
and
/dev/bus/usb/001/005
, where 001 and 005 are the Bus
and Dev numbers as shown in the devices entry above. In my installation,
the /dev
entry is the one that gets changed to mode 666,
and that seems to be the one that libusb uses.
I then start the ISE with the following bash script:
The
#!/bin/sh
# Use the bash dot(.) command to load the Xilinx settings.
. /opt/Xilinx/10.1/ISE/settings32.sh
# Start the program in the background.
LANGUAGE=usenglish XIL_IMPACT_USE_LIBUSB=1 /opt/Xilinx/10.1/ISE/bin/lin/ise &
echo Started process $!
XIL_IMPACT_USE_LIBUSB=1
environment variable tells ISE to use
libusb instead of the windrvr6 kernel driver.
I've now modified the setup to reload programs and use a UART module. It's working nicely so far. I'm setting up another page with more details: AX8_on_Xilinx.shtml
The VGA interface just uses resistors connected to output pins to form a simple 3-channel A/D converter. First step is a test program to verify that the outputs are OK and sync is being generated correctly. The small image included here was photographed from the screen of a VGA display. The VHDL test code is pretty simple and probably not too useful, but it's available for download if anybody wants to look at it.
I built a quad A/D board for use with the Xilinx board. More details are available on a separate page: quad_100mhz_a2d.shtml. In this screenshot I'm generating a sawtooth waveform using a DAC connected to the FPGA, digitizing it using 1 channel of the A/D board, and plotting the output using the VGA output of the Spartan-3AN Starter Kit.
I now have data-transfer software working on Linux. Details and a test example are now online digilent_nexys_usb.shtml