Main Content

usrp

Control NI USRP radio device

Since R2024a

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:

  1. Create the usrp object and set its properties.

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

device = usrp(radio) creates a usrp System object for the specified radio radio.

example

device = usrp(radio,Name=Value) sets properties using one or more name-value arguments. For example, TransmitCenterFrequency=2.4e9 specifies a center frequency of 2.4 GHz on all DUT output and transmit antennas.

Input Arguments

expand all

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

expand all

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:

The valid center frequency range depends on the radio device.

Radio DeviceCenter 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

Gain in dB of the DUT output and transmit antennas, specified as one of these options:

The valid gain range depends on the radio device.

Radio DeviceCapture 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

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 and CaptureAntennas properties.

  • Numeric array — The object applies the ith array element value to the ith antenna in the DUTInputAntennas and CaptureAntennas properties, in that order.

The valid center frequency range depends on the radio device.

Radio DeviceCenter 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

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 and CaptureAntennas properties.

  • Numeric array — The object applies the ith array element value to the ith antenna in the DUTInputAntennas and CaptureAntennas properties, in that order.

The valid gain range depends on the radio device.

Radio DeviceCapture 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

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 DeviceMCR

USRP N310

  • 122.88 MHz

  • 125.00 MHz

  • 153.60 MHz

USRP N320

  • 200.00 MHz

  • 245.76 MHz

  • 250.00 MHz

USRP N321

  • 200.00 MHz

  • 245.76 MHz

  • 250.00 MHz

USRP X310

  • 184.32 MHz

  • 200.00 MHz

USRP X410

  • 245.76 MHz

  • 250.00 MHz

RadioSupported 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

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 DeviceSupported Antenna PortString 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

"RFA:RX2" (default)

RFB channel: RX2 port

"RFB:RX2"

USRP X410

DB0 RF0 channel: RX 1 port

"DB0:RF0:RX1" (default)

DB0 RF1 channel: RX 1 port

"DB0:RF1:RX1"

DB1 RF0 channel: RX 1 port

"DB1:RF0:RX1"

DB1 RF1 channel: RX 1 port

"DB1:RF1:RX1"

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

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 DeviceSupported Antenna PortString 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

"RFA:TX/RX" (default)

RFB channel: TX/RX port

"RFB:TX/RX"

USRP X410

DB0 RF0 channel: TX/RX 0 port

"DB0:RF0:TX/RX0" (default)

DB0 RF1 channel: TX/RX 0 port

"DB0:RF1:TX/RX0"

DB1 RF0 channel: TX/RX 0 port

"DB1:RF0:TX/RX0"

DB1 RF1 channel: TX/RX 0 port

"DB1:RF1:TX/RX0"

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

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 DeviceSupported Antenna PortString 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

"RFA:RX2" (default)

RFB channel: RX2 port

"RFB:RX2"

USRP X410

DB0 RF0 channel: RX 1 port

"DB0:RF0:RX1" (default)

DB0 RF1 channel: RX 1 port

"DB0:RF1:RX1"

DB1 RF0 channel: RX 1 port

"DB1:RF0:RX1"

DB1 RF1 channel: RX 1 port

"DB1:RF1:RX1"

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

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 DeviceSupported Antenna PortString 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

"RFA:TX/RX" (default)

RFB channel: TX/RX port

"RFB:TX/RX"

USRP X410

DB0 RF0 channel: TX/RX 0 port

"DB0:RF0:TX/RX0" (default)

DB0 RF1 channel: TX/RX 0 port

"DB0:RF1:TX/RX0"

DB1 RF0 channel: TX/RX 0 port

"DB1:RF0:TX/RX0"

DB1 RF1 channel: TX/RX 0 port

"DB1:RF1:TX/RX0"

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

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.

The memory buffer size depends on the radio.

Radio DeviceMemory Buffer SizeMaximum Data Samples

USRP N310

2 GB229

USRP N320

2 GB229

USRP N321

2 GB229

USRP X310

1 GB228

USRP X410

4 GB230

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.

The memory buffer size depends on the radio.

Radio DeviceMemory Buffer SizeMaximum Data Samples

USRP N310

2 GB229

USRP N320

2 GB229

USRP N321

2 GB229

USRP X310

1 GB228

USRP X410

4 GB230

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 specified SampleRate 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

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 DeviceTransmit AntennaReceive 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

"RFA:TX/RX"

"RFA:RX2"

"RFB:TX/RX"

"RFB:RX2"

USRP X410

"DB0:RF0:TX/RX0"

"DB0:RF0:RX1"

"DB0:RF1:TX/RX0"

"DB0:RF1:RX1"

"DB1:RF0:TX/RX0"

"DB1:RF0:RX1"

"DB1:RF1:TX/RX0"

"DB1:RF1:RX1"

Data Types: string

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

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(numSamples) streams numSamples samples from the radio front end.

example

device() streams samples continuously from the radio front end until you call the reset function.

example

Input Arguments

expand all

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)

expand all

programFPGAProgram FPGA on NI USRP radio device with custom bitstream
describeFPGADescribe hardware interfaces on NI USRP radio device FPGA
captureRetrieve captured IQ data from an NI USRP radio device
transmitTransmit waveform over the air with an NI USRP radio device
stopTransmissionStop transmission from an NI USRP radio device
setupOne-time set up tasks for System objects
stepRun System object algorithm
resetReset internal states of System object
releaseRelease resources and allow changes to System object property values and input characteristics

Use these functions to connect to, configure, and control your NI USRP radio device. The diagram shows the call sequence.

  1. Create the usrp System object with a radio setup configuration that you specify with the radio input argument. Set properties that you apply to configure the radio front end settings in a later step.

  2. Use the programFPGA and describeFPGA 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.

  3. 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 the fpga object. You can read or write registers on the DUT by using the readPort and writePort function. This step enables you to start streaming samples into your radio with the DUT ports in a known state.

  4. Call the System object as a function or call the step function on the System object to start the radio front end. This step calls setup if you did not do so previously, and then starts requesting streaming samples from the radio front end into the FPGA. Specify the numSamples argument to request a specific number of samples, or stream samples continuously by specifying no input arguments.

  5. Call the reset function to stop the radio front end and restore the radio to the initialized state before setup. 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.

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

collapse all

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);

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.

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

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);

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

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 R2024a

expand all