soc.iosource
Input source on SoC hardware board
Description
Create an soc.iosource
object to connect to an input source
on an SoC hardware board. Pass the soc.iosource
object as an argument
to the addSource
function of the DataRecorder
object.
The sources available on the design running on the SoC hardware board correspond to the blocks you included in your Simulink® model. When you run SoC Builder, it connects your FPGA logic with the matching interface on the board.
Source | Block | Action |
---|---|---|
'TCP Receive' | TCP Read | Read UDP (User Datagram Protocol) data from the Linux® socket buffer. |
'UDP Receive' | UDP Read | Read TCP/IP data from Linux socket buffer. |
'AXI Register Read' | Register Read | Read registers from an IP core using the AXI interface. |
'AXI Stream Read' | Stream Read | Read AXI-4 Stream data using IIO. |
Creation
Description
returns a list of input sources available for data logging on the SoC hardware
board connected through availableSources
= soc.iosource(hw
)hw
. hw
is an
socHardwareBoard
object.
creates a source object corresponding to src
= soc.iosource(hw
,inputSourceName
)inputSourceName
on
the SoC hardware board connected through hw
.
Input Arguments
hw
— Hardware object
socHardwareBoard
object
Hardware object, specified as a socHardwareBoard
object that
represents the connection to the SoC hardware board.
inputSourceName
— Name of available input source on SoC hardware board
character vector
Name of an available input source on the SoC hardware board, specified
as a character vector. To get the list of input sources available for
data logging on the specified SoC hardware board, call the
soc.iosource
function without arguments.
Example: 'UDP Receive'
Data Types: char
Output Arguments
availableSources
— List of input data sources available for data logging
cell array
List of input data sources available for data logging on the specified
SoC hardware board, returned as a cell array. Each cell contains a
character vector with the name of an available input data source for
data logging on the specified SoC hardware board. Use one of these names
as the inputSourceName
argument when you create a
source object.
src
— Source object for specified input source
soc.iosource
object
Source object for specified input source, returned as an
soc.iosource
.
Properties
DeviceName
— Name of IP core device
character vector
Name of IP core device, specified as a character vector.
Example:
'mwipcore0:s2mm0'
Dependencies
To enable this property, create a AXI register or AXI stream source object.
Data Types: char
RegisterOffset
— Offset from base address of IP core to register
positive scalar
Offset from the base address of the IP core to the register, specified as a positive scalar.
Dependencies
To enable this property, create a AXI register source object.
Data Types: uint32
LocalPort
— IP port on hardware board where UDP or TCP data is received
25000
(UDP) (default) | -1
(TCP) | integer from 1 to 65,535
IP port on hardware board where UDP or TCP data is received specified as a scalar from 1 to 65,535. The object reads UDP or TCP data received on this port of the specified SoC hardware board.
For a TCP object with the NetworkRole
property to
'Client'
, set LocalPort
to
-1
to assign any random available port on the
hardware board as the local port.
Dependencies
To enable this property, create a TCP or UDP source object.
Data Types: uint16
NetworkRole
— Network role
'Client'
(default) | character vector
Network role, specified as a character vector.
Example: 'Client'
Dependencies
To enable this property, create a TCP source object.
Data Types: enumerated string
RemoteAddress
— IP address of remote server from which data is received
'127.0.0.1'
(default) | dotted-quad expression
IP address of the remote server from which data is received, specified as a dotted-quad expression.
Dependencies
To enable this property, create a TCP source object.
Data Types: char
RemotePort
— IP port number of remote server from which data is received
25000 (default) | integer from 1 to 65,535
IP port number of the remote server from which data is received, specified as an integer from 1 to 65,535.
Dependencies
To enable this property, create a TCP source object.
Data Types: double
DataLength
— Length of data packet or register data vector
1
(default) | positive scalar
Maximum length of UDP or TCP data packet, or word length of AXI register data vector, specified as a positive scalar.
Data Types: double
SamplesPerFrame
— Size of data vector read from IP core
nonnegative scalar
Size of the data vector read from the IP core, specified as a nonnegative scalar.
Dependencies
To enable this property, create a AXI stream source object.
Data Types: double
DataType
— Data type of received data
'uint8'
(default) | 'uint16'
| 'uint32'
| 'int8'
| 'int16'
| 'int32'
| 'double'
| 'single'
Data type of received data, specified as 'uint8'
,
'uint16'
, 'uint32'
,
'int8'
, 'int16'
,
'int32'
, 'double'
or
'single'
.
Data Types: char
ReceiveBufferSize
— Internal buffer size of object
65535
(default) | array
Internal buffer size of object, specified as an array.
Dependencies
To enable this property, create a TCP or UDP source object.
Data Types: double
Sample Time
— Sample time
1
(default) | nonnegative scalar
Sample time, in seconds, at which you want to receive data, specified as an nonnegative scalar.
Data Types: double
Examples
Record Data From SoC Hardware Board
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
Version History
Introduced in R2019a
See Also
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)