Capture Data over PS Ethernet
The FPGA data capture feature captures signal data from the FPGA and returns the data to MATLAB® or Simulink® over a JTAG, Ethernet (programmable logic (PL) Ethernet or processing system (PS) Ethernet), or universal serial bus (USB) Ethernet interface. Follow these instructions when you intend to capture data over a PS Ethernet interface. For other supported interfaces, follow the instructions in Data Capture Workflow.
Note
FPGA data capture supports the PS Ethernet interface for the AMD® Zynq® devices only.
Set up hardware board
Copy the compatible secure digital (SD) card image files for the hardware board to an SD card drive path. You can use the
copyImageToHostSDCardPath
orloadImageToTargetSDCardPath
function to perform this step.Set the jumpers on the hardware board to configure the Ethernet interface in peripheral mode.
Connect the Ethernet cable between the host computer and the target board.
Configure host computer
Configure the IP address of the network interface card (NIC) in the host computer after the SD card is booted on the hardware board.
Perform data capture operations
Use the FPGA Data Capture Component Generator tool to configure and generate the data capture IP core. In the tool, set the Connection type parameter to
PS Ethernet
.Add the generated packaged IP core to the Vivado® user repository by using the
addFPGADataCaptureToVivado
function.Integrate the data capture IP into your Vivado design and connect the IP to the signals selected for data capture and specifying the triggers.
Compile the modified FPGA design and generate the BIT file by using Vivado.
Decompile your device tree blob (DTB) file by using the device tree compiler (DTC) tool and edit it to update the reserve memory nodes and LibIIO shared memory devices with respect to the data capture IP address mapping.
Compile the updated DTB file by using the DTC tool.
Use the
loadBitstream
function to load the BIT and DTB files based on your FPGA design.Use one of the following methods to capture data.
Open the FPGA Data Capture tool. Set the trigger, capture condition, and data type parameters, and then capture data into the MATLAB workspace.
Use the generated System object™ derived from
hdlverifier.FPGADataReader
. Set the data types, trigger condition, and capture condition using the methods and properties of the System object, and then call the object to capture data.In Simulink, open the generated model and configure the parameters of the FPGA Data Reader block. Then run the model to capture data.
The following sections describe the setup and data capture steps in detail. You can use the Hardware Setup tool to automate the setup steps for the hardware board and host computer. For more information, see Guided Hardware Setup.
Complete Hardware Checklist
Confirm that you have all required hardware and accessories to complete the hardware setup.
Gigabit Ethernet connection — This connection is often referred to as a network connection. You can use either an integrated NIC with a Gigabit Ethernet cable or a USB 3.0 Gigabit Ethernet adapter dongle. This connection is necessary for transmitting data, such as a programming file, from the host computer to the hardware board. It is also necessary for sending and receiving signals to and from the hardware board.
SD card reader and writable SD card with a capacity of 4 GB or larger — If the host computer does not have an integrated card reader, use an external USB SD card reader.
Supported hardware — You must have a supported hardware board. For the list of supported boards and interfaces, see Supported FPGA Devices for FPGA Verification. Do not connect or turn on the device until you are prompted at a later step.
Ethernet cable — This cable connects the hardware board to the host computer.
Power supply adapter, if the board requires one.
Set Up Hardware Board
Copy Image to SD Card in Host Computer
Copy the compatible SD card image files for the hardware board to an SD card drive path. This SD card image is included with the support package. The image includes the embedded software and the FPGA programming file necessary for using the hardware board as an I/O peripheral. If you have already copied the SD card with the required image, skip this step.
Insert a 4 GB or larger SD card into the card reader on the host computer. The card must be in FAT32 format.
Note
Unlock the SD card before downloading the firmware image to the card. Keep the card unlocked while the card is in the card reader on the board.
Use the
copyImageToHostSDCardPath
function to copy the board-specific SD card image files to the specified SD card drive location in the host computer. The SD card image files contain a bootloader and supported operating system information. This function also copies the server daemon for handling the FPGA data capture host commands on the target hardware board.If you use the Hardware Setup tool to set up your hardware board, this step is automated. See Select a Drive and Load Firmware.
Examples
This example copies a default SD card image to the
G:
drive location on the host computer on a Windows® platform for the ZC706 board with a default IP address.copyImageToHostSDCardPath('ZC706','G:');
This example copies a default SD card image to the
/media/username/261D-2F2B
location on the host computer for the ZC706 board with a custom IP address and specifies the gateway on a Linux® platform. This example sets the host NIC address to192.168.10.x
, where x is an integer in the range [1, 3] or [5, 255].copyImageToHostSDCardPath('ZC706','/media/username/261D-2F2B', ... 'DeviceAddress','192.168.10.4','Gateway','192.168.10.1');
This example copies a custom SD card image to the
G:
drive location on the host computer for the ZC706 board with a default IP address on a Windows platform.Before you run this command, if your custom SD image is in a zipped format, such as
.zip
,.tgz
, or.gz
, extract zipped format files to a specific folder or directory in your host computer.copyImageToHostSDCardPath('ZC706','G:','SDCardImage', ... 'C:\mywork\hdlv_prj\sdcard_image\zc706_sdcard_zynq7000');
Update SD Card Image in Hardware Board (Optional)
If you have already copied the SD card image files by using the process in Copy Image to SD Card in Host Computer, skip this step.
Use the loadImageToTargetSDCardPath
function to update the SD card image on the hardware
board. Before proceeding with this step, make sure that the SD card is inserted in the target
hardware board SD card location and that an Ethernet connection is established between the host
computer and the target hardware board.
The loadImageToTargetSDCardPath
function updates the existing
board-specific SD card image files on the hardware board. You might need to wait for at least
20 seconds for the SD card to update.
Examples
This example copies a default SD card image to the target hardware board SD card location for the ZC706 board.
loadImageToTargetSDCardPath('ZC706');
This example copies a custom SD card image to the target hardware board SD card location for the ZC706 board with the default IP address on a Windows platform.
Before you run this command, if your custom SD image is in a zipped format, such as
.zip
,.tgz
, or.gz
, extract zipped format files to a specific folder or directory in your host computer.loadImageToTargetSDCardPath('ZC706','SDCardImage', ... 'C:\mywork\hdlv_prj\sdcard_image\zc706_sdcard_zynq7000');
This example copies a default SD card image to the target hardware board SD card location for the ZC706 board with an IP address that is different from the default value.
loadImageToTargetSDCardPath('ZC706', ... 'DeviceAddress','192.168.10.2','Gateway','192.168.10.1');
Set Jumper Switches
Set the jumpers on the hardware board to configure the Ethernet cable in peripheral mode. Make sure that the board is turned off. The jumper settings are different for each board. To learn more about the settings, see the board documentation.
For example, set these jumper settings for the ZCU102 board.
Set Jumpers on ZCU102
Set SW6 and other jumpers to the values in this table. The SW6 jumper settings make sure that the board starts up from the SD card.
SW6 Switch | SW6 Switch Position |
---|---|
1 | Up |
2 | Down |
3 | Down |
4 | Down |
To know the jumper settings for the other supported boards, see Set Jumpers.
Configure Host Computer
To connect the hardware to the host, you must configure an available network connection for the hardware on the host. Follow the steps for your specific operating system.
Configure Windows
Follow these instructions for Windows 7 or later.
From the Start menu, click Control Panel.
Set View by to
Category
.Click Network and Internet.
Click Network and Sharing Center.
On the left pane, click Change adapter settings.
Right-click the local area network connection that is connected to the hardware and select Properties.
If an unused network connection is available, the local area connection appears as
Unidentified network
.If you plan to repurpose your network connection, select the local area connection that you plan to use for the hardware.
If you have only one network connection, check if you can connect wireless to the existing local area network. You can use the network connection for the hardware.
You can use a pluggable USB to Gigabit Ethernet LAN adapter instead of a NIC.
On the Networking tab of the Properties dialog box, clear all options except Internet Protocol Version 4 (TCP/IPv4). Other services, particularly antivirus software, can cause intermittent connection problems with the hardware.
Double-click Internet Protocol Version 4 (TCP/IPv4).
On the General tab, select Use the following IP address.
The default IP address of the hardware is
192.168.0.2
. The host network connection must be on the same subnet as the hardware. To meet this requirement, make sure to assign a compatible IP address to the host network connection. Set the host network IP address to 192.168.0.x
, wherex
is either 1 or an integer in the range [3, 255].If the first three octets of the IP address field are not 192.168.0, then your hardware is on another subnet. Enter the same subnet number in the IP address.
Leave the subnet mask set to the default value of
255.255.255.0
.Click OK.
Configure Linux
Set the host Ethernet interface to have a static IP address. This configuration enables communication with the hardware. The default IP address of the hardware is 192.168.0.2. The host network connection must be on the same subnet as the hardware. To meet this requirement, you must assign a compatible IP address to the host network connection.
Set the host network IP address to 192.168.0.
x
, wherex
is either 1 or an integer in the range [3, 255]. Set this value by using theifconfig
command. For example, enter this command in the shell.% sudo ifconfig ethZ 192.168.0.4 netmask 255.255.255.0
In this syntax,
eth
is the name of the host Ethernet port (usually eth0, eth1, and so on). To use theZ
sudo
command, you might have to enter a password.Confirm the changes by entering this command in the shell.
% ifconfig ethZ
eth
is the name of the host Ethernet port you set in the previous step.Z
Perform Data Capture Operations
Configure and Generate Data Capture IP
Use the FPGA Data Capture Component Generator tool to configure and generate the data capture IPs. In the tool:
Set FPGA vendor to
AMD
and Connection type toPS Ethernet
.Specify the port names and sizes for the data capture IP. These ports connect to the signals that you want to capture and the signals that you want to use as triggers for each capture.
Specify how many samples to return, maximum number of trigger stages, and whether to include capture condition logic for the data capture IP.
Click Generate.
The tool generates these data capture components in the specified destination folder:
Packaged IP core, for integration into your FPGA design. The IP core contains:
A port for each signal you want to capture or use as part of a trigger condition.
Memory to capture the number of samples you requested for each signal.
An interface logic (AXI4 subordinate interface) to communicate with the processor.
Trigger and capture condition logic that can be configured at run time.
A ready-to-capture signal to control data flow from the FPGA.
Generation report, with list of generated files and instructions for next steps.
Tool to set capture parameters and capture data to the MATLAB workspace.
Customized version of the data capture System object that provides an alternative, programmatic, way to configure and capture data.
Simulink model that contains a customized FPGA Data Reader block. This model streams the captured signals into the Logic Analyzer waveform viewer. You can also use the Scope block to display the signals.
MAT file in the
format, wheregeneratedIPName
_gensettings.mat
is the name of the generated HDL IP core. This MAT file holds the data capture build parameters. To reload the same design in your next iteration, provide this MAT file as an input argument to thegeneratedIPName
generateFPGADataCaptureIP
function.
Add Data Capture IP to Vivado Project
Add the generated packaged IP cores to the Vivado user repository by using the addFPGADataCaptureToVivado
function.
Create a Vivado project.
Add HDL IPs in the specified folder to the specified Vivado project.
addFPGADataCaptureToVivado("vivadoProjectPath",DataCaptureIPFolder="destinationFolder");
is the name of Vivado project location andvivadoProjectPath
is the name of the folder that contains the generated IP cores.destinationFolder
For example, the following command adds the data capture IPs and JTAG Debug Hub IP in the
hdlsrc
folder to theC:\test_design_zc706\hdl_prj\vivado_ip_prj\vivado_prj.xpr
Vivado project.addFPGADataCaptureToVivado("C:\test_design_zc706\hdl_prj\vivado_ip_prj\vivado_prj.xpr", ... DataCaptureIPFolder="hdlsrc");
Integrate Data Capture IP into Vivado Design
To capture FPGA data, integrate the data capture IP into your Vivado design. To integrate the IP, follow the instructions in the generation report.
Open the Vivado project. Then, open your block design and insert the data capture IP into it.
Connect the subordinate AXI4 interface of the data capture IP to the manager AXI4 interface of the processor.
Connect data capture IP to the signals you requested for capture and triggers.
Complete the block design by connecting the
clk
,clk_enable
,IPCORE_RESETN
,AXI4_ACLK
, andAXI4_ARESETN
input ports of the data capture IP.
Generate DTB File
Generate a DTB file for your hardware board by following these instructions.
Log into the Linux operating system running on the target hardware board.
Navigate to the
/mnt
path.Convert an existing DTB file into a corresponding human-readable device tree source (DTS) file by entering this command in the terminal.
dtc -I dtb -O dts dtb_file.dtb -o devicetree.dts
Where
is the name of your existing DTB file, for example,dtb_file
devicetree.dtb
.To generate a DTB file, you need a device tree compiler (DTC) on a Linux operating system. If a DTC is not installed, get the DTC source code and cross-compile to ARM®.
Open the converted DTS file by entering this command in the terminal.
vi devicetree.dts
Edit the DTS file to update the reserve memory nodes and LibIIO shared memory devices with respect to the data capture IP address mapping.
Examples
The data capture IP address mapping in these examples consists of the following BRAM address region.
Memory-Mapped Region Base Address Range BRAM — mw_axi_bram_ip0 0x40000000 0x200000 (2 MB) Device-tree nodes for a 32-bit ARM Cortex-A9 based Zynq SoC devices
Device-tree nodes for a 64-bit ARM Cortex-A53 based MPSoC devices
You can also compile a DTB file and edit a DTS file on the host Linux computer, but it gives a few warnings during compilation. You can ignore such warnings.
After you edit the DTS file, to generate a DTB file, enter this command in the terminal.
dtc -I dts -O dtb devicetree.dts -o devicetree_sharedmem_iio.dtb
You can now load this modified DTB file to the target hardware board. Use the loadBitstream
function to load the custom FPGA bitstream and DTB files.
Load Bitstream File to Hardware Board
Use the loadBitstream
function only if you have any new FPGA design to load on the target hardware board. Otherwise,
skip this step.
This function loads the custom FPGA bitstream file and its corresponding DTB file to the target hardware board. You might need to wait for at least 20 seconds to get the changes updated to the target hardware board.
Examples
This example loads a custom FPGA bitstream and its corresponding DTB file to the target hardware board for the ZC706 board with a default IP address.
loadBitstream('ZC706','C:\mywork\hdlv_bitstreams\system.bit', ... 'C:\mywork\hdlv_bitstreams\devicetree.dtb');
This example loads a custom FPGA bitstream and its corresponding DTB file to the target hardware board for the ZC706 board with an IP address that is different from the default value.
loadBitstream('ZC706','C:\mywork\hdlv_bitstreams\system.bit', ... 'C:\mywork\hdlv_bitstreams\devicetree.dtb', ... 'DeviceAddress','192.168.10.2');
Capture Data
The FPGA data capture IP core communicates over the Ethernet cable between your FPGA board and the host computer. Make sure that the Ethernet cable is connected. Before capturing data, you can set data types for the captured data, set a trigger condition that specifies when to capture the data, and set a capture condition that specifies the data to be captured. To configure these options and capture data, you can:
Open the FPGA Data Capture tool. Set the trigger, capture condition, and data type parameters, and then capture data into the MATLAB workspace.
Use the generated System object derived from
hdlverifier.FPGADataReader
. Set the data types, trigger condition, and capture condition using the methods and properties of the System object, and then call the object to capture data.In Simulink, open the generated model and configure the parameters of the FPGA Data Reader block. Then, run the model to capture data.
Set Base Address of Data Capture IP and IP Address of Hardware Board
Set the base address of the data capture IP and the IP address of the target hardware
board. To do this, use the CaptureBaseAddress
and DeviceAddress
properties of the hdlverifier.FPGADataReader
System object before capturing data to MATLAB. Set the Device IP address
and Data Capture IP core base
address parameters of the FPGA Data Reader block before capturing
data to Simulink.
For example, the following commands set the base address of the
datacapture1
data capture IP to 40000000
and the IP
address of the target hardware board to 192.168.5.2
.
datacapture1.CaptureBaseAddress = "40000000"; datacapture1.DeviceAddress = "192.168.5.2";
After you capture the data and import it into the MATLAB workspace or Simulink model, you can analyze, verify, and display the data.