sensicomm LLC logo

Sensicomm LLC - DSP design services.

Algorithms, software and hardware for sensors, signal processing, and communications.
Home About Contact Publications Projects Downloads Sitemap Blog


FPGA's, Linux, Open Source

I use Xilinx FPGA boards and devices for various data acquisition and signal processing functions. This page contains general notes on setting up the development systems and experiences with the open source VHDL code that's available on the web.

IEEE FPGA Course

The IEEE Boston section has been running a course, "Mission-Critical FPGA-based Embedded Systems". I completed that course in spring 2008. It's a good way to get a quick overview of FPGA capabilities, and software development tools. If you're in the Boston area, it's worth checking out.

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.

Getting started on Linux.

Xilinx provides the ISE WebPACK software as a no-cost download for both Windows and Linux. Although they only support Red Hat, I was able to install version 10.1 on my Debian 32-bit system with minimal problems. Some good resources for the install are rmdir.de/~michael/xilinx/ and gentoo-wiki.com/HOWTO_Xilinx. Basically, follow the normal install instructions, and everything works, except the USB interface to the development board.

USB install

Xilinx supplies a device driver (windrvr6) that needs to be installed in the Linux kernel to connect to the development board via USB. By following the instructions in the pages above, I was able to get this interface to work, but it was flakey on my system (like, having to reboot to clear the USB interface).

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

SYSFS{idVendor}=="03fd", SYSFS{idProduct}=="0008", MODE="666"
Which should set the protections properly. The USB device appears at both /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:

#!/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 $!
The XIL_IMPACT_USE_LIBUSB=1 environment variable tells ISE to use libusb instead of the windrvr6 kernel driver.

Hello, World

My first program for this board is a simple script to blink the lights. Check my blog at sensicomm.blogspot.com to see the code.

Processor Cores

The best way to handle many of the peripherals is with an embedded processor. Xilinx provides the MicroBlaze and PicoBlaze, but I wanted to start with an open core, so I can see what's going on under the hood. I found several likely candidates at

The AX8 (AVR-clone) Core

I decided to start with the AX8 core from opencores. This is an implementation of the Atmel AVR instruction set, and is a relatively simple core. It came up pretty easily; my helloworld program in the AVR core blinks the LED's again. Some details are on my blog.

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

VGA test pattern

Colorbars photographed from a video display.

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.

Quad 8-bit 100MHz A/D PCB

Screenshot of sawtooth waveform digitized and displayed on VGA

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.

Using the Nexys USB interface in Linux

Digilent (www.digilentinc.com) makes the Nexys and Nexys II FPGA boards, which have an onboard Cypress CY7C68013A USB chip. This chip can also be used as a communications port, to transfer data between the FPGA and the host PC. Digilent supplies Windows-based tools for this purpose.

I now have data-transfer software working on Linux. Details and a test example are now online digilent_nexys_usb.shtml



$Date: 2016/02/16 12:28:33 $