The purpose of this project is to provide reference code for receiving data from an LTC2158-14, dual channel 14-bit 310Msps parallel DDR LVDS interface ADC, with the Altera Stratix IV FPGA development board EP4SGX230KF40C2N.
The Linear Technology design circuit DC1564A-G features the LTC2158-14 ADC. This board provides two ADC channels (DATA_A_IN and DATA_B_IN). Each channel has a 7-bit data bus output in a double data rate format. A reference data clock (CLK_OUT) is also sent from the ADC into the FMC HPC connector present on the board. Using the DC1933A adapter board, a connection between the FMC connector-based Linear Technology board and the HSMC connector-based Altera FPGA board is made possible. The digitized signals coming from the LTC2158-14 will travel through the adapter board and then enter the FPGA fabric where they will be collected and packetized and then transmitted to the host computer over a USB connection for analysis and verification.
Note, in this design the 14-bit data coming from the ADC has been left justified to 16 bits inside the FPGA to ease future integration of 16-bit ADCs.
Description of Hardware Setup
Two DC1164As feed two 70.56MHz sinusoidal waveforms into the DC1564A-G inputs. The magnitude switches are set to different values on the DC1164A boards in order to easily distinguish the signals from each other once plotted.
The adapter board provides a bridge between the HSMC connector and the FMC HPC connector. A very important point to notice is that the adapter board DC1933A, which connects the Linear Technology ADC board with the Stratix IV board, inverts all the differential pairs. This means that on a given differential pair connection between the DC1564A-G board and the Stratix IV board, the P channel from the Linear Technology board connects to the N channel on the Stratix IV board. Consequently, both the data buses and the clock will be inverted. Thus, besides the data bits being inverted, a 180 degree phase shift has been introduced between the clock signal and the data (refer to the Timing Analysis section for further details). The adapter board also inverts the differential pairs in the path from the Stratix IV HSMC to the DC890B edge connector.
The DC590B and the DC890B are optional for the overall system to work and are merely used for debugging and verification purposes.
The DC590B provides a simple and easy way to program the DC1564A-G through an SPI interface for debugging purposes. Through the SPI, the ADC can be programmed to output fixed digital known patterns, turn on the clock duty cycle stabilizer, clock phase delay and more (refer to the LTC2158-14 data sheet for more information on how to program the ADC).
The DC890B provides a real-time verification of our captured signal by displaying, in the time and frequency domain, the data forward by the FPGA using PScope software (see Appendix A for more info on PScope).
|DC1164A||Linear Technology||A 70.56MHz signal source|
|DC1564A-G||Linear Technology||Demo board for the LTC2158-14 ADC. (Device Under Test, DUT)|
|DC1933||Linear Technology||FMC HPC to HSMC adapter board and HSMC to edge connector|
|DC890B||Linear Technology||High speed (up to 250Mbps, CMOS/LVDS) USB data collection board|
|DC590B||Linear Technology||Generic SPI and I2C programmer|
|Breakout Board||Altera||Breakout board for the HSMC connector|
|SPI Cable||Custom||Custom cable from the DC590B pins to the user-selected breakout board pins|
|HSMC Ext. Cable||Samtec||14 in. HSMC to HSMC extension cable|
|Stratix IV||Altera||Altera Stratix IV development board EP4SGX230KF40C2N|
|Host PC||PC running Quartus II, SignalTap II, PScope™ and a terminal|
|8640B||Hewlett Packard||Clock generator source|
FPGA Block Diagram
In our test design, a deserialization factor of 4 is implemented in the FPGA receiver block. This will produce two samples, odd and even, for each channel at a frequency of 155MHz. Each sample is 16 bits wide (14-bit left-adjusted to 16-bit with padding 0’s in the two LSBs). Using a deserialization factor of 4, not only allows us to run the FPGA logic at a lower speed but it also makes it possible to output either even (or odd) sample data at 155Msps to the DC890B for real-time data verification. Remember that the DC890B maximum speed is 250Msps so sending the data at full ADC capacity, 310Msps, would not work and a downsampling of 2 would be necessary before passing the data to the DC890B.
A factor of 4 deserialization scheme is shown in the block diagram in Figure 2.
Altera primitives, such as differential input buffers and DDR buffers, could be used to bring the data buses coming from the ADC into the FPGA and then route them into the SignalTap II block. Nonetheless, a more efficient, compact, and scalable approach is to use the Altera LVDS block. This megafunction provides a full LVDS receiver with dynamic phase alignment (DPA), PLL (internal or external), Bit Slip and deserialization functionality. Note that the DPA, Bit Slip, and deserialization path are bypassed if the deserialization factor is 2 (DDR case). In our design, the DPA and Bit Slip functionalities are not implemented.
A deserialization of 2 could also be used to achieve this data capture at a faster speed rate. Nonetheless, it would require a different time analysis than the one shown in the Timing Analysis section. A factor of 2 deserialization design is outside the scope of this document.
The Altera LVDS Megafunction receiver block diagram is shown in Figure 3.
Lastly, after the incoming data has been received, it needs to be collected and transmitted to the host computer to perform a data integrity check and make sure that the signal is captured properly.
The SignalTap II block provides an easy and fast way to record and output data to a host computer for data analysis and plotting. In our case, we are using a SignalTap II to record 8192 word samples for each channel and then transmit them to the host through USB.
Altera LVDS Receiver Block Diagram
The Altera LVDS Megafunction receiver requires three tightly related clocks in order to execute properly. An external FAST PLL is used in our design to achieve aforementioned clocks. In Stratix IV devices, the Altera PLL Megafunction must be defined as a “Left-Right PLL” in order to be implemented as a FAST PLL.
The three needed clocks are:
- Serial Clock: used to clock the data into the receiver
- Enable Clock: used to enable the receiver
- Parallel Clock: used to register the output of the receiver and for the core logic
The following settings are used in the external PLL:
- Frequency = 620MHz (2 • Input Clock frequency, since incoming data is in DDR format)
- Phase Shift = –180 degrees
- Duty Cycle = 50%
- Frequency = 620/4 = 155MHz (Serial clock divided by deserialization factor)
- Phase Shift = (4 – 2) • 360/4 = 180 degrees [(deserialization factor – 2) • 360/deserialization factor]
- Duty Cycle = 100/4 = 25% (100/deserialization factor)
- Frequency = 620/4 = 155MHz (Serial clock divided by deserialization factor)
- Phase Shift = –180/4 = –45 degrees (serial clock phase shift divided by deserialization factor)
- Duty Cycle = 50%
IMPORTANT: Due to the 180 degrees phase shift introduced by the adapter board DC1933A into the input clock to the FPGA, the Altera ALTLVDS_RX Megafunction needs to be configured to trigger on the FALLING EDGE of the Serial Clock instead of the rising edge in order to compensate for this shift. If another adapter board is used in place of the DC1933A which does not introduce a 180 degree phase shift, then the ALTLVDS_RX should be configured to trigger on the RISING EDGE of the Serial Clock.
The output data is sent out of the FPGA along with the Parallel clock to the DC890B. Due to the 180 degree phase shift introduced again by the adapter board DC1933A, a output delay constraint is necessary in order to capture the data correctly and meet the setup and hold time requirements. In our design, a delay value of 2ns (about 1/3 of the Parallel clock frequency) is used.
For more information about timing and PLL set-tings for high speed LVDS receivers, refer to the Altera application notes listed in Appendix A.
Demo Using DC590B and DC890B Boards
Before you can start running the demo and collecting data, the following software and drivers need to be installed:
- Quartus II with SignalTap II and USB-Blaster driver from Altera’s website
- PScope from Linear Technology’s website
- Any terminal such as HTERM to open a serial port communication
After installing the drivers and programs, set up the hardware as show in the Hardware Setup section of this document. Use the dedicated power supply when available and/or an external power supply to power up the various boards. CAUTION! Refer to each board data sheet for input power requirements. Power up all the boards and turn on the input clock to the ADC board.
In out setup, the DC1564A-G jumper JP1 is set to serial mode and the SPI interface is looped through the FPGA to the DC590B. Parallel mode is also supported but the FPGA needs to drive the SPI pins for proper ADC operation. Refer to the next section for more information on parallel mode.
Some setups may benefit from programming the DC1564A-G to turn on the clock duty cycle stabilizer. In our setup, this step is not necessary. Nevertheless, if you want to do this, set the jumper on the DC1564A-G board to serial programming. On the host machine, open a serial communication with the DC590B using any terminal application. Send the command (in ASCII) xS02S01XZ. A “/n” character will be returned if the transmission was successful. If a DC590B board is not available to you please refer to the next section in this document for more information on how to set the duty cycle stabilizer while in parallel mode.
On the host machine, open the “stp1.stp” under the project folder. The Quartus II suite and SignalTap II tool will start. Make sure the Stratix IV board is connected to the host and the board is powered on. In the SignalTap II window setup the JTAG chain by clicking on the SETUP button in the upper right corner of the screen. Once the JTAG chain has been detected, attach the “linear_1564a.sof” file found in the project folder and program the device.
Once programmed, click the “Run” button in SignalTap II to start capturing and displaying data. SignalTap II will continue capturing data as long as there is a valid incoming signal.
Leaving SignalTap II running, open PScope. Make sure the DC890B board is on and that the software detects it properly. Click “Configure→ADC Configuration...” on the top right corner. Set the different parameters as shown in the image bellow and click “APPLY."
Return to the main screen. Choose 8192 as “Size” and a “Blkmn-Harris 92dB” windowing. Click “COLLECT." Data in the time and frequency domain will start displaying.
You can choose which channel to display by switching the dip switch SW3.1 on and off on the Stratix IV development board.
Demo without Using DC590B and DC890B Boards
If a DC590B board is not available to you, the clock duty cycle stabilizer can be turned on by setting the jumper JP1 on the DC1564A-G to parallel mode and by driving the CSn line HIGH from the FPGA. For SDI and SCK, follow SPI pin configuration on Table 2 of the LTC2158-14 data sheet for parallel programming and drive those pins accordingly from the FPGA.
If a DC890B board is not available to you, data can be exported from SignalTap II and saved as a “.csv” file. From SignalTap II click File→Export. Data can be exported in different formats. To select a different format right click any of the data buses in SignalTap II. A menu opens up. Select Bus Display Format and chose the format that more suits your needs. After the format is selected, save and export the file to a .csv.
The data can now be imported into other tools such as Matlab or PScope for post analysis. In order to import the SignalTap II data into PScope, follow these next steps. Stop collecting data on PScope. Go to File→save data as... This will create an .adc file. Open the .adc file with a text editor such as a Notepad++. Replace the data shown in the .adc file with the data from the .csv file (the data format in the .csv file needs to be Sign Decimal). Remember that the data in .csv is four times larger since we left-adjusted the data to 16 bits and therefore it needs to be adjusted. After replacing the values, save the .adc file. In PScope, click File→Load Data...and select the modified .adc file.
Appendix A: Reference Material
Software Tools and Components Data Sheets
- Quartus II Software
- SignalTap II Tool
- PScope Software
- DC1164A Board
- DC1564A-G Board
- DC1933A Board
- DC890B Board
- DC590B Board
- Samtec Extension Cable
- HSMC Connector Specification
- Altera Stratix IV Development Board EP4SGX230KF40C2N
- Altera Breakout Board
- High-Speed Differential I/O Interfaces and DPA in Stratix IV Devices
- Design Example Using ALTLVDS Megafunction & the External PLL Option in Stratix II Devices
- LVDS SERDES Transmitter / Receiver (ALTLVDS_TX and ALTLVDS_RX) Megafunction User Guide
- Phase-Locked Loop (ALTPLL) Megafunction User Guide
Appendix B: Source Code and Time Constraint File
//------------------------------------------------------------------------------ // Company : Fidus Systems // Date : 07/25/2012 // Designer : Javier Rodriguez Molina // Contact : email@example.com // Design Name : DC1564A 14 bit ADC // File Name : linear_1564a.v // Hardware : Stratix IV development board DK- DEV-4SGX230N // Description : // This design captures incoming data from the Linear Technology DC1654A-G board. // The dual channel 14 bit 310Msps DDR LVDS ADC feeds data to the FPGA. The FPGA // captures the 7 bit bus (configurable to 8) and deserializes the stream by a // factor of 4 producing 2 samples (even and odd) at half the speed of the // incoming data (in this case 155MHz). The captured data from either the odd // or even sample is outputed to the HSMC connector on the Stratix development // board for testing and it is also captured by Signal Tap. Refer to the // DC1564A Design Document for more information Read full article //------------------------------------------------------------------------------