FPGA Programming Guide
FPGA Programming Guide
Stefan Countryman
Columbia University
Columbia University
Columbia Astrophysics Laboratory
Pupin Hall - MS 5247
New York NY 10027
Phone (212) 854-8209
Fax (212) 854-8121
E-mail: [email protected]
WWW: http://www.ligo.caltech.edu
1
Programming Timing System Devices
Programming FPGAs
This document provides step-by-step instructions for programming the Flash PROM found on
Advanced LIGO timing devices. The aLIGO Timing System relies on modular devices, each of
which contains a field programmable gate array (FPGA) and programmable read-only memory
(Flash PROM). The FPGA’s configuration is initialized on startup according to the data stored
on the Flash PROM. If this data is nonexistent or out of date (e.g. the FPGA code has been
updated, the device is blank from the factory, etc.), the Flash PROM must be programmed for the
device to work. This is accomplished through the JTAG interface present on every Timing
Master Rear Panel and Timing Slave Board. The most efficient programming method, described
here, makes use of Xilinx iMPACT software and the Digilent XUP USB-JTAG Programming
Adapter. Procurement and installation of these tools is described in Appendix I. Alternate JTAG
cables are discussed in Appendix II. Xilinx iMPACT configuration files are discussed in
Appendix III. An alternate programming method relying on Altium Designer and the Altium
USB-JTAG Adapter is outlined in Appendix IV.
2. Connect the XUP USB-JTAG Adapter to the computer. Attach the 14-pin (2mm 2x7) end of
the 14-pin to 10-pin JTAG Adapter (pictured below) to the XUP Adapter:
1
This is a Xilinx iMPACT configuration archive, which is all that is needed for the programming technique here
described. The true FPGA machine code comes in the form of .bit (FPGA) and .mcs (Flash PROM) files, which are
compressed in the .iaf archive. They are also separately available on the Timing Wiki. For instructions on creating
an iMPACT project starting from the .bit and .mcs files, see Appendix III. The files themselves are stored in the
LIGO Document Control Center (DCC). All Timing System FPGA codes, as well as other Timing documents, are
archived in DCC.
2
Programming Timing System Devices
3. Locate the device's 10-pin JTAG port. The port location varies by device, but all are externally
accessible. On the Timing Comparator, the JTAG port is in the center of the front panel:
Connect the 10-pin connector to the device's JTAG port. The top of the adapter is labeled for
clarity. A properly connected Timing Slave-DuoTone assembly would appear as follows:
Top view of adapter: 14-pin side of adapter, left, connected to XUP USB-JTAG Adapter
Front view of Slave-DuoTone assembly: 10-pin side of adapter connected to device's JTAG port
3
Programming Timing System Devices
5. Dialogue Boxes
6. Open the configuration archive. Go to File > Open Configuration Archive (ctrl-H). Select the
.iaf file downloaded in Step 1.1. Choose a location for iMPACT to unzip the contents of the
archive; any will do. (A warning dialogue box might pop up; if it does, dismiss it and continue.)
7. Program the Flash PROM. In the main window, right-click on the left-most device and click
Program:
4
Programming Timing System Devices
Programming should take a few minutes. Its status is displayed via progress bar:
Once complete, a blue box saying “Program Succeeded” should appear at the bottom of the main
window:
8. After the Flash PROM is programmed, the code is generally loaded onto the FPGA
automatically. If the device does not demonstrate proper operation within several moments, the
FPGA can be reset by interrupting the device’s power supply (12V). When power is restored, the
FPGA will be automatically reprogrammed from the Flash PROM.
5
Appendix I: Setting up iMPACT and the USB-JTAG Adapter
1. Xilinx iMPACT software is used to program JTAG devices. It is part of Xilinx ISE
Design Suite. The aLIGO Timing System uses ISE Design Suite version 12.2, available
for free download on Xilinx’s website. Select the Full Installer for Windows (2.96 GB).
Once it has finished downloading, decompress it, run setup, and do a full WebPACK
installation. Though certain FPGA design components cost money, a free WebPACK
license can be created and downloaded off of Xilinx’s website. This can be done by
choosing to open the “Manage Xilinx Licenses” application at the end of the WebPACK
installation, or at any time thereafter by going to Start > Xilinx ISE Design Suite 12.2 >
Accessories > Manage Xilinx Licenses. The free WebPACK license is all that is required
to use iMPACT. Once Xilinx ISE Design Suite 12.2 has been installed and a license has
been downloaded, iMPACT is ready to use.
Digilent XUP USB-JTAG Adapter XUP Adapter, 14-pin (2mm 2x7) JTAG port
Use the aLIGO Timing 14-pin to 10-pin JTAG Cable to connect the XUP Adapter to the
10-pin external JTAG ports, as in Step 2.2. If the 14-pin to 10-pin JTAG Cable is not
available, see Appendix II for instructions on alternate methods for connecting the XUP
Adapter to aLIGO Timing devices. If an XUP Adapter is not available, but an Altium
USB-JTAG Adapter is, see Appendix IV for instructions on programming via Altium.
6
Appendix II: Connecting to JTAG using 14-pin or Flying Wire Adapter
If a 14-pin to 10-pin JTAG Cable is not available, there are two alternate methods for
programming the Flash PROM using the XUP Adapter. Each uses stock cables that are
packaged with the XUP Adapter.
1. The first (and easier) of the two programming methods uses an included ribbon cable
with 14-pin (2mm 2x7) IDC connectors at both ends:
One end of this cable connects to the 14-pin connector on the XUP adapter. The other
end connects to a 14-pin connecter located on the device to be programmed.
Unfortunately, the 14-pin connector is not externally accessible on aLIGO Timing
devices, so this method requires disassembly of the device in question. If this is
inconvenient, proceed to Appendix II, Part 2.
On the Timing Slave, the 14-pin connector is header P6. It is located directly behind the
10-pin external JTAG port:
7
On the Timing Master, the 14-pin connector is header P3. It is located at the rear of the
front board, adjacent to the header for the ribbon connector:
Timing Master connected via 14-pin to XUP; view from front of chassis
Once the connection has been made and the device has been connected to a 12V power
source, programming can proceed as usual.
8
2. If a 14-pin to 10-pin adapter is not available, the XUP adapter can still be connected to
the device's 10-pin JTAG port using the included flying wire adapter:
JTAG flying wire adapter; XUP 14-pin connector on left, leads on right
The flying wire adapter provides one wire for each of the five JTAG signals (TDI, DTO,
TCK, TMS, and VREF/VCCAUX) as well as a ground wire. The signal carried by each
wire is clearly labeled on the white lead. Connect the flying leads to the 10-pin port:
TCK (3)
GND (9)
TDI (1)
TDO (2)
VREF (10)
TMS (4)
Pinout for 10-pin JTAG port
Align the leads with the square cross-section pins. Press firmly—the leads are thick and
will get crowded. After connecting the leads, proceed with programming as usual.
9
3. A table of signal pinouts for the 10-pin Altium JTAG (used by aLIGO Timing devices)
and the 14-pin Xilinx JTAG (used by the Digilent XUP Adapter) is provided for
reference:
Signal Name 10-pin (Altium) pin number 14-pin (Xilinx) pin number
TDI 1 10
TDO 2 8
TCK 3 6
TMS 4 4
Software TDI 5 —
Software TDO 6 —
Software TCK 7 —
Software TMS 8 —
GND/Ground 9 1, 3, 5, 7, 9, 11, 13
VREF/VCCAUX/Detect 10 2
10
Appendix III: Creating an iMPACT project using .mcs and .bit files
If a configuration file is not available, or if nonstandard code needs to be loaded onto the
Flash PROM, it is possible to create a new iMPACT project file from existing binary
code.
2. Open iMPACT. In the opening dialogue box, select "create a new project (.ipf)" and
press "OK" (the project title and save location do not matter):
11
4. Right-click anywhere in the main window and select "Add Xilinx Device..."
Find and select the .mcs file you wish to load onto the Flash PROM.
5. A dialogue box will open asking for a part name. Select xcf08p and click "OK":
A square representing the newly added device will appear in the main window labeled
"xcf08p" with the .mcs filename beneath it.
6. Repeat Part 4, selecting the .bit file you wish to load onto the FPGA. Again, the device
will appear in the main window. If asked, skip SPI/BPI configuration.
12
7. Right-click on the Flash PROM device (the .mcs device, which should be on the left)
and click "Set Programming Properties...":
In the popup window, make sure to check "Verify", "Erase Before Programming", and
"Load FPGA", leaving the other fields unchanged, and press "OK":
8. Save the project file. Proceed from Step 2.6 (p. 4) to program the Flash PROM. To
save a configuration archive, open File > Save Configuration Archive...
13
Appendix IV: Programming the FPGA via Altium Designer
This section describes the Altium Designer method of FPGA programming. Though
significantly slower than the iMPACT method, it can be useful in certain situations. The
aLIGO Timing System FPGA code was written in Altium Designer, so modifications to
the code (and subsequent compiling/programming/testing) must be performed in Altium.
Whether this method is necessary is left to the discretion of the end user.
i. Download the .mcs and .bit files for the FPGA device to be programmed. See Step
1.1 (p. 2) for instructions.
ii. If modifying the FPGA code, also download the correct Altium project file for the
device (this is unnecessary if existing .mcs and .bit files are being used). Altium
project files are stored via subversion archive (SVN). See the Timing FPGA page
for SVN configuration instructions. Use the SVN revision listed on the Timing
FPGA page to obtain the correct file for the device in question.
3. Using Altium Designer. Altium requires an account to run. Once one has been
purchased, the user must sign into his or her account and use Altium as follows:
14
iv. Activate the product by clicking on the “use” button.
15