comm.SDRuReceiver

Receive data from USRP® device

Description

The SDRuReceiver System object™ receives data from 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 receives signal and control data from a USRP® board using the Universal Hardware Driver (UHD) from Ettus Research®. The SDRuReceiver System object receives data from a USRP® board and outputs a column vector or matrix signal of a fixed number of rows. 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

rx = comm.SDRuReceiver creates an SDRuReceiver System object, rx.

rx = comm.SDRuReceiver(Name,Value) creates an SDRuReceiver 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.

rx = comm.SDRuReceiver(address,Name,Value) creates an SDRuReceiver 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'

  • 'B200'

  • 'B210'

  • 'X300'

  • 'X310'

Setting Platform to 'N200/N210/USRP2', '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', '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 parameter, 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

'B200'

1

'B210'

1, 2, or [1 2]

'X300'

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.

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

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 received center frequency. However, it does affect the intermediate center frequency in the USRP® hardware, as shown in the diagram.

  • f RF represents the received RF frequency.

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

  • f LO offset is the local oscillator offset frequency.

  • Ideally, fRF - fcenter = 0.

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

Data Types: double

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 N2xx, 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

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

ValueB-seriesN-seriesX-series

1

Not valid.

2

Acceptable when using int8 transport data type only.

3

Not valid.

Any 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 520 to 1024

Not valid.

Not valid.

The radio uses the decimation factor when downconverting the intermediate frequency (IF) signal to a complex baseband signal.

Tunable: Yes

Data Types: double

Transport data type, specified as:

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

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

Using the default transport data rate data type, means 16 bits are assigned for the in-phase component and 16 bits are assigned for the quadrature component, resulting in 32 bits for each complex sample of transport data.

Data Types: char

Data type of the output signal, specified as 'Same as transport data type', 'double', or 'single'.

  • 'Same as transport data type' — Indicates output data type will be the same as the transport data type, either 'int8' or 'int16'.

    • When the transport data type is 'int8', output values will be raw 8-bit I and Q samples from the board in the range [–128, 127].

    • When the transport data type is 'int16', output values will be raw 16-bit I and Q samples from the board in the range [–32768, 32767].

  • 'single' — Indicates single-precision floating point values scaled to the range of [–1, 1].

  • 'double' — Indicates double-precision floating point values scaled to the range of [–1, 1].

Data Types: double
Complex Number Support: Yes

Number of samples per frame of the output signal that the object generates, specified as a positive integer scalar. This value optimally utilizes the underlying Ethernet packets, which have a size of 1500 8-bit bytes.

Data Types: double

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 parameter, 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

'B200' or 'B210'

From 5e6 to 56e6. 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 32e6.

'X300' or 'X310'

120e6, 184.32e6, or 200e6

Default value 200e6.

Dependencies

To enable this parameter, set Platform to 'B200', 'B210', '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 SDRuReceiver System object
stepReceive signal and control data from USRP® board
Common to All System Objects
release

Allow System object property value changes

Usage

Object Connectivity

You can verify that your SDRuReceiver System object is connected to USRP® hardware by using the info method.

  1. Create an SDRuReceiver System object.

    rx = comm.SDRuReceiver
  2. Use the info method.

    S = info(rx)

    Hardware information is returned in structure S.

Baseband Rate Lost Samples

The SDRuReceiver System object has an optional lost samples output port. When this port is active, it outputs a logical signal that indicates whether the System object is processing data in real time. If the System object is not keeping up with the hardware, the signal indicates the approximate number of lost samples.

This port is a useful diagnostic tool for determining real-time operation of the System object. If your code is not running in real time, see Common Problems and Fixes.

Examples

Configure USRP® Board with SDRuReceiver System Object

Configure a USRP® board with an IP address of 192.168.30.7 that receives at 2.5 GHz with a decimation factor of 256. Save the data using the dsp.SignalSink System object.

    rx_SDRu = comm.SDRuReceiver('Platform','N200/N210/USRP2', ...
        'IPAddress','192.168.30.7', ...
        'CenterFrequency',2.5e9, ...
        'DecimationFactor',256);
    rx_log = dsp.SignalSink;
    for counter = 1:20
      data = rx_SDRu();
      rx_log(data);
    end

Use info method to confirm actual radio settings.

info(rx_SDRu)
ans = 

  struct with fields:

                    Mboard: 'N210r4'
                  RXSubdev: 'WBXv3 RX+GDB'
                  TXSubdev: 'WBXv3 TX+GDB'
    MinimumCenterFrequency: 48750000
    MaximumCenterFrequency: 2.2200e+09
               MinimumGain: 0
               MaximumGain: 38
                  GainStep: 0.0500
           CenterFrequency: 2.2200e+09
     LocalOscillatorOffset: -2.0000e+07
                      Gain: 8
           MasterClockRate: 100000000
          DecimationFactor: 256
        BasebandSampleRate: 390625

CreateSDRuReceiver System Object for B210 Board

rx = comm.SDRuReceiver('Platform','B210','SerialNum','ECR04ZDBT')
rx = 

  comm.SDRuReceiver with properties:

                 Platform: 'B210'
                SerialNum: 'ECR04ZDBT'
           ChannelMapping: 1
          CenterFrequency: 2.4500e+09
    LocalOscillatorOffset: 0
                     Gain: 8
                PPSSource: 'Internal'
              ClockSource: 'Internal'
          MasterClockRate: 32000000
         DecimationFactor: 512
        TransportDataType: 'int16'
           OutputDataType: 'Same as transport data type'
          SamplesPerFrame: 362
          EnableBurstMode: false

Create SDRuReceiver System Object for X310 Board

rx = comm.SDRuReceiver('Platform','X310','IPAddress','192.168.10.2')
rx = 

  comm.SDRuReceiver with properties:

                 Platform: 'X310'
                IPAddress: '192.168.10.2'
           ChannelMapping: 1
          CenterFrequency: 2.4500e+09
    LocalOscillatorOffset: 0
                     Gain: 8
                PPSSource: 'Internal'
              ClockSource: 'Internal'
          MasterClockRate: 200000000
         DecimationFactor: 512
        TransportDataType: 'int16'
           OutputDataType: 'Same as transport data type'
          SamplesPerFrame: 362
          EnableBurstMode: false

More About

expand all

Introduced in R2011b


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