Skip to content

brandoncurtis/fpga

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Field-Programmable Gate Arrays (FPGAs)

one non-computer scientist attempts to figure them out! these demonstrations use the GadgetFactory Papilio Duo with LogicStart, GadgetFactory DesignLab, Xilinx ISE 14.7, all running on Ubuntu 16.04 x64 LTS

Repository File Structure

setup contains additional files to help with setup and installation, described below.

constraints contains the User Constraint File (.ucf) for each board. The .ucf describes how the variables defined and used in the .vhd file are connected to the physical pins on the board.

Switches_LEDs folder containing an implementation of the first 'Hello World'–style VHDL programming example in the Intro to Spartan FPGA eBook by Mike Field, hamster@snap.net.nz. It requires the Papilio Duo with LogicStart board. When you have the sketch working, flipping the switches on the LogicStart board cause the corresponding LEDs to light up. See how very basic .vhd and .ucf files are put together to create a working FPGA sketch!

Installation and Setup

  1. sudo mkdir /opt/xilinx — create the folder we'll be downloading and installing into. You can install anywhere, but this is where I'm installing for demonstration purposes.

  2. sudo chown -R <yourusername>: /opt/xilinx — make sure you own everything in the installer folder.

  3. tar -xvf ~/Downloads/Xilinx_ISE_DS_Lin_14.7_1015_1.tar -C /opt/xilinx/ — After downloading, unpack Xilinx ISE; for Ubuntu, you'll want the enormous (6.09 GB) 'Full Installer for Linux'. A torrent is also available.

  4. cd /opt/xilinx/Xilinx_ISE_DS_Lin_14.7_1015_1 — enter the installer folder.

  5. sudo ./xsetup — run the installer. I installed to /opt/xilinx, so all of the ISE files live in /opt/xilinx/14.7. Choose 'ISE WebPACK' from the list of available options, and uncheck 'cable drivers' and 'license key'; we'll take care of them below.

  6. sudo chown -R <yourusername>: /opt/xilinx — once again, make sure you own everything in the installer folder.

  7. source /opt/xilinx/14.7/ISE_DS/settings64.sh — sourcing this script, which is basically equivalent to running it in the current shell. Note that we are sourcing this script, not running it directly, so there is no need to change its permissions to make it executable.

  8. /opt/xilinx/14.7/ISE_DS/ISE/bin/lin64/ise — start the Xilinx ISE. You'll get a license error, but that's cool. In the license manager, select the free Webpack license; this is supposed to open a page in your default browser, but at least in Firefox this fails (potentially because ISE ships with old versions of several C libraries, but I haven't explored this). That's fine, because you can download a license for free from the Xilinx site as described in GadgetFactory: Install Xilinx Free ISE Webpack. Select your manually-downloaded license file in the license manager.

  9. /opt/xilinx/14.7/ISE_DS/ISE/bin/lin64/ise — restart the Xilinx ISE and verify that you no longer get the licensing error.

  10. Open the Intro to Spartan FPGA Book and work through the initial Switches_LEDs example. The GadgetFactory Papilio Duo contains the same Xilinx Spartan-6 FPGA as the Papilio Pro, so you'll select the same FPGA settings when setting up your FPGA sketch in ISE: Spartan-6, device = XC6SLX9, package = TQG144, speed = 2. The key file's you'll be creating are called 'constraints.ucf' and 'Switches_LEDs.vhd'; see my finished examples in the Switches_LEDs folder of this repo.

  11. Work through the example until you have successfully generated the bitfile that will be written to the FPGA.

  12. sudo mkdir /opt/papilio — create the folder where we'll install the software we need to load the bitfile to the FPGA.

  13. Download the Papilio Loader v2, DesignLab IDE, and the Papilio Loader source from Github into a folder and unzip them all. I unzipped DesignLab IDE to /opt/papilio/designlab, Papilio Loader to /opt/papilio/papilio-loader, and the Papilio Loader source Github repo to /opt/papilio/papilio-loader-repo.

  14. sudo chown -R <yourusername>: /opt/papilio — make sure you own everything in the installer folder.

  15. sudo /opt/papilio/designlab/ubuntu-setup.sh — Run the DesignLab install script. We don't need the DesignLab IDE to write the bitfile to the FPGA, but the DesignLab installer sets some device access rules and installs drivers for the FTDI USB-to-serial interface that we need to use Papilio Loader.

  16. Connect the Papilio Duo to your computer using a mini-USB cable as described in the DsignLab QuickStart. Run lsusb and it should appear as ID 0403:7bc0 Future Technology Devices International, Ltd. Run dmesg, and if your FTDI drivers installed correctly, you should see something like this:


[27488.670773] ftdi_sio 3-1:1.1: FTDI USB Serial Device converter detected
[27488.670858] usb 3-1: Detected FT2232H
[27488.670863] usb 3-1: Number of endpoints 2
[27488.670869] usb 3-1: Endpoint 1 MaxPacketSize 512
[27488.670874] usb 3-1: Endpoint 2 MaxPacketSize 512
[27488.670878] usb 3-1: Setting MaxPacketSize 512
[27488.671173] usb 3-1: FTDI USB Serial Device converter now attached to ttyUSB1

If it's not appearing, try rebooting and reloading the FTDI drivers with modprobe --first-time ftdi_sio. Writing the Papilio Duo device ID to the new_id file with /bin/sh -c 'echo 0403 7bc0 > /sys/bus/usb-serial/drivers/ftdi_sio/new_id may help too; it doesn't hurt, though I haven't analyzed whether it's required (will update soon!).

  1. cd /opt/papilio/papilio-loader-repo/papilio-prog && make clean && ./autogen && ./configure && make && cp papilio-prog /opt/papilio/papilio-loader/programmer/linux32/ && chmod -R u+x /opt/papilio/papilio-loader/programmer/linux32/ — recompile the papilio-prog executable from the Github source files, copy it over into the prebuilt papilio-loader tree, and make it executable. There are instructions available for using the Papilio Loader and it comes with papilio-prog precompiled, but as described in this forum post the precompiled papilio-prog executable is broken in 64-bit Ubuntu and this prevents Papilio Loader from functioning.

  2. /opt/papilio/papilio-loader/papilio-loader.sh — run the Papilio Loader GUI. Select the bitfile you created back in ISE and set it to autodetect the target board and write directly to the FPGA. Write it! As described in the Papilio Loader instructions, writing directly to the FPGA means that the configuration is only temporary until the device loses power. After power-cycling, whatever is currently written to the SPI flash is auto-loaded to the FPGA, which is, in the case of a factory-fresh Papilio Duo, a sketch that flashes LED1 on the LogicStart board and another green LED on the Papilio Duo mainboard.

  3. CONGRATULATIONS. You've joined the proud, the few, the FPGA DIYers!

Additional Resources

Update Log

2016-06-15

  • after extensive installation and configuration testing in a clean Ubuntu 16.04 VM, removed this step from the installation guide:
    0. nano /opt/xilinx/14.7/ISE_DS/settings64.sh — this settings script sets some environmental variables in preparation for launching Xilinx ISE; make the changes highlighted as ### BC CHANGES in the settings64.sh file included in this repo's setup folder.  I have NOT evaluated these changes in-depth.  They come from this YouTube video, and they appear to work!  If you're using a 32-bit system, you'd do all of this to settings32.sh instead.
  • Added a BASH command for untaring the Xilinx ISE download.
  • Added additional description of what boxes to check when installing Xilinx ISE.
  • Added a decription of the key files produced in the Switches_LEDs example.

About

a non-computer scientist's adventures in Field-Programmable Gate Arrays (FPGAs)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published