usrp
Description
The usrp
System object™ streams samples from the radio front end of an NI™
USRP™ radio device with a custom FPGA image that you create by using the Target NI USRP Radios Workflow.
To stream samples from the radio front end:
Create the
usrpobject and set its properties.Call the object with arguments, as if it were a function.
To learn more about how System objects work, see What Are System Objects?
The diagram shows an overview of the internal architecture of an NI
USRP radio. The usrp
System object enables you to:
Configure the radio front end by setting the object properties.
Stream samples from the radio front end by calling the object with
device()as if the object were a function.Transmit a test waveform over the air by using the
transmitfunction. With this function, you can test the receive path on your DUT.Retrieve captured data from the PL DDR buffer by using the
capturefunction. With this function, you can test the transmit path on your DUT.
For details on how to use the usrp
System object with object functions to connect to, configure, and control your NI
USRP radio device, see the call sequence in Object Functions.
For more information about time synchronization with a usrp
System object, see Time-Synchronize Operations.
Creation
Description
sets properties using one or more name-value arguments. For example,
device = usrp(radio,PropertyName=Value)TransmitCenterFrequency=2.4e9 specifies a center
frequency of 2.4 GHz on all DUT output and transmit antennas.
Input Arguments
Radio setup configuration, specified as one of these options:
String scalar — The name of a radio setup configuration you saved using the Radio Setup wizard. For example,
"MyRadio".To list all saved radio setup configurations, call the
radioConfigurationsfunction with no input arguments.Radio object — A radio object that corresponds to a radio setup configuration you saved using the Radio Setup wizard (since R2025a).
To create a radio object for a radio setup configuration with the name
"MyRadio", callradio = radioConfigurations("MyRadio").Use this option when you want to use synchronization features. You can refer to radio object properties to get information about the radio setup configuration that the object corresponds to, such as the model number of the radio, the radio IP address, and the synchronization options. Additionally, you can:
Check the lock status of the reference clock, local oscillators, or GPS disciplined oscillator (GPSDO) on the radio using the
referenceLockedStatus,loLockedStatus, andgpsLockedStatusfunctions respectively.Get the current radio time using the
getRadioTimefunction.Synchronize multiple devices by setting the radio time using the
getTimeLastPPSandsetTimeNextPPSfunctions.Get time and GPS information from the radio using the
getGPSTimeandgetGPSNMEAfunctions.Schedule synchronized property updates on your
usrpobject using thesetCommandTime,getCommandTime, andclearCommandTimefunctions.
For more information, see Time-Synchronize Operations.
You can use these synchronization features to time synchronize a streaming
operation to or from the radio by specifying the StartTime name
value argument when you call the transmit
function or when you stream samples from the radio by calling the
usrp
System object as a function. Additionally, you can use synchronization features to
synchronize operations multiple radios. For more information, see Time-Synchronize Operations.
For a list of supported radios, see Supported Radio Devices.
Properties
Unless otherwise indicated, properties are nontunable, which means you cannot change their
values after calling the object. Objects lock when you call them, and the
release function unlocks them.
If a property is tunable, you can change its value at any time.
For more information on changing property values, see System Design in MATLAB Using System Objects.
Radio Antenna Properties
Radio center frequency in Hz, specified as one of these options:
Positive numeric scalar — The object applies this value by scalar expansion to each antenna specified in the
DUTOutputAntennasandTransmitAntennasproperties.Numeric array — The object applies the ith array element value to the ith antenna in the
DUTOutputAntennasandTransmitAntennasproperties, in that order.
The valid center frequency range depends on the radio device.
| Radio Device | Center Frequency |
|---|---|
USRP E320 | 70 MHz to 6 GHz |
USRP N310 | 1 MHz to 6 GHz |
USRP N320 | 1 MHz to 6 GHz |
USRP N321 | 1 MHz to 6 GHz |
USRP X310 | 10 MHz to 6 GHz |
USRP X410 | 1 MHz to 8 GHz |
Note
When setting this property for multiple antennas on a USRP N310 radio, consider these hardware characteristics:
The antenna ports on the RF0 and RF1 radio channels use the same center frequency. Therefore, set identical center frequency values for the antennas specified as
"RF0:TX/RX"and"RF1:TX/RX".The antenna ports on the RF2 and RF3 radio channels use the same center frequency. Therefore, set identical center frequency values for the antennas specified as
"RF2:TX/RX"and"RF3:TX/RX".
Tunable: Yes
Data Types: double
Gain in dB of the DUT output and transmit antennas, specified as one of these options:
Positive numeric scalar — The object applies this value by scalar expansion to each antenna that you specify in the
DUTOutputAntennasandTransmitAntennasproperties.Numeric array — The object applies the ith array element value to the ith antenna in the
DUTOutputAntennasandTransmitAntennasproperties, in that order.
The valid gain range depends on the radio device.
| Radio Device | Transmit Radio Gain |
|---|---|
USRP E320 | 0 dB to 89.8 dB |
USRP N310 | 0 dB to 65 dB |
USRP N320 | 0 dB to 60 dB |
USRP N321 | 0 dB to 60 dB |
USRP X310 + UBX 160 | 0 dB to 31.5 dB |
USRP X410 | 0 dB to 60 dB |
Tunable: Yes
Data Types: double
Radio center frequency in Hz, specified as one of these options:
Positive numeric scalar — The object applies this value by scalar expansion to each antenna specified in the
DUTInputAntennasandCaptureAntennasproperties.Numeric array — The object applies the ith array element value to the ith antenna in the
DUTInputAntennasandCaptureAntennasproperties, in that order.
The valid center frequency range depends on the radio device.
| Radio Device | Center Frequency |
|---|---|
USRP E320 | 70 MHz to 6 GHz |
USRP N310 | 1 MHz to 6 GHz |
USRP N320 | 1 MHz to 6 GHz |
USRP N321 | 1 MHz to 6 GHz |
USRP X310 | 10 MHz to 6 GHz |
USRP X410 | 1 MHz to 8 GHz |
Note
When setting this property for multiple antennas on a USRP N310 radio, consider these hardware characteristics:
The antenna ports on the RF0 and RF1 radio channels use the same center frequency. Therefore, set identical center frequency values for the antennas specified as
"RF0:RX2"and"RF1:RX2".The antenna ports on the RF2 and RF3 radio channels use the same center frequency. Therefore, set identical center frequency values for the antennas specified as
"RF2:RX2"and"RF3:RX2".
Tunable: Yes
Data Types: double
Gain in dB of the DUT input and capture antennas, specified as one of these options:
Positive numeric scalar — The object applies this value by scalar expansion to each antenna that you specify in the
DUTInputAntennasandCaptureAntennasproperties.Numeric array — The object applies the ith array element value to the ith antenna in the
DUTInputAntennasandCaptureAntennasproperties, in that order.
The valid gain range depends on the radio device.
| Radio Device | Capture Radio Gain |
|---|---|
USRP E320 | 0 dB to 76 dB |
USRP N310 | 0 dB to 75 dB |
USRP N320 | 0 dB to 60 dB |
USRP N321 | 0 dB to 60 dB |
USRP X310 + UBX 160 | 0 dB to 31.5 dB |
USRP X310 + TwinRX | 0 dB to 93 dB |
USRP X410 | 0 dB to 60 dB |
Tunable: Yes
Data Types: double
Baseband sample rate of the radio front end in Hz, specified as a positive numeric scalar. The default is the sample rate that you specify in the Configure HDL Code Generation Settings step of the targeting workflow.
Set a sample rate of MCR, or MCR divided by a supported decimation or interpolation factor, where MCR is a valid master clock rate. The valid MCR and decimation or interpolation factor values depend on the radio.
| Radio Device | MCR | Supported Decimation or Interpolation Factor |
|---|---|---|
USRP E320 |
| 1 |
| 2 | ||
| 3 | ||
Even integer in the range from 4 to 256 | ||
Multiple of 4 in the range from 256 to 512 | ||
Multiple of 8 in the range from 512 to 1008 | ||
USRP N310 |
| 1 |
| 2 | ||
| 3 | ||
Even integer in the range from 4 to 256 | ||
Multiple of 4 in the range from 256 to 512 | ||
Multiple of 8 in the range from 512 to 1016 | ||
USRP N320 USRP N321 |
| 1 |
| 2 | ||
| 3 | ||
Even integer in the range from 4 to 256 | ||
Multiple of 4 in the range from 256 to 512 | ||
Multiple of 8 in the range from 512 to 1016 | ||
USRP X310 |
| Integer in the range from 1 to 128 |
Even integer in the range from 128 to 256 | ||
Multiple of 4 in the range from 256 to 512 | ||
Multiple of 8 in the range from 512 to 1016 | ||
USRP X410 |
| 1 |
| 2 | ||
| 3 | ||
Even integer in the range from 4 to 256 | ||
Multiple of 4 in the range from 256 to 512 |
Data Types: double
Radio antennas for input to the DUT, specified as one of these options:
String scalar — Specify the use of a single antenna.
String array — Specify the use of multiple antennas.
If you specify multiple antennas, the object assigns them to the input data
streaming interfaces in the DUT in order. For example, the object assigns the first
antenna to input data streaming interface 0, and the Nth antenna to
input data streaming interface N-1. You map the input data
streaming interfaces to the hardware interfaces in the Map Data Streaming Inputs step of the targeting
workflow.
Use this table to identify the supported radio antenna ports on the radio device and the corresponding string constants that you can specify for this property. The default value depends on the radio.
| Radio Device | Supported Antenna Port | String Scalar |
|---|---|---|
USRP E320 | RFA channel: RX2 port |
|
RFB channel: RX2 port |
| |
USRP N310 | RF0 channel: RX2 port | "RF0:RX2" (default) |
| RF1 channel: RX2 port | "RF1:RX2" | |
| RF2 channel: RX2 port | "RF2:RX2"
| |
| RF3 channel: RX2 port | "RF3:RX2" | |
USRP N320 | RF0 channel: RX2 port | "RF0:RX2" (default) |
| RF1 channel: RX2 port | "RF1:RX2" | |
USRP N321 | RF0 channel: RX2 port | "RF0:RX2" (default) |
| RF0 channel: RX2 port | "RF1:RX2" | |
USRP X310 + UBX 160 | RFA channel: RX2 port |
|
RFB channel: RX2 port |
| |
USRP X310 + TwinRX | RFA channel: TX/RX port |
|
RFA channel: RX2 port |
| |
RFB channel: TX/RX port |
| |
RFB channel: RX2 port |
| |
| USRP X410 | DB0 RF0 channel: RX 1 port |
|
DB0 RF1 channel: RX 1 port |
| |
DB1 RF0 channel: RX 1 port |
| |
DB1 RF1 channel: RX 1 port |
|
The maximum number of antenna connections available depends on the radio. Use this
table to determine the maximum combined number of antennas you can specify with the
DUTInputAntennas, DUTOutputAntennas, CaptureAntennas, and TransmitAntennas properties.
| Radio Device | Maximum Number of Antennas |
|---|---|
USRP E320 | 2 |
USRP N310 | 4 |
USRP N320 | 4 |
USRP N321 | 4 |
USRP X310 + UBX 160 | 2 |
USRP X310 + TwinRX | 4 (receive only) |
USRP X410 | 4 |
Example: DUTInputAntennas=["RF0:RX2","RF1:RX2"] specifies two
DUT input antennas.
Data Types: string
Radio antennas for transmitting from DUT, specified as one of these options:
String scalar — Specify the use of a single antenna.
String array — Specify the use of multiple antennas.
If you specify multiple antennas, the object assigns them to the output data
streaming interfaces in the DUT in order. For example, the object assigns the first
antenna to output data streaming interface 0, and the Nth antenna
to output data streaming interface N-1. You map the output data
streaming interfaces to the hardware interfaces in the Map Data Streaming Outputs step of the targeting
workflow.
Use this table to identify the supported radio antenna ports on the radio device and the corresponding string constants that you can specify for this property. The default value depends on the radio.
| Radio Device | Supported Antenna Port | String Scalar |
|---|---|---|
USRP E320 | RFA channel: TX/RX port |
|
RFB channel: TX/RX port |
| |
USRP N310 | RF0 channel: TX/RX port | "RF0:TX/RX" (default) |
| RF1 channel: TX/RX port | "RF1:TX/RX" | |
| RF2 channel: TX/RX port | "RF2:TX/RX"
| |
| RF3 channel: TX/RX port | "RF3:TX/RX" | |
USRP N320 | RF0 channel: TX/RX port | "RF0:TX/RX" (default) |
| RF1 channel: TX/RX port | "RF1:TX/RX" | |
USRP N321 | RF0 channel: TX/RX port | "RF0:TX/RX" (default) |
| RF1 channel: TX/RX port | "RF1:TX/RX" | |
USRP X310 + UBX 160 | RFA channel: TX/RX port |
|
RFB channel: TX/RX port |
| |
USRP X410 | DB0 RF0 channel: TX/RX 0 port |
|
DB0 RF1 channel: TX/RX 0 port |
| |
DB1 RF0 channel: TX/RX 0 port |
| |
DB1 RF1 channel: TX/RX 0 port |
|
The maximum number of antenna connections available depends on the radio. Use this
table to determine the maximum combined number of antennas you can specify with the
DUTInputAntennas, DUTOutputAntennas, CaptureAntennas, and TransmitAntennas properties.
| Radio Device | Maximum Number of Antennas |
|---|---|
USRP E320 | 2 |
USRP N310 | 4 |
USRP N320 | 4 |
USRP N321 | 4 |
USRP X310 + UBX 160 | 2 |
USRP X310 + TwinRX | 4 (receive only) |
USRP X410 | 4 |
Example: DUTOutputAntennas=["RF0:TX/RX","RF1:TX/RX"] specifies
two DUT output antennas.
Data Types: string
Radio antennas for capture to the host, specified as one of these options:
"No Antennas Selected"— Specify no antennas.String scalar — Specify the use of a single antenna.
String array — Specify the use of multiple antennas.
Use this table to identify the supported radio antenna ports on the radio device and the corresponding string constants that you can specify for this property. The default value depends on the radio.
| Radio Device | Supported Antenna Port | String Scalar |
|---|---|---|
USRP E320 | RFA channel: RX2 port |
|
RFB channel: RX2 port |
| |
USRP N310 | RF0 channel: RX2 port | "RF0:RX2" (default) |
| RF1 channel: RX2 port | "RF1:RX2" | |
| RF2 channel: RX2 port | "RF2:RX2"
| |
| RF3 channel: RX2 port | "RF3:RX2" | |
USRP N320 | RF0 channel: RX2 port | "RF0:RX2" (default) |
| RF1 channel: RX2 port | "RF1:RX2" | |
USRP N321 | RF0 channel: RX2 port | "RF0:RX2" (default) |
| RF0 channel: RX2 port | "RF1:RX2" | |
USRP X310 + UBX 160 | RFA channel: RX2 port |
|
RFB channel: RX2 port |
| |
USRP X310 + TwinRX | RFA channel: TX/RX port |
|
RFA channel: RX2 port |
| |
RFB channel: TX/RX port |
| |
RFB channel: RX2 port |
| |
| USRP X410 | DB0 RF0 channel: RX 1 port |
|
DB0 RF1 channel: RX 1 port |
| |
DB1 RF0 channel: RX 1 port |
| |
DB1 RF1 channel: RX 1 port |
|
The maximum number of antenna connections available depends on the radio. Use this
table to determine the maximum combined number of antennas you can specify with the
DUTInputAntennas, DUTOutputAntennas, CaptureAntennas, and TransmitAntennas properties.
| Radio Device | Maximum Number of Antennas |
|---|---|
USRP E320 | 2 |
USRP N310 | 4 |
USRP N320 | 4 |
USRP N321 | 4 |
USRP X310 + UBX 160 | 2 |
USRP X310 + TwinRX | 4 (receive only) |
USRP X410 | 4 |
Example: CaptureAntennas=["RF2:RX2","RF3:RX2"] specifies two
capture antennas.
Data Types: string
Radio antennas for transmitting from the host, specified as one of these options:
"No Antennas Selected"— Specify no antennas.String scalar — Specify the use of a single antenna.
String array — Specify the use of multiple antennas.
Use this table to identify the supported radio antenna ports on the radio device and the corresponding string constants that you can specify for this property. The default value depends on the radio.
| Radio Device | Supported Antenna Port | String Scalar |
|---|---|---|
USRP E320 | RFA channel: TX/RX port |
|
RFB channel: TX/RX port |
| |
USRP N310 | RF0 channel: TX/RX port | "RF0:TX/RX" (default) |
| RF1 channel: TX/RX port | "RF1:TX/RX" | |
| RF2 channel: TX/RX port | "RF2:TX/RX"
| |
| RF3 channel: TX/RX port | "RF3:TX/RX" | |
USRP N320 | RF0 channel: TX/RX port | "RF0:TX/RX" (default) |
| RF1 channel: TX/RX port | "RF1:TX/RX" | |
USRP N321 | RF0 channel: TX/RX port | "RF0:TX/RX" (default) |
| RF1 channel: TX/RX port | "RF1:TX/RX" | |
USRP X310 + UBX 160 | RFA channel: TX/RX port |
|
RFB channel: TX/RX port |
| |
USRP X410 | DB0 RF0 channel: TX/RX 0 port |
|
DB0 RF1 channel: TX/RX 0 port |
| |
DB1 RF0 channel: TX/RX 0 port |
| |
DB1 RF1 channel: TX/RX 0 port |
|
The maximum number of antenna connections available depends on the radio. Use this
table to determine the maximum combined number of antennas you can specify with the
DUTInputAntennas, DUTOutputAntennas, CaptureAntennas, and TransmitAntennas
properties.
| Radio Device | Maximum Number of Antennas |
|---|---|
USRP E320 | 2 |
USRP N310 | 4 |
USRP N320 | 4 |
USRP N321 | 4 |
USRP X310 + UBX 160 | 2 |
USRP X310 + TwinRX | 4 (receive only) |
USRP X410 | 4 |
Example: TransmitAntennas=["RF2:TX/RX","RF3:TX/RX"] specifies
two transmit antennas.
Data Types: string
Allocated PL DDR buffer memory in samples for the capture antennas, specified as
an even positive integer. This is the memory allocated to each specified capture
antenna specified in CaptureAntennas.
The value assigned to this property is the largest number of IQ samples you can
request with the capture
function.
The total memory allocation must not exceed the memory buffer size on the radio. Several streaming connections through the PL DDR buffer contribute to the total memory allocation.
For each antenna that you specify in
CaptureAntennas,CaptureDDRAllocationsamples are allocated.For each antenna that you specify in
TransmitAntennas,TransmitDDRAllocationsamples are allocated.For each data streaming connection between the DUT and the PL DDR buffer, the memory allocation is determined by the
DDRAllocationyou specify when you add streaming interfaces to your DUT with theaddRFNoCStreamInterfacefunction.
The memory buffer size depends on the radio.
| Radio Device | Memory Buffer Size | Maximum Data Samples |
|---|---|---|
USRP E320 | 2 GB | 229 |
USRP N310 | 2 GB | 229 |
USRP N320 | 2 GB | 229 |
USRP N321 | 2 GB | 229 |
USRP X310 | 1 GB | 228 |
USRP X410 | 4 GB | 230 |
Data Types: double
Allocated PL DDR buffer memory in samples for the transmit antennas, specified as
an even positive integer. This is the memory allocated to each specified capture
antenna specified in TransmitAntennas.
The value assigned to this property is the largest number of IQ samples you can
request with the transmit
function.
The total memory allocation must not exceed the memory buffer size on the radio. Several streaming connections through the PL DDR buffer contribute to the total memory allocation.
For each antenna that you specify in
CaptureAntennas,CaptureDDRAllocationsamples are allocated.For each antenna that you specify in
TransmitAntennas,TransmitDDRAllocationsamples are allocated.For each data streaming connection between the DUT and the PL DDR buffer, the memory allocation is determined by the
DDRAllocationyou specify when you add streaming interfaces to your DUT with theaddRFNoCStreamInterfacefunction.
The memory buffer size depends on the radio.
| Radio Device | Memory Buffer Size | Maximum Data Samples |
|---|---|---|
USRP E320 | 2 GB | 229 |
USRP N310 | 2 GB | 229 |
USRP N320 | 2 GB | 229 |
USRP N321 | 2 GB | 229 |
USRP X310 | 1 GB | 228 |
USRP X410 | 4 GB | 230 |
Data Types: double
Advanced Properties
Since R2024b
This property is read-only.
Clock frequency of the DUT in Hz, returned as a positive numeric scalar.
The clock frequency of the DUT depends on the Reference Design Settings set in the Generate HDL Code step of the targeting workflow.
If the DUT Clock Source configuration parameter is set to
Radio, the clock frequency of the DUT is the MCR of the radio that the specifiedSampleRateis derived from.If the DUT Clock Source configuration parameter is set to
Custom, the clock frequency of the DUT is the value specified in the Target Frequency configuration parameter.
Example: 250000000
Data Types: double
Option to enable the loopback of IQ samples from the transmit to receive antennas,
specified as "Disabled" or "FPGA".
Set the LoopbackMode property to "FPGA" to loop
back samples from DUTOutputAntennas and TransmitAntennas to DUTInputAntennas and CaptureAntennas. This option enables you to test the
transmit or receive path of the algorithm on your DUT as if it is connected to an
antenna without sending or receiving data over the air. This table details which
antennas loop back to each other when you specify this option.
| Radio Device | Transmit Antenna | Receive Antenna |
|---|---|---|
USRP E320 |
|
|
|
| |
USRP N310 | "RF0:TX/RX" | "RF0:RX2"
|
"RF1:TX/RX" | "RF1:RX2" | |
"RF2:TX/RX"
| "RF2:RX2"
| |
"RF3:TX/RX" | "RF3:RX2" | |
USRP N320 USRP N321 | "RF0:TX/RX" | "RF0:RX2" |
"RF1:TX/RX" | "RF1:RX2" | |
USRP X310 + UBX 160 |
|
|
|
| |
USRP X410 |
|
|
|
| |
|
| |
|
|
Data Types: string
Since R2026a
The number of samples per packet (SPP), specified as an even positive integer.
This value is the length of the data packets that are sent from the radio front end
when you call the usrp
System object as a function or call the step function.
You can reduce the SPP from the default value, 256, to reduce
latency. However, setting the value too low adds additional overhead that can cause
underflows. Setting the value too high can cause overflows.
Data Types: double
Flag to remove the DUT from the signal path, specified as
0(false) or 1(true).
Set this flag to 1(true) to disconnect all DUT streaming
interfaces that you assign in the Map Target Interfaces step of the targeting
workflow. Removing the DUT from the signal path can free up hardware resources to
assign TransmitAntennas and CaptureAntennas for transmit and capture data directly to the
host.
Dependencies
If you set the
Reference Design Optimization configuration parameter
to Moderate, High, or
Maximum in the Reference Design Settings, the DUT has static
connections that cannot be removed. To remove the DUT from the signal path, set
Reference Design Optimization to
None when you generate the bitstream.
Data Types: logical
Flag to remove the PL DDR buffer from the signal path, specified as
0(false) or 1(true).
Set this flag to 1(true) to disconnect all DUT streaming
interfaces source or sink connections that you set to PL DDR Buffer
in the Map Target Interfaces step of the targeting
workflow. Bypassing the PL DDR buffer connects the source or sink connection directly
to the host instead.
Dependencies
If you set the
Reference Design Optimization configuration parameter
to Moderate, High, or
Maximum in the Reference Design Settings, the PL DDR buffer
has static connections that cannot be removed. To remove the PL DDR buffer from the
signal path, set Reference Design Optimization to
None when you generate the bitstream.
Data Types: logical
Usage
Description
device() streams samples continuously from the radio front end
until you call the reset function.
device( streams
numSamples)numSamples samples from the radio front end.
device(___, specifies options using one or more name-value arguments in
addition to the input arguments in the previous syntaxes (since R2025a). For example,
Name=Value)startTime=getRadioTime(radio)+0.5 schedules the
streaming of samples to start 500 milliseconds in the future.
Input Arguments
Number of samples, specified as an integer number of samples.
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.
Example: getRadioTime(radio)+0.5 schedules the streaming of samples
to start 500 milliseconds in the future.
Since R2025a
Start time for streaming samples from the radio, specified as a positive numeric
scalar. The default value is one second in the future. To schedule the System object to start streaming samples from the radio at a specific future time,
first use the getRadioTime function to get the current radio time in seconds. Then,
specify the radio time at which you want to start streaming samples from the
radio.
For more information about how to schedule transmit and receive operations, see Time-Synchronize Operations.
Example: getRadioTime(radio)+0.5 schedules the operation to
start 500 milliseconds in the future.
Data Types: double
Since R2025a
Flag to specify the blocking behavior of the delay specified with the StartTime
name-value argument, specified as one of these options:
false— The delay specified withStartTimeblocks MATLAB®. You can run MATLAB code only when the current time reaches the scheduled start time.true— The delay specified withStartTimeelapses in the background. Use this option to run MATLAB code while waiting for the current time to reach the scheduled start time. When you specify this option, consider that new samples are not available in the buffer until the delay elapses and the streaming operation starts.
Data Types: logical
Object Functions
To use an object function, specify the
System object as the first input argument. For
example, to release system resources of a System object named obj, use
this syntax:
release(obj)
programFPGA | Program FPGA on NI USRP radio device with custom FPGA Image |
describeFPGA | Describe hardware interfaces on NI USRP radio device FPGA |
capture | Retrieve captured IQ data from an NI USRP radio device |
transmit | Transmit waveform over the air with an NI USRP radio device |
stopTransmission | Stop transmission from an NI USRP radio device |
Use the following functions to connect to, configure, and control your NI USRP radio device. The diagram shows the call sequence.
Create the
usrpSystem object with a radio setup configuration or radio object that you specify with theradioinput argument. Set properties that you apply to configure the radio front end settings in a later step.Use the
programFPGAanddescribeFPGAfunctions to program the FPGA on the radio with your custom bitstream and describe the DUT interfaces with the hand-off information file. You generate these files are generated in Generate Bitstream and Program FPGA of the targeting workflow.Call
setupto connect to the radio, apply the radio front end properties, and validate that the block ID in the bitstream file matches the hand-off information file. You now have a live connection to your radio. You can update tunable properties and connect to your DUT by using thefpgaobject. You can read or write registers on the DUT by using thereadPortandwritePortfunction. This step enables you to start streaming samples into your radio with the DUT ports in a known state.Call the
usrpSystem object as a function or call thestepfunction on the System object to start the radio front end. This step callssetupif you did not do so previously, and then starts requesting streaming samples from the radio front end into the FPGA. Specify thenumSamplesargument to request a specific number of samples, or stream samples continuously by specifying no input arguments.Call the
resetfunction to stop the radio front end and restore the radio to the initialized state beforesetup. This stops any ongoing transmit or write operation and flushes the receive buffers. Any streaming connections between the DUT and the radio front end may not be flushed.Call the
releasefunction to release the hardware resources. This stops any ongoing transmit or write operation and flushes the receive buffers. Any streaming connections between the DUT and the radio front end might not be flushed.
To use synchronization features, specify a radio object as the input. You can synchronize
the radio time on multiple radios after you call the setup function. For
more information, see Time-Synchronize Operations.
Examples
This example uses:
Create a usrp System object, specifying a radio setup configuration previously saved in the Radio Setup wizard.
device = usrp("MyRadio")device =
usrp with properties:
TransmitRadioGain: 10
TransmitCenterFrequency: 2.4000e+09
ReceiveRadioGain: 10
ReceiveCenterFrequency: 2.4000e+09
DUTInputAntennas: []
DUTOutputAntennas: []
BypassDUT: 0
BypassPLDDRBuffer: 0
LoopbackMode: "Disabled"
SampleRate: []
CaptureAntennas: []
TransmitAntennas: []
CaptureDDRAllocation: 10000000
TransmitDDRAllocation: 10000000
Configure the hardware interfaces.
describeFPGA(device,"ModelName_wthandoffinfo.mat"); Connect to the radio and apply radio front end properties.
setup(device);
This example uses:
Create a usrp System object, specifying a radio setup configuration previously saved in the Radio Setup wizard.
device = usrp("MyRadio")device =
usrp with properties:
TransmitRadioGain: 10
TransmitCenterFrequency: 2.4000e+09
ReceiveRadioGain: 10
ReceiveCenterFrequency: 2.4000e+09
DUTInputAntennas: []
DUTOutputAntennas: []
BypassDUT: 0
BypassPLDDRBuffer: 0
LoopbackMode: "Disabled"
SampleRate: []
CaptureAntennas: []
TransmitAntennas: []
CaptureDDRAllocation: 10000000
TransmitDDRAllocation: 10000000
Configure your radio with the DUT interfaces described by the hand-off information file and initialize the sample rate on the radio and any DUT input or output antennas. The model this file describes has one data streaming input from the radio to the FPGA, so requires one DUT input antenna.
programFPGA(device,"myBitstream.bit","myDeviceTree.dts");
Loading bitstream to FPGA... Loading bitstream to FPGA is now complete.
This example uses:
Create a usrp System object, specifying a radio setup configuration previously saved in the Radio Setup wizard.
device = usrp("MyRadio")device =
usrp with properties:
TransmitRadioGain: 10
TransmitCenterFrequency: 2.4000e+09
ReceiveRadioGain: 10
ReceiveCenterFrequency: 2.4000e+09
DUTInputAntennas: []
DUTOutputAntennas: []
BypassDUT: 0
BypassPLDDRBuffer: 0
LoopbackMode: "Disabled"
SampleRate: []
CaptureAntennas: []
TransmitAntennas: []
CaptureDDRAllocation: 10000000
TransmitDDRAllocation: 10000000
Configure your radio with the DUT interfaces described by the hand-off information file and initialize the sample rate on the radio and any DUT input or output antennas. The model this file describes has one data streaming input from the radio to the FPGA, so it requires one DUT input antenna.
describeFPGA(device,"ModelName_wthandoffinfo.mat"); Display the initialised radio properties for a DUT.
device
device =
usrp with properties:
TransmitRadioGain: 10
TransmitCenterFrequency: 2.4000e+09
ReceiveRadioGain: 10
ReceiveCenterFrequency: 2.4000e+09
DUTInputAntennas: "DB0:RF0:RX1"
DUTOutputAntennas: []
BypassDUT: 0
BypassPLDDRBuffer: 0
LoopbackMode: "Disabled"
SampleRate: 250000000
CaptureAntennas: []
TransmitAntennas: []
CaptureDDRAllocation: 10000000
TransmitDDRAllocation: 10000000
This example uses:
Create a usrp System object, specifying a radio setup configuration previously saved in the Radio Setup wizard.
device = usrp("MyRadio");Set the baseband sample rate.
device.SampleRate = 250e6;
Program the FPGA with your bitstream and configure the hardware interfaces.
programFPGA(device,"myBitstream.bit","myDeviceTree.dts");
Loading bitstream to FPGA... Loading bitstream to FPGA is now complete.
describeFPGA(device,"ModelName_wthandoffinfo.mat"); Connect to the radio and apply radio front end properties.
setup(device);
Call the usrp System object as a function to start the radio front end. Request a continuous stream of samples by specifying no input arguments.
device();
Release the hardware resources.
release(device);
This example uses:
Create a usrp System object, specifying a radio setup configuration previously saved in the Radio Setup wizard.
device = usrp("MyRadio");Program the FPGA with your bitstream and configure the hardware interfaces.
programFPGA(device,"myBitstream.bit","myDeviceTree.dts");
Loading bitstream to FPGA... Loading bitstream to FPGA is now complete.
describeFPGA(device,"ModelName_wthandoffinfo.mat"); Specify a capture antenna on the radio and memory allocation in the PL DDR buffer.
captureLength = 1000;
device.CaptureAntennas = "DB0:RF1:RX1";
device.CaptureDDRAllocation = captureLength;Connect to the radio and apply radio front end properties.
setup(device);
Call the usrp System object as a function to start the radio front end. Request captureLength samples.
device(captureLength);
Retrieve captureLength samples of captured IQ data from the radio at the default center frequency and baseband sample rate.
[data,dataLength] = capture(device,captureLength);
Confirm that all requested samples were retrieved from the radio.
isequal(dataLength,captureLength)
ans = logical
1
This example uses:
Create a usrp System object, specifying a radio setup configuration previously saved in the Radio Setup wizard.
device = usrp("MyRadio");Program the FPGA with your bitstream and configure the hardware interfaces.
programFPGA(device,"myBitstream.bit","myDeviceTree.dts");
Loading bitstream to FPGA... Loading bitstream to FPGA is now complete.
describeFPGA(device,"ModelName_wthandoffinfo.mat"); Specify the number of samples in the transmit waveform and allocate memory in the PL DDR Buffer.
transmitLength = 1000;
device.TransmitAntennas = "DB0:RF0:TX/RX0";
device.TransmitDDRAllocation = transmitLength;Connect to the radio and apply radio front end properties.
setup(device);
Generate random data to transmit.
wav = complex(randn(transmitLength,1),randn(transmitLength,1));
Scale the data so that the maximum real or complex value is 0.8.
wav = 0.8*(wav/max(max([abs(real(wav)),abs(imag(wav))])));
Scale the transmit data to complex int16.
txWaveform = int16(wav*double(intmax('int16')));Transmit the generated waveform continuously.
transmit(device,txWaveform,"continuous");Stop the continuous transmission after 5 seconds.
pause(5); stopTransmission(device);
Version History
Introduced in R2024aYou can now use the SamplesPerPacket property to set the length of data packets that are
sent from the radio front end when you call the usrp
System object as a function or call the step function.
You can now schedule the start time for streaming samples from the radio. Specify the
StartTime
name-value argument when you call the System object as a function. Alternatively, specify the name-value argument when you call
the step function.
To specify the blocking behavior of the streaming operation, use the Background
name-value argument.
You can now use a radio object as the radio input argument when you
create a usrp object.
You can now use the usrp
System object to control a USRP E320 radio with a custom algorithm deployed to the FPGA using the Target NI USRP Radios Workflow.
You can now use the DUTClockFrequency
property to query the clock frequency of the DUT in your deployed design.
See Also
Objects
Functions
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- 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)