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.

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.

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

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 B210 radio with serial number set to '31B92DD'. Set the radio to receive at 2.5 GHz with an decimation factor of 125, output data type as 'double' and master clock rate of 56 MHz.

Create a USRP radio receiver System object to use for data reception.

rx = comm.SDRuReceiver('Platform','B210', ...
         'SerialNum','31B92DD', ...
         '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 return overrun as an output argument. Display the messages when receiver indicates overrun with data loss.

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

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.

Related Topics