Difference between revisions of "Programming the FPGA"

From UConn PAN
Jump to navigation Jump to search
 
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Image:Spartan.jpg|right]]
+
= Current Guide to Flashing the Final Production FPGAs =
 +
==Physical Setup ==
 +
*Use the [http://www.xilinx.com/products/boards-and-kits/HW-USB-II-G.htm red Xilinx USB cable box] to connect the digital control board to the computer
 +
*When the Xilinx USB cable box is powered and the control board is off the orange light on the cable box should be orange
 +
*When the Xilinx USB cable box and the control board are powered the light on the cable box should be green and ready for programming
  
The FPGA is the hub of the digital control board and all other chips are connected to and controlled by it.  This article discusses the programming of the FPGA.  All code is written in [[VHDL_tutorial|VHDL]].  For the purposes of testing, each chip has not only a controller written for it, but an emulator as well.
+
== Xilinx Software ==
 +
We use the Xilinx Webpack (free) license. The program and license for tagger-station can be found in /nfs/direct/packages/xilinx.
  
== Open questions ==
+
=== Flashing the Program ===
 +
#Open the Project Navigator
 +
##On Hermes (as of 1/2014) Start->All Programs->Xilinx Design Tools->ISE Design Tools->64-bit Project Navigator
 +
#If the project doesn't load automatically, load the project file Device.xise
 +
##Once loaded the top left window should show the hierarchy with xc3s50a-4vq100 as the top device
 +
##FPGA_main - behavioral (FPGA_main.vhd) should have three square boxes on the left with the top one being green. This indicates that this is the top-level file
 +
#Edit any source files using Vim outside of the Xilinx software
 +
#Right click in the bottom left window on Configure Test Device and select "Rerun All"
 +
##This will rerun Synthesize-XST, Implement Design, Generate Programming File, and Configure Target Device
 +
#Run Generate Target PROM/ACE File
 +
#Run Manage Configuration Project (iMPACT)
 +
##This will open up the iMPACT program
 +
##Be sure to have all other instances of iMPACT closed otherwise it is likely that there will be a communication error between the computer and the FPGA
 +
##In the screen that pops up there should be a picture of two squares with Xilinx written in them connected to TDI and TDO
 +
##TDI should connect to xcf01s_vo20 with the file device.mcs underneath
 +
##The first square should connect to the second with xc3s50a bypass written underneath, which is then connected to TDO
 +
#In iMPACT in the top left window click on Create PROM File
 +
##This should change the picture on the screen to two devices on the right and a green square on the left with the file fpga_main.bit inside
 +
##In the window titled "iMPACT Processes" run Generate File
 +
##When this succeeds there should be a message displayed in blue stating that it succeeded. Click on the Boundary Scan tab or on Boundary Scan in the top left window
 +
#Click on the left device, which should be labeled as Target and xcf01s_vo20 device.mcs.
 +
#Click on Program in the iMPACT Processes window
 +
##This should erase any previous programming and flash the new program onto the FPGA
  
Programming of the FPGA is an ongoing project, so more questions may be added as the project develops.
+
= Igor's Guide to Flashing the First Prototype FPGA =
* What is the clock speed of the FPGA?  Timing constraints must be taken into account to link the multiple blocks.
+
== Physical Setup ==
* Current designs (11 July, 2007) account for normal activity.  Need to design modules/logic for startup and initialization of each component.  This should not be only on startup; we should be able to send a reset packet over Ethernet to trigger a reinitialization of each chip.
+
*Use the red Xilinx USB cable box to connect the digital control board to the computer.
* Do the parts work on falling or rising edges of the clock?  Most VHDL designs are currently on rising edges, but this can be easily corrected.
+
*The instructions for mapping the colored wires to the digital control board can be found in the "Data Acquisition Station Log + Readout Electronics Project" logbook on pg. 104 in the top left corner.
* The temperature sensor and the ADC share the same SPI-like bus lines; can they be combined into a single VHDL design?
+
*2->red; 4->green; 6->yellow; 8->purple; 10->white; 13->black; gray is unconnected
  
== Component code ==
+
== Xilinx Software ==
  
* [[Programming the DAC]]
+
We use the Xilinx Webpack (free) license. The program and license for tagger-station can be found in /nfs/direct/packages/xilinx.
* [[Programming the temperature sensor]]
 
* [[Programming the ADC]]
 
* [[Programming the Ethernet controller]]
 
  
== Reset and Initialization ==
+
=== Editing the uParam program ===
 +
*Open Xilinx ISE Project Manager
 +
*In the top left window select FPGA_ctrl. This should have 2 boxes and a "+" with the top box green. This indicates a top level project.
 +
*Select uParam within FPGA_ctrl.
 +
*To change the maximum voltage for VBias, change the binary value for DAC_Qmax.
 +
**This is a 14-bit number which is found by following the formula commented out in the program. 3.3V has been used for the reference voltage.
 +
*The maximum gainmode value can be changed similarly.
 +
*Save the file.
 +
*There should be orange question marks in the lower left window. Run "generate programming file". Yellow exclamation marks correspond to warnings but not errors.
  
On start-up the FPGA must reset and initialize each component; especially the Ethernet controller.  Functionality will also be supplied to [[Ethernet_packets#The_reset_cycle|reset the system on a command from the PC]].
+
=== Flashing the program ===
 
+
*Now that the program has been changed and saved, open the Xilinx IMPACT program.
=== The DAC ===
+
*Open IMPACT and go to the folder c/work/Gluex/Tagger/Electronics/FPGA/TotalTest and check to see if fpga_ctrl.bgn and .bit are up to date
 
+
*Open fpga.ipf
The AD5535 DAC has an active-low reset pin.  Pulling that pin low will reset the DAC, zeroing all channels.
+
*There should be 2 diagrams showing the devices on the programming device: TDinput (xcf01s_vo20 fpga.mcs), TDoutput (xc3s50a bypass)
 
+
**EEPROM (on left, chip holds the programming in non-volatile memory and programs FPGA on startup)
=== The temperature sensor ===
+
**FPGA on right, volatile and forgets its programming at every powerdown
 
+
*Make sure that the digital board has power.
The AD7314 temperature sensor does not have a reset function. It self-initializes on powering up.
+
*Select Create PROM file in top left window. Xilinx needs to create a new mcs file out of the bit file before the FPGA can be programmed.
 
+
*The following settings should be used when creating the PROM
=== The ADC ===
+
**Xilinx flash/prom
 
+
**PROM family platform flash
The AD7928 ADC does not have a reset pin, but does require that certain internal registers be reset upon powering up.  The reset procedure is to hold the ''D<sub>in</sub>'' line high while performing two dummy conversions. During both dummy conversions, as well as the third conversation (during which good data can be loaded), invalid data will be returned to the FPGA.  It may be worth considering adding a third conversion to the startup procedure that sets the control register to a certain known setting according to our specifications; perhaps setting the next conversion to return channel zero simply as a known point of operation.
+
**Device xcf01s [1M]. Add if not already there.
 
+
**Output file name: fpga
=== The Ethernet controller ===
+
**Save to /TotalTest
 
+
**Format mcs
The CP2200/1 has a complex reset process, which is laid out in detail in the data sheet (see section 6.2 "Reset Initialization").  The main points of the process will be covered here.
+
**Don't add non-config data.
* The first step is to wait for the reset pin to rise.  No flag will be raised upon the completion of this step other than the reset pin (which is an input to the CP2200/1) being high.
+
**Generate
* The second step is to wait for Oscillator Initialization to complete.  Completion of this will be signaled by an interrupt request signal.
+
*Switch back to the boundary scan tab.
* The third step is to wait for Self Initialization to complete.  Completion of this will also be signaled by an interrupt request signal.
+
*Select EEPROM then select program in the lower left window. Auto-erase normally occurs but if it doesn't, erase and then program.
* At this point all interrupts will be enabled. Any interrupts which the FPGA will not handle should be disabled now.
 
* The physical layer must be initialized, which is itself a multi-step process.
 
** See section 15.7 "Initializing the Physical Layer"
 
** If auto-negotiation is to be used see section 15.2 "Auto-Negotiation Synchronization."
 
* Enable the Link, Act, or Activity/Link LED(s).
 
* The MAC must now be initialized, another multi-step subprocess.
 
** See section 14.1 "Initializing the MAC."
 
* The receive filter must now be configured.
 
** See section 12.4 "Initializing the Receive Buffer, Filter and Hash Table."
 
* The CP2200/1 is now ready for regular operation.
 
 
 
This process should be used sparingly because (1) it is a long, complex process that renders the board unusable for a short time and (2) while the CP2200/1 is initializing the board and the PC are unable to communicate.
 

Latest revision as of 21:13, 6 January 2014

Current Guide to Flashing the Final Production FPGAs

Physical Setup

  • Use the red Xilinx USB cable box to connect the digital control board to the computer
  • When the Xilinx USB cable box is powered and the control board is off the orange light on the cable box should be orange
  • When the Xilinx USB cable box and the control board are powered the light on the cable box should be green and ready for programming

Xilinx Software

We use the Xilinx Webpack (free) license. The program and license for tagger-station can be found in /nfs/direct/packages/xilinx.

Flashing the Program

  1. Open the Project Navigator
    1. On Hermes (as of 1/2014) Start->All Programs->Xilinx Design Tools->ISE Design Tools->64-bit Project Navigator
  2. If the project doesn't load automatically, load the project file Device.xise
    1. Once loaded the top left window should show the hierarchy with xc3s50a-4vq100 as the top device
    2. FPGA_main - behavioral (FPGA_main.vhd) should have three square boxes on the left with the top one being green. This indicates that this is the top-level file
  3. Edit any source files using Vim outside of the Xilinx software
  4. Right click in the bottom left window on Configure Test Device and select "Rerun All"
    1. This will rerun Synthesize-XST, Implement Design, Generate Programming File, and Configure Target Device
  5. Run Generate Target PROM/ACE File
  6. Run Manage Configuration Project (iMPACT)
    1. This will open up the iMPACT program
    2. Be sure to have all other instances of iMPACT closed otherwise it is likely that there will be a communication error between the computer and the FPGA
    3. In the screen that pops up there should be a picture of two squares with Xilinx written in them connected to TDI and TDO
    4. TDI should connect to xcf01s_vo20 with the file device.mcs underneath
    5. The first square should connect to the second with xc3s50a bypass written underneath, which is then connected to TDO
  7. In iMPACT in the top left window click on Create PROM File
    1. This should change the picture on the screen to two devices on the right and a green square on the left with the file fpga_main.bit inside
    2. In the window titled "iMPACT Processes" run Generate File
    3. When this succeeds there should be a message displayed in blue stating that it succeeded. Click on the Boundary Scan tab or on Boundary Scan in the top left window
  8. Click on the left device, which should be labeled as Target and xcf01s_vo20 device.mcs.
  9. Click on Program in the iMPACT Processes window
    1. This should erase any previous programming and flash the new program onto the FPGA

Igor's Guide to Flashing the First Prototype FPGA

Physical Setup

  • Use the red Xilinx USB cable box to connect the digital control board to the computer.
  • The instructions for mapping the colored wires to the digital control board can be found in the "Data Acquisition Station Log + Readout Electronics Project" logbook on pg. 104 in the top left corner.
  • 2->red; 4->green; 6->yellow; 8->purple; 10->white; 13->black; gray is unconnected

Xilinx Software

We use the Xilinx Webpack (free) license. The program and license for tagger-station can be found in /nfs/direct/packages/xilinx.

Editing the uParam program

  • Open Xilinx ISE Project Manager
  • In the top left window select FPGA_ctrl. This should have 2 boxes and a "+" with the top box green. This indicates a top level project.
  • Select uParam within FPGA_ctrl.
  • To change the maximum voltage for VBias, change the binary value for DAC_Qmax.
    • This is a 14-bit number which is found by following the formula commented out in the program. 3.3V has been used for the reference voltage.
  • The maximum gainmode value can be changed similarly.
  • Save the file.
  • There should be orange question marks in the lower left window. Run "generate programming file". Yellow exclamation marks correspond to warnings but not errors.

Flashing the program

  • Now that the program has been changed and saved, open the Xilinx IMPACT program.
  • Open IMPACT and go to the folder c/work/Gluex/Tagger/Electronics/FPGA/TotalTest and check to see if fpga_ctrl.bgn and .bit are up to date
  • Open fpga.ipf
  • There should be 2 diagrams showing the devices on the programming device: TDinput (xcf01s_vo20 fpga.mcs), TDoutput (xc3s50a bypass)
    • EEPROM (on left, chip holds the programming in non-volatile memory and programs FPGA on startup)
    • FPGA on right, volatile and forgets its programming at every powerdown
  • Make sure that the digital board has power.
  • Select Create PROM file in top left window. Xilinx needs to create a new mcs file out of the bit file before the FPGA can be programmed.
  • The following settings should be used when creating the PROM
    • Xilinx flash/prom
    • PROM family platform flash
    • Device xcf01s [1M]. Add if not already there.
    • Output file name: fpga
    • Save to /TotalTest
    • Format mcs
    • Don't add non-config data.
    • Generate
  • Switch back to the boundary scan tab.
  • Select EEPROM then select program in the lower left window. Auto-erase normally occurs but if it doesn't, erase and then program.