Main Content

socHardwareBoard

Connection to SoC hardware board

Description

The socHardwareBoard object represents a connection to the specified SoC hardware board from MATLAB®. Use this object to create DataRecorder and socAXIManager objects that record input data and access memory on the specified SoC hardware board.

Creation

Description

hwList = socHardwareBoard() returns a list of supported SoC hardware boards.

hw = socHardwareBoard(boardName) creates a connection to the specified SoC hardware board. This connection reuses the IP address, username, and password from the most recent connection to that specified SoC hardware board. When you connect MATLAB to an SoC hardware board for the first time, enter the board name, IP address, username, and password of the SoC hardware board as name-value pair arguments.

To see the complete list of supported SoC hardware boards, call the socHardwareBoard function without any arguments.

hw = socHardwareBoard(boardName,Name,Value) creates a connection to the specified SoC hardware by using the IP address, user name, and password that you specify.

example

Input Arguments

expand all

Name of supported SoC hardware board, specified as a character vector or string scalar. Specify the name of hardware board to which you want to establish a connection from MATLAB. To get the list of supported hardware boards, call socHardwareBoard function without any arguments.

Example: 'Xilinx Zynq ZC706 evaluation kit'

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: 'username','root'

IP address of the SoC hardware board connected to the network, specified as the comma-separated pair consisting of 'hostname' and a character vector or string scalar.

Example: '192.168.1.18'

Data Types: char | string

Root username used to log in into SoC hardware board connected to the network, specified as the comma-separated pair consisting of 'username' and a character vector or string scalar.

Example: 'root'

Data Types: char | string

Root password used to log in into SoC hardware board connected to the network, specified as the comma-separated pair consisting of 'password' and a character vector or string scalar.

Example: 'password'

Data Types: char | string

Output Arguments

expand all

List of SoC hardware boards that are supported for data logging returned as a string array.

Connection to specific SoC hardware board, returned as a socHardwareBoard object. You can use this connection for data logging of input sources with the DataRecorder object, or you can access memory on the board using an socAXIManager object.

Properties

expand all

This property cannot be changed after you create the socHardwareBoard object.

Name of supported SoC hardware board, specified as a character array or string scalar.

Example: 'Xilinx Zynq ZC706 evaluation kit'

Data Types: char | string

This property cannot be changed after you create the socHardwareBoard object.

IP address of SoC hardware board, specified as a character array or string scalar.

Example: '192.168.1.11'

Data Types: char | string

This property cannot be changed.

IP port number of SoC hardware board.

Example: 18735

Data Types: double

Examples

collapse all

Create a connection from MATLAB to the specified SoC hardware board using the IP address, username, and password of the board.

hw = socHardwareBoard('Xilinx Zynq ZC706 evaluation kit','hostname','192.168.1.18','username','root','password','root');

Create a data recording session on the SoC hardware board by using the hw object. The resulting DataRecorder object represents the data recording session on the SoC hardware board.

dr = soc.recorder(hw)
dr = 

  DataRecorder with properties:

          HardwareName: 'Xilinx Zynq ZC706 evaluation kit'
               Sources: {}                            
             Recording: false                         

List the input sources added to the data recording session.

dr.Sources(hw)
ans =

  1×0 empty cell array                       

By default, soc.recorder objects have no added input sources. To add an input source to the data recording session, first create an input source object by using the soc.iosource function. For this example, create an User Datagram Protocol (UDP) source object.

udpSrc = soc.iosource(hw,'UDP Receive')
udpSrc = 

  soc.iosource.UDPRead with properties:

   Main
              LocalPort: 25000
             DataLength: 1
               DataType: 'uint8'
      ReceiveBufferSize: -1
           BlockingTime: 0
    OutputVarSizeSignal: false
             SampleTime: 0.1000
         HideEventLines: true

  Show all properties

Add this UDP source object to the data recording session by using the addSource object function.

addSource(dr,udpSrc,'UDPDataReceived-Port25000')

Verify the result by inspecting the Sources property of the soc.recorder object.

dr.Sources
ans =

  1×1 cell array

    {'UDPDataOnPort25000'}                        

Call the setup function to initialize all hardware peripheral input sources added to the data recording session, and start the data recording process.

setup(dr)

Record data for 60 seconds on the SoC hardware board.

record(dr, 60);

Check the status of the data recording session by using the isRecording object function. The recording status when data recording is in progress is 1.

recordingStatus = isRecording(dr)
recordingStatus =

  logical

   1

The recording status when data recording is complete is 0.

isRecording(dr)
recordingStatus =

  logical

   0

Save recorded data to a TGZ-compressed file.

save(dr,'UDPDataReceived','UDP Data Testing',{'Recorded On Zynq Board'})

This function saves the recorded data as the file UDPDataReceived.tgz in your working folder of the host PC. You can read this file by using an socFileReader object in MATLAB or an IO Data Source block in your Simulink® model.

Remove the added source from the data recording session by using the removeSource object function.

removeSource(dr,'UDPDataReceived-Port25000')

Verify the result by inspecting the Sources property of the soc.recorder object.

ans =

  1×0 empty cell array                       

For an example of how to configure and use the AXI manager IP in your design, see Random Access of External Memory. Specifically, review the soc_image_rotation_axi_master.m script that initializes the memory on the device, starts the FPGA logic, and reads back the modified data. This example shows only the memory initialization step.

Load a .mat file that contains structures derived from the board configuration parameters. This file was generated by SoC Builder. These structures also describe the IP cores and memory configuration of the design on the board. Set up a JTAG AXI manager connection by creating a socHardwareBoard object and passing it to the socAXIManager object. The socAXIManager object connects with the hardware board and confirms that the IP is present.

load('soc_image_rotation_zc706_aximaster.mat');
hwObj = socHardwareBoard('Xilinx Zynq ZC706 evaluation kit','Connect',false);
AXIManagerObj = socAXIManager(hwObj);

Initialize the memory contents on the device by loading the figure data and writing it to Region1. The FPGA logic is designed to read this data, rotate it, and write it into Region2. Clear the contents of Region2.

load('soc_image_rotation_inputdata.mat');
inputFigure = smallImage;
[x, y] = size(inputFigure);
inputImage = uint32(reshape(inputFigure',1,x*y));
writememory(AXIManagerObj,memRegions.AXI4MasterMemRegion1,inputImage);
writememory(AXIManagerObj,memRegions.AXI4MasterMemRegion2,uint32(zeros(1,x*y)));

Version History

Introduced in R2019a