Main Content

Detect Underruns and Overruns

You can detect underruns and overruns using the lost sample indicators of the SDRu blocks and SDRu System object™. Use these indicators as a diagnostic tool to determine real-time execution of your designs. If your design is not running in real time, see Burst-Mode Buffering.

Detect Lost Samples Using SDRu Transmitter Block

The SDRu Transmitter block has an optional lost sample port called underrun. The lost samples port is disabled by default. To enable it:

  • On the SDRu transmitter block, select the Enable underrun output port parameter.

To detect underruns during the transmission of radio signals, check the underrun output port on the SDRu transmitter block.

SDRu transmitter block with underrun port

During the simulation, to see if any data loss is occurring, check the underrun output port of the transmitter.

  • 0 — Indicates that no data samples were lost

  • 1 — Indicates that data samples were lost

Detect Lost Samples Using SDRu Receiver Block

The SDRu Receiver block has an optional lost sample port called overrun. The lost samples port is disabled by default. To enable it:

  • On the SDRu receiver block, select the Enable overrun output port parameter.

To detect overruns during the reception of radio signals, check the overrun output port on the SDRu receiver block.

SDRu receiver block with overrun port

During the simulation, to see if any data loss is occurring, check the overrun output port of the receiver.

  • 0 — Indicates that no data samples were lost

  • 1 — Indicates that data samples were lost

Note

With burst mode enabled an overrun occurs in between bursts as the streaming resumes, because it is not possible to get continuous data when starting and stopping streaming.

Detect SDRu Transmitter System Object Underruns

When you call the comm.SDRuTransmitter System object, the underrun output argument indicates discontinuity of the data streaming from the host computer to the USRP radio. If your design is not running in real time, you can adjust properties that reduce the number of transported samples. To approach or achieve real-time performance, you can increase the interpolation factor.

To see if any data loss is occurring, check underrun output argument.

  • When output is 0 — No underrun detected

  • When output is ≥ 1 — Underrun detected at transmitter

Detect Lost Samples using SDRuTransmitter System Object

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

Create an SDRu Transmitter System object 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 output argument. Display messages when the transmitter indicates an 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)

Detect SDRu Receiver System Object Overruns

When you call the comm.SDRuReceiver System object, the overrun output argument indicates discontinuity of the data streaming from the USRP radio to the host computer. If your design is not running in real time, you can adjust properties that reduce the number of transported samples. To approach or achieve real-time performance, you can increase the decimation factor.

To see if any data loss is occurring, check overrun output argument.

  • When output is 0 — No overrun detected

  • When output is ≥ 1 — Overrun detected at receiver

Note

With burst mode enabled an overrun occurs in between bursts as the streaming resumes, because it is not possible to get continuous data when starting and stopping streaming.

Detect Lost Samples Using SDRu Receiver System Object

Configure a B200 radio with serial number 30FD838. Set the radio to receive at 2.5 GHz with a decimation factor of 125, the output data type to double and master clock rate of 56 MHz.

Create a USRP radio receiver System object for data reception.

rx = comm.SDRuReceiver(Platform ="B200", ...
         SerialNum ="30FD838", ...
         CenterFrequency =2.5e9, ...
         MasterClockRate =56e6, ...
         DecimationFactor =125, ...
         OutputDataType ="double");

Capture signal data using comm.DPSKDemodulator System object.

demodulator = comm.DPSKDemodulator(BitOutput =true);

Inside a for-loop, receive the data using the rx System object and it returns overrun as an output argument. With SRDu receiver System objects, the overrun output indicates data loss. This output is a useful diagnostic tool for determining real-time operation of the System object. Display the messages when the receiver indicates an overrun with data loss.

for frame = 1:2000
    [data,overrun] = rx();
    demodulator(data);
      if overrun ~= 0
         msg = ['Overrun detected in frame #',int2str(frame)];
      end
end
release(rx)

Related Topics