comm.SDRuTransmitter

Send data to USRP® device

Description

The SDRuTransmitter System object™ sends data to a Universal Software Radio Peripheral (USRP®[1] ) hardware device, allowing simulation and development for various software-defined radio applications. The object enables communication with a USRP® board on the same Ethernet subnetwork or a USRP® board via a USB connection. You can write a MATLAB® application that uses the System object or you can generate code for the System object without connecting to a USRP® radio.

This object accepts a column vector or matrix input signal from MATLAB and transmits signal and control data to a USRP® board using the Universal Hardware Driver (UHD) from Ettus Research®. The SDRuTransmitter System object is a sink that sends the data it receives to a USRP® board. The first call to this object might contain transient values, which can result in packets containing undefined data.

Note

Starting in R2016b, instead of using the step method to perform the operation defined by the System object, you can call the object with arguments, as if it were a function. For example, y = step(obj,x) and y = obj(x) perform equivalent operations.

Construction

tx = comm.SDRuTransmitter creates an SDRuTransmitter System object, tx.

tx = comm.SDRuTransmitter(Name,Value) creates an SDRuTransmitter System object with the specified property Name set to the specified Value. You can specify additional name-value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

tx = comm.SDRuTransmitter(address,Name,Value) creates an SDRuTransmitter System object, with the IPAddress property set to address and the other specified properties set to the specified values.

Properties

expand all

Model number of the radio, specified as:

  • 'N200/N210/USRP2'

  • 'N300'

  • 'N310'

  • 'N320/N321'

  • 'B200'

  • 'B210'

  • 'X300'

  • 'X310'

Setting Platform to 'N200/N210/USRP2', 'N300', 'N310', 'N320/N321', 'X300', or 'X310' enables the IPAddress property. Setting Platform to 'B200' or 'B210' enables the SerialNum property.

Data Types: char

IP address of the USRP® device, specified as a character vector. When more than one IP address is specified, each address is separated by commas or spaces.

To find the logical network location of all connected USRP® radios, use the findsdru function.

Example: '192.168.10.2, 192.168.10.5' specifies IP addresses for two devices.

Dependencies

To enable this property, set 'Platform' to 'N200/N210/USRP2', 'N300', 'N310', 'N320/N321', 'X300', or 'X310'.

Data Types: char

Serial number of radio hardware, specified as a character vector.

This property must match the serial number of the radio hardware assigned during hardware setup. See Guided USRP Radio Support Package Hardware Setup. If you configure the radio hardware with a serial number other than the default, update SerialNum accordingly.

The drop-down list displays serial numbers for USRP® devices attached to the host computer.

Dependencies

To enable this property, set 'Platform' to 'B200' or 'B210'.

Data Types: char

Channel mapping for radio or bundled radios, specified as a positive integer scalar or vector. This table shows valid values for various radio platforms.

Platform ValuePossible ChannelMapping Value

'N200/N210/USRP2'

1-by-N row vector, where N is the number of IP addresses included in IPAddress

'N300'

1, 2, or [1 2]

'N310'

Row vector of length [1, 4] with channel numbers as {1, 2, 3, 4}

'N320/N321'

1, 2, or [1 2]

'B200'

1

'B210'

1, 2, or [1 2]

'X300' or 'X310'

1, 2, or [1 2] when IPAddress includes one IP address.

1-by-2N row vector, where N is the number of IP addresses included in IPAddress.

When IPAddress includes multiple IP addresses, the channels defined by ChannelMapping are ordered first by the order in which the IP addresses appear in the list and then by the channel order within the same radio.

Example: If Platform is 'X300' and IPAddress is '192.168.20.2, 192.168.10.3', then ChannelMapping must be [1 2 3 4]. Channels 1, 2, 3, 4 of the bundled radio refer to channels 1 and 2 of the radio with IP address 192.168.20.2 and channels 1 and 2 of the radio with IP address 192.168.10.3.

Data Types: char

Center frequency, specified as a nonnegative scalar or row vector in Hz. The valid range of values for this property depends on the RF daughter card of the USRP® device.

When you call the step method to change the center frequency, specify the value according to these conditions:

  • For a single channel (SISO), specify the value for the center frequency as a nonnegative scalar.

  • For multiple channels (MIMO) that use the same center frequency, specify the center frequency as a nonnegative scalar. The center frequency is set by scalar expansion.

  • For multiple channels (MIMO) that use different center frequencies, specify the values in a row vector, for example, [70e6 100e6]. The ith element of the vector is applied to the ith channel specified by ChannelMapping.

    Note

    • The center frequency for B210 with MIMO must be a scalar. You cannot specify the frequencies as a vector.

    • The channels corresponding to the same RF daughterboard of N310 must have same center frequency value.

Tunable: Yes

Data Types: double

Local oscillator (LO) offset frequency, specified as a scalar in Hz. The valid range of this property depends on the RF daughterboard of the USRP® device.

The local oscillator offset does not affect the transmitted center frequency. However, it does affect the intermediate center frequency in the USRP® hardware, as shown in the diagram.

  • fcenter represents the center frequency specified by the System object.

  • fLO offset is the local oscillator offset frequency.

To move the center frequency away from interference or harmonics generated by the USRP® hardware, use LocalOscillatorOffset.

When you call the step method to change the LO offset, specify the value according to these conditions:

  • For a single channel (SISO), specify the LO offset as a scalar.

  • For multiple channels (MIMO), the LO offset must be zero. This restriction is due to a UHD limitation. You can specify the LO offset as scalar (0) or as a vector ([0 0]).

Tunable: Yes

Data Types: double

Overall gain for the USRP® hardware transmitter data path, including both analog and digital components, specified as a scalar or row vector in dB. The valid range of this property depends on the RF daughterboard of the USRP® device.

When you call the step method to change the gain, specify the value according to these conditions:

  • For a single channel (SISO), specify the value for the gain as a scalar.

  • For multiple channels (MIMO) that use the same gain value, specify the gain as a scalar. The gain is set by scalar expansion.

  • For multiple channels (MIMO) that use different gains, specify the values in a row vector, for example, [32 30]. The ith element of the vector is applied to the ith channel specified by ChannelMapping.

Tunable: Yes

Clock source, specified as:

  • Internal — Uses the internal clock signal of the USRP® radio.

  • External — Uses the 10-MHz clock signal from an external clock generator.

For B-series radios, the external clock port is labeled 10 MHz. For N3xx series, N2xx series, USRP2®, and X-series radios, the external clock port is labeled REF IN.

To synchronize the frequency for all channels of the bundled radios, provide a common external 10-MHz clock signal to all the bundled radios and set ClockSource to 'External'.

Data Types: char

Interpolation factor, specified as an integer from 1 to 1024 with restrictions, based on the radio you are using.

ValueB-seriesN2xx-seriesN3xx-seriesX-series

1

Not valid.

2

Acceptable when using int8 transport data type only.

3

Not valid.

Any odd number from 4 to 128

Not valid.

Any even number from 4 to 128

Any even number from 128 to 256

Any multiple of 4 from 256 to 512

Any multiple of 8 from 512 to 1024

Not valid.

Not valid.

Not valid.

The radio uses the interpolation factor when upconverting the complex baseband signal to an intermediate frequency (IF) signal.

Tunable: Yes

Data Types: double

Transport data type, specified as:

  • 'int16' — Uses 16-bit transport. Achieves higher precision than 8-bit transport.

  • 'int8' — Uses 8-bit transport. Uses a quantization step 256 times larger and achieves approximately two times faster transport data rate than 16-bit transport.

Specifying TransportDataType as int16 results in 32 bits for each complex sample of transport data. Each complex sample assigns 16 bits for the in-phase component and 16 bits for the quadrature component.

Data Types: char

Option to enable burst mode, specified as true or false. To produce a set of contiguous frames without an overrun or underrun to the radio, set EnableBurstMode to true. Enabling burst mode helps you simulate models that cannot run in real time.

When burst mode is enabled, specify the desired amount of contiguous data using the NumFramesInBurst property. For more information, see Detect Underruns and Overruns.

Data Types: logical

Number of frames in a contiguous burst, specified as an integer.

Dependencies

To enable this property, set EnableBurstMode to true.

Data Types: double

Master clock rate, specified as a scalar in Hz. The master clock rate is the A/D and D/A clock rate. The valid range of values for this property depends on the radio platform connected.

Platform ValuePossible Master clock rate (Hz) Value

'N200/N210/USRP2'

100e6 Hz. Read-only.

'N300' or 'N310'

122.88e6 Hz, 125e6 Hz, or 155.3e6 Hz

Default value is 125e6 Hz.

'N320/N321'

200e6 Hz, 245.76e6 Hz, or 250e6 Hz

Default value is 200e6 Hz.

'B200' or 'B210'

From 5e6 Hz to 56e6 Hz. When using B210 with multiple channels, the clock rate must be no higher than 30.72e6 Hz. This restriction is a hardware limitation for the B210 radios only when using two-channel operations.

Default value is 32e6 Hz.

'X300' or 'X310'

184.32e6 Hz or 200e6 Hz

Default value is 200e6 Hz.

Dependencies

To enable this property, set Platform to 'B200', 'B210', 'N300', 'N310', 'N320/N321', 'X300', or 'X310'.

Data Types: double

Parts per second (PPS) signal source, specified as:

  • 'Internal' — Uses the internal PPS signal of the USRP® radio.

  • 'External' — Uses the PPS signal from an external signal generator.

To synchronize the time for all channels of the bundled radios, provide a common external PPS signal to all the bundled radios and set PPSSource to 'External'.

Data Types: char

Methods

infoDisplay information about SDRuTransmitter System object
stepTransmit signal and control data to USRP® board
Common to All System Objects
release

Allow System object property value changes

Examples

collapse all

Use the info object function to get information from the connected B210 radio. The actual values used in the radio are shown by info and can be vary slightly from the values specified in the object.

radio = comm.SDRuTransmitter('Platform','B210','SerialNum','30F59A1');
radio.CenterFrequency = 912.3456e6;
radio.LocalOscillatorOffset = 1000;
radio.Gain = 8.3;
radio.MasterClockRate = 10.56789e6;
radio.InterpolationFactor = 510;
info(radio)                   
ans = struct with fields:
                    Mboard: 'B210'
                  RXSubdev: 'FE-RX2'
                  TXSubdev: 'FE-TX2'
    MinimumCenterFrequency: 4.4716e+07
    MaximumCenterFrequency: 6.0053e+09
               MinimumGain: 0
               MaximumGain: 89.7500
                  GainStep: 0.2500
           CenterFrequency: 9.1235e+08
     LocalOscillatorOffset: -999.7189
                      Gain: 8.2500
           MasterClockRate: 1.0568e+07
       InterpolationFactor: 512
        BasebandSampleRate: 2.0640e+04

Configure a B210 radio with serial number set to '30F59A1'. Set the radio to transmit at 2.5 GHz with an interpolation factor of 256.

Create a SDRu Transmitter System object to use for data transmission.

tx = comm.SDRuTransmitter(...
              'Platform','B210', ...
              'SerialNum','30F59A1', ...
              'CenterFrequency',2.5e9, ...
              'InterpolationFactor',256);

Create a DPSK modulator as the data source using comm.DPSKModulator System object. Inside a for loop, transmit the data using the tx System object.

mod = comm.DPSKModulator('BitInput',true);
    for counter = 1:20
      data = randi([0 1],30,1);
      modSignal = mod(data);
      tx(modSignal);
    end

Configure an B210 radio with serial number set to '30F59A1'. Set the radio to transmit at 2.5 GHz with an interpolation factor of 125 and master clock rate of 56 MHz.

Create a SDRu Transmitter System object to use for data transmission.

tx = comm.SDRuTransmitter(...
               'Platform','B210', ...
              'SerialNum','30F59A1', ...
              'CenterFrequency',2.5e9, ...
              'InterpolationFactor',125, ...
              'MasterClockRate', 56e6);

Create a DPSK modulator as the data source using comm.DPSKModulator System object.

modulator = comm.DPSKModulator('BitInput',true);

Inside a for loop, transmit the data using the tx System object and return underrun as an output argument. Display the messages when transmitter indicates underrun with data loss.

for frame = 1:20000
      data = randi([0 1], 30, 1);
      modSignal = modulator(data);
      underrun = tx(modSignal);
      if underrun~=0
          msg = ['Underrun detected in frame # ', int2str(frame)];
      end
end
    release(tx)

With SRDu transmitter System objects, the underrun output indicates data loss. This output is a useful diagnostic tool for determining real-time operation of the System object.

Configure a B210 radio with serial number set to '30F59A1'. Set the radio to transmit at 2.5 GHz with an interpolation factor of 125 and master clock rate of 56 MHz. Enable burst-mode buffering to overcome underruns. Set number of frames in a burst to 20.

Create a SDRu Transmitter System object to use for data transmission.

tx = comm.SDRuTransmitter(...
               'Platform','B210', ...
              'SerialNum','30F59A1', ...
              'CenterFrequency',2.5e9, ...
              'InterpolationFactor',125, ...
              'MasterClockRate', 56e6);
tx.EnableBurstMode = true;
tx.NumFramesInBurst = 20;

Create a DPSK modulator as the data source using comm.DPSKModulator System object.

modulator = comm.DPSKModulator('BitInput',true);
data = randi([0 1],37500,1);
modSignal = modulator(data);

Inside a for loop, transmit the data using the tx System object and return underrun as an output argument. Display the messages when transmitter indicates underrun with data loss.

numFrames = 100;
for frame = 1:numFrames
        underrun = tx(modSignal);
      if (underrun)
          msg = ['Underrun detected in frame # ', int2str(frame)];
         disp(msg)
      end
end
no tx ack
Underrun detected in frame # 20
Underrun detected in frame # 40
Underrun detected in frame # 60
Underrun detected in frame # 80
Underrun detected in frame # 100
release(tx)

Underruns are indicated at the last frame of transmission for each burst. With burst mode enabled, an underrun occurs in between bursts as the streaming resumes, because it is not possible to get continuous data when starting and stopping streaming.

More About

expand all

Compatibility Considerations

expand all

Errors starting in R2020a

Introduced in R2011b


[1] USRP, USRP2, UHD, and Ettus Research are trademarks of National Instruments Corp.