Ethernet MATLAB as AXI Master for Xilinx Zynq SoC Devices

To implement HDL Verifier™ Support Package for Xilinx® Zynq®-based hardware features, you must configure the host computer and the hardware for proper communication. After you install the support package, follow these steps to manually set up the hardware.

Step 1. 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 network interface card (NIC) with a Gigabit Ethernet cable or a universal serial bus (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. It is also necessary for sending and receiving signals to and from the hardware.

  • SD card reader and writable SD card – If the host machine does not have an integrated card reader, use an external USB SD card reader.

  • Supported hardware – This feature provides support to Xilinx Zynq-7000 ZC706 and Xilinx Zynq ZedBoard™ boards. Do not connect or turn on the device until you are prompted at a later step.

  • Ethernet cable – This cable connects the hardware to the host.

Step 2. 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.

  1. From the Start menu, click Control Panel.

  2. Set View by to Category.

  3. Click Network and Internet.

  4. Click Network and Sharing Center.

  5. On the left pane, click Change adapter settings.

  6. 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.

  7. 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.

  8. Double-click Internet Protocol Version 4 (TCP/IPv4).

  9. On the General tab, select Use the following IP address.

  10. 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, a compatible IP address must be assigned to the host network connection. Set the host network IP address to 192.168.0.x, where x 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.

  11. Leave the subnet mask set to the default value of 255.255.255.0.

  12. 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.

  1. Set the host network IP address to 192.168.0.x, where x is either 1 or an integer in the range [3, 255]. Set this value by using the ifconfig command. For example, enter this command in the shell.

    % sudo ifconfig ethZ 192.168.0.4 netmask 255.255.255.0 

    In this syntax, ethZ is the name of the host Ethernet port (usually eth0, eth1, and so on). To use the sudo command, you might have to enter a password.

  2. Confirm the changes by entering this command in the shell.

    % ifconfig ethZ

    ethZ is the name of the host Ethernet port you set in the previous step.

Step 3. Copy Image to SD Card in Host System

You need an SD memory card that is configured with the firmware of this support package. The firmware includes the embedded software and the FPGA programming file necessary for using the hardware as an I/O peripheral. If you have already copied the SD card with the required image, skip this step.

  1. Insert a 4 GB or larger SD memory card into the memory card reader on the host computer.

    Note

    If the SD card is lockable, you must unlock it first. If you use a lockable SD card adapter for a microSD card, you must unlock the card before inserting into the memory card reader.

  2. Use the copyImageToHostSDCardPath function to copy the board-specific SD card image files to the specified SD card drive location in the host system. The SD card image files contain a bootloader and supported operating system information. This function also copies the server daemon for handling the AXI Master host commands on the target SoC device.

    The default SD card image is the SD card files that come with the HDL Verifier Support Package. A custom SD card image is a user-created SD card files.

    Examples

    To copy a default SD card image to a specified location on the host computer on a Windows platform for a Xilinx Zynq-7000 ZC706 board with a default IP address, enter this code at the MATLAB command prompt.

    copyImageToHostSDCardPath('ZC706','G:');

    To copy a default SD card image to a specified location on the host computer for a Xilinx Zynq-7000 ZC706 board with a custom IP address and specify the gateway on a Linux platform, enter this code at the MATLAB command prompt. Set the host NIC address to 192.168.10.x, where x must be 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');

    To copy a custom SD card image to a specified location on the host computer for a Xilinx Zynq-7000 ZC706 board with a default IP address on a Windows platform, enter this code at the MATLAB command prompt.

    Before running 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 system.

    copyImageToHostSDCardPath('ZC706','G:','SDCardImage','C:\mywork\hdlv_prj\sdcard_image\zc706_sdcard_zynq7000');

Step 4. Update SD Card Image in SoC Device (Optional)

If you have already copied the SD card image files by using the process in Step 3. Copy Image to SD Card in Host System, skip this step.

Use the loadImageToTargetSDCardPath function to update the SD card image in the SoC device. Before proceeding with this step, ensure that the SD card is inserted in the target SoC device SD card location and that an Ethernet connection is established between the host system and the target SoC device.

This function updates the existing board-specific SD card image files in the SoC device. You might need to wait for at least 20 seconds for the SD card to update.

Examples

To copy a default SD card image to the target SoC device SD card location, enter this code at the MATLAB command prompt.

loadImageToTargetSDCardPath('ZC706');

To copy a custom SD card image to the target SoC device SD card location for a Xilinx Zynq-7000 ZC706 board with the default IP address on a Windows platform, enter this code at the MATLAB command prompt.

Before running 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 system.

loadImageToTargetSDCardPath('ZC706','SDCardImage','C:\mywork\hdlv_prj\sdcard_image\zc706_sdcard_zynq7000');

To copy a default SD card image to a specified location on the host computer for a Xilinx Zynq-7000 ZC706 board with an IP address that is different from the default value, enter this code at the MATLAB command prompt.

loadImageToTargetSDCardPath('ZC706','DeviceAddress','192.168.10.2','Gateway','192.168.10.1');

Step 5: Load Bitstream File to SoC Device (Optional)

Use the loadBitstream function only if you have any new FPGA design to load on the target SoC device. Otherwise, skip this step.

This function loads the custom FPGA bitstream file and its corresponding device tree blob (DTB) file to the target SoC device. You might need to wait for at least 20 seconds to get the changes updated to the target SoC device.

Examples

To load a custom FPGA bitstream and its corresponding DTB file to the target SoC device for a Xilinx Zynq-7000 ZC706 board with a default IP address, enter this code at the MATLAB command prompt.

loadBitstream('ZC706','C:\mywork\hdlv_bitstreams\system.bit','C:\mywork\hdlv_bitstreams\devicetree.dtb');

To load a custom FPGA bitstream and its corresponding DTB file to the target SoC device for a Xilinx Zynq-7000 ZC706 board with an IP address that is different from the default value, enter this code at the MATLAB command prompt.

loadBitstream('ZC706','C:\mywork\hdlv_bitstreams\system.bit','C:\mywork\hdlv_bitstreams\devicetree.dtb','DeviceAddress','192.168.10.2');

Once the program is running on your FPGA board, you can create a MATLAB® AXI Master object by using the aximaster object. To access the slave memory locations on the board, use the readmemory and writememory object functions of this object.

See Also

| | |

Related Examples

More About