usrp
Add-On Required: This feature requires the Wireless Testbench™ Support Package for NI™ USRP™ Radios add-on.
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
usrp
object 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
transmit
function. With this function, you can test the receive path on your DUT.Retrieve captured data from the PL DDR buffer by using the
capture
function. 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.
Creation
Description
sets properties using one or more name-value arguments. For
example,
device
= usrp(radio
,Name=Value
)TransmitCenterFrequency
=2.4e9
specifies a center frequency of 2.4 GHz on all DUT output and transmit
antennas.
Input Arguments
radio
— Radio setup configuration
string scalar
Radio setup configuration, specified as a string scalar. To create a radio setup
configuration, set up your radio and save your radio setup configuration using the Radio Setup
wizard. To list all saved radio setup configurations, call the radioConfigurations
function.
For a list of supported radios, see Supported Radio Devices.
Example: "MyRadio"
indicates that you saved a radio setup
configuration under the name MyRadio in the Radio Setup wizard.
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
TransmitCenterFrequency
— Center frequency in Hz of DUT output and transmit
antennas
2.4e9
(default) | positive numeric scalar | numeric array
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
DUTOutputAntennas
andTransmitAntennas
properties.Numeric array — The object applies the ith array element value to the ith antenna in the
DUTOutputAntennas
andTransmitAntennas
properties, in that order.
The valid center frequency range depends on the radio device.
Radio Device | Center Frequency |
---|---|
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
TransmitRadioGain
— Gain in dB of DUT output and transmit antennas
10
(default) | positive numeric scalar | numeric array
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
DUTOutputAntennas
andTransmitAntennas
properties.Numeric array — The object applies the ith array element value to the ith antenna in the
DUTOutputAntennas
andTransmitAntennas
properties, in that order.
The valid gain range depends on the radio device.
Radio Device | Capture Radio Gain |
---|---|
USRP N310 | 0 dB to 75 dB |
USRP N320 | 0 dB to 60 dB |
USRP N321 | 0 dB to 60 dB |
USRP X310 | 0 dB to 31.5 dB |
USRP X410 | 0 dB to 60 dB |
Tunable: Yes
Data Types: double
ReceiveCenterFrequency
— Center frequency in Hz of DUT input and capture antennas
2.4e9
(default) | positive numeric scalar | numeric array
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
DUTInputAntennas
andCaptureAntennas
properties.Numeric array — The object applies the ith array element value to the ith antenna in the
DUTInputAntennas
andCaptureAntennas
properties, in that order.
The valid center frequency range depends on the radio device.
Radio Device | Center Frequency |
---|---|
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
ReceiveRadioGain
— Gain in dB of DUT input and capture antennas
10
(default) | positive numeric scalar | numeric array
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
DUTInputAntennas
andCaptureAntennas
properties.Numeric array — The object applies the ith array element value to the ith antenna in the
DUTInputAntennas
andCaptureAntennas
properties, in that order.
The valid gain range depends on the radio device.
Radio Device | Capture Radio Gain |
---|---|
USRP N310 | 0 dB to 75 dB |
USRP N320 | 0 dB to 60 dB |
USRP N321 | 0 dB to 60 dB |
USRP X310 | 0 dB to 31.5 dB |
USRP X410 | 0 dB to 60 dB |
Tunable: Yes
Data Types: double
SampleRate
— Baseband sample rate of the radio front end in Hz
positive numeric scalar
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 |
---|---|
USRP N310 |
|
USRP N320 |
|
USRP N321 |
|
USRP X310 |
|
USRP X410 |
|
Radio | Supported Decimation or Interpolation Factor |
---|---|
USRP N310 USRP N320 USRP N321 USRP X410 | 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 |
Data Types: double
DUTInputAntennas
— Radio antennas for input to the DUT
string scalar | string array
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 N
th 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 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 | RFA channel: RX2 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 N310 | 4 |
USRP N320 | 4 |
USRP N321 | 4 |
USRP X310 | 2 |
USRP X410 | 4 |
Example: DUTInputAntennas=["RF0:RX2","RF1:RX2"]
specifies two DUT input antennas.
Data Types: string
DUTOutputAntennas
— Radio antennas for transmit from DUT
string scalar | string array
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 N
th 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 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 | 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 N310 | 4 |
USRP N320 | 4 |
USRP N321 | 4 |
USRP X310 | 2 |
USRP X410 | 4 |
Example: DUTOutputAntennas=["RF0:TX/RX","RF1:TX/RX"]
specifies two DUT output antennas.
Data Types: string
CaptureAntennas
— Radio antennas for capture to host
"No Antennas Selected"
(default) | string scalar | string array
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 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 | RFA channel: RX2 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 N310 | 4 |
USRP N320 | 4 |
USRP N321 | 4 |
USRP X310 | 2 |
USRP X410 | 4 |
Example: CaptureAntennas=["RF2:RX2","RF3:RX2"]
specifies two capture antennas.
Data Types: string
TransmitAntennas
— Radio antennas for transmit from host
"No Antennas Selected"
(default) | string scalar | string array
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 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 | 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 N310 | 4 |
USRP N320 | 4 |
USRP N321 | 4 |
USRP X310 | 2 |
USRP X410 | 4 |
Example: TransmitAntennas=["RF2:TX/RX","RF3:TX/RX"]
specifies two transmit antennas.
Data Types: string
CaptureDDRAllocation
— Allocated PL DDR buffer memory in samples for capture antennas
10e6
(default) | even positive integer
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
,CaptureDDRAllocation
samples are allocated.For each antenna that you specify in
TransmitAntennas
,TransmitDDRAllocation
samples are allocated.For each data streaming connection between the DUT and the PL DDR buffer, the memory allocation is determined by the
DDRAllocation
you specify when you add streaming interfaces to your DUT with theaddRFNoCStreamInterface
function.
The memory buffer size depends on the radio.
Radio Device | Memory Buffer Size | Maximum Data Samples |
---|---|---|
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
TransmitDDRAllocation
— Allocated PL DDR buffer memory in samples for transmit antennas
10e6
(default) | even positive integer
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
,CaptureDDRAllocation
samples are allocated.For each antenna that you specify in
TransmitAntennas
,TransmitDDRAllocation
samples are allocated.For each data streaming connection between the DUT and the PL DDR buffer, the memory allocation is determined by the
DDRAllocation
you specify when you add streaming interfaces to your DUT with theaddRFNoCStreamInterface
function.
The memory buffer size depends on the radio.
Radio Device | Memory Buffer Size | Maximum Data Samples |
---|---|---|
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
DUTClockFrequency
— Clock frequency of the DUT in Hz
positive numeric scalar
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 specifiedSampleRate
is 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
LoopbackMode
— Option to enable loopback of IQ samples from transmit to receive antennas
"Disabled"
(default) | "FPGA"
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 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 |
|
|
|
| |
USRP X410 |
|
|
|
| |
|
| |
|
|
Data Types: string
BypassDUT
— Flag to remove DUT from signal path
0(false)
(default) | 1(true)
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. This frees up hardware resources to assign TransmitAntennas
and CaptureAntennas
for transmit and capture data directly to the
host.
Data Types: logical
BypassPLDDRBuffer
— Flag to remove PL DDR buffer from signal path
0(false)
(default) | 1(true)
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. This option connects the source or
sink connection directly to the host instead.
Data Types: logical
Usage
Description
device(
streams numSamples
)numSamples
samples from the radio front
end.
Input Arguments
numSamples
— Number of samples
integer number of samples
Number of samples, specified as an integer number of samples.
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)
Specific to usrp
programFPGA | Program FPGA on NI USRP radio device with custom bitstream |
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 these functions to connect to, configure, and control your NI USRP radio device. The diagram shows the call sequence.
Create the
usrp
System object with a radio setup configuration that you specify with theradio
input argument. Set properties that you apply to configure the radio front end settings in a later step.Use the
programFPGA
anddescribeFPGA
functions 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
setup
to 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 thefpga
object. You can read or write registers on the DUT by using thereadPort
andwritePort
function. This step enables you to start streaming samples into your radio with the DUT ports in a known state.Call the System object as a function or call the
step
function on the System object to start the radio front end. This step callssetup
if you did not do so previously, and then starts requesting streaming samples from the radio front end into the FPGA. Specify thenumSamples
argument to request a specific number of samples, or stream samples continuously by specifying no input arguments.Call the
reset
function 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
release
function 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.
Examples
Connect to NI USRP Radio from MATLAB
This example uses:
- Wireless TestbenchWireless Testbench
- Wireless Testbench Support Package for NI USRP RadiosWireless Testbench Support Package for NI USRP Radios
- HDL CoderHDL Coder
- HDL Coder Support Package for Xilinx FPGA and SoC DevicesHDL Coder Support Package for Xilinx FPGA and SoC Devices
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);
Configure NI USRP Radio Device and Program FPGA
This example uses:
- Wireless TestbenchWireless Testbench
- Wireless Testbench Support Package for NI USRP RadiosWireless Testbench Support Package for NI USRP Radios
- HDL CoderHDL Coder
- HDL Coder Support Package for Xilinx FPGA and SoC DevicesHDL Coder Support Package for Xilinx FPGA and SoC Devices
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.
Configure Hardware Interfaces on NI USRP Radio Device
This example uses:
- Wireless TestbenchWireless Testbench
- Wireless Testbench Support Package for NI USRP RadiosWireless Testbench Support Package for NI USRP Radios
- HDL CoderHDL Coder
- HDL Coder Support Package for Xilinx FPGA and SoC DevicesHDL Coder Support Package for Xilinx FPGA and SoC Devices
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
Configure NI USRP Radio Device, Program FPGA, and Stream Samples
This example uses:
- Wireless TestbenchWireless Testbench
- Wireless Testbench Support Package for NI USRP RadiosWireless Testbench Support Package for NI USRP Radios
- HDL CoderHDL Coder
- HDL Coder Support Package for Xilinx FPGA and SoC DevicesHDL Coder Support Package for Xilinx FPGA and SoC Devices
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);
Configure NI USRP Radio Device and Retrieve Captured Data
This example uses:
- Wireless TestbenchWireless Testbench
- Wireless Testbench Support Package for NI USRP RadiosWireless Testbench Support Package for NI USRP Radios
- HDL CoderHDL Coder
- HDL Coder Support Package for Xilinx FPGA and SoC DevicesHDL Coder Support Package for Xilinx FPGA and SoC Devices
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
Configure NI USRP Radio Device and Transmit Waveform
This example uses:
- Wireless TestbenchWireless Testbench
- Wireless Testbench Support Package for NI USRP RadiosWireless Testbench Support Package for NI USRP Radios
- HDL CoderHDL Coder
- HDL Coder Support Package for Xilinx FPGA and SoC DevicesHDL Coder Support Package for Xilinx FPGA and SoC Devices
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 transmit antenna on the radio and transmitLength
samples of memory allocation 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 a random transmit waveform.
txWaveform = complex(randn(transmitLength,1),randn(transmitLength,1));
Transmit the generated waveform continuously.
transmit(device,txWaveform,"continuous");
Stop the continuous transmission after 5 seconds.
pause(5); stopTransmission(device);
Version History
Introduced in R2024aR2024b: Query DUT clock frequency
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.
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)