Main Content

Burst-Mode Buffering

In the Communications Toolbox™ Support Package for USRP™ Radio, if the SDRu blocks or SDRu System object™ cannot keep up with the radio hardware, the model or code is not processing data in real time. Burst mode enables you to buffer a set of contiguous samples without losing samples by setting the number of frames in a burst.

Determine If You Need Burst Mode

It is recommended that you enable burst mode when your application requires fresh samples or guaranteed contiguous samples.

To see if the transmitted or received data is contiguous for an SDRu block:

To see if the transmitted or received data is contiguous for an SDRu System object:

For more information, see Detect Underruns and Overruns.

Tip

If your model is not running in real time, you can:

  • Use Burst mode

  • Use vector-based processing

  • Accelerate with code generation

Any combination of these techniques may be applied to approach or achieve real-time performance.

Enable Burst Mode

Use burst mode when your model is experiencing underruns or overruns because it cannot keep up with the amount of transmitted or received data in real time. Burst mode allows you to buffer a minimum set of contiguous samples without underruns or overruns.

Note

Overruns and underruns can still happen between bursts, especially with large burst sizes. Therefore, enabling the burst mode feature is recommended only if your model cannot keep up in real time.

The maximum burst size (in frames) is imposed by the operating system and the USRP device UHD™. The maximum size imposed by the UHD is approximately 1 GB, or 256 megasamples. This maximum number of samples is enforced by MATLAB®. For example, with a frame size of 4000 samples, the maximum burst is approximately 67k frames. Depending on the memory constraints on a specific host, a lower limit might be required. Exceeding the limit will be flagged by an error saying 'unable to allocate memory'. The default burst size is 100 frames.

Enable Burst Mode in SDRu System objects

Receiver Burst Mode Processing

When you use the burst mode for data reception, the first SDRu receiver System object call transfers a whole burst to the host computer memory and then the SDRu receiver System object processes the first frame. Subsequent SDRu receiver System object calls process the rest of the burst, one frame at a time, from the host computer memory (not from the radio). When all the frames in the transferred data have been processed, the next SDRu receiver System object call transfers another whole burst to the host computer memory and the first frame of data is processed by the SDRu receiver System object.

For example, Set the EnableBurstMode property to true, NumFramesInBurst property to 10, and SamplesPerFrame to 375000. For the first SDRu receiver System object call, a whole burst (375,000 samples/frame * 10 frames/burst = 3,750,000 samples/burst) is transferred to the host computer memory and the SDRu receiver System object processes the first frame of data. For subsequent SDRu receiver System object calls (second through tenth calls), one frame at a time, is processed from the host computer memory. After the whole burst has been processed, on the eleventh SDRu receiver System object call, another whole burst is transferred from the radio to the host computer memory and the first frame of data is processed by the SDRu receiver System object.

Burst-Mode Buffering to Overcome Overruns at Receiver

Configure a B210 radio with serial number set to '31B92DD'. Set the radio to receive at 2.5 GHz with a decimation factor of 125 and master clock rate of 56 MHz. Enable burst-mode buffering to overcome overrruns. Set number of frames in a burst to 20 and samples per frame to 37500.

Create a SDRu receiver System object to use for data reception.

rx = comm.SDRuReceiver(...
               'Platform','B210', ...
              'SerialNum','31B92DD', ...
              'CenterFrequency',2.5e9, ...
              'MasterClockRate', 56e6, ...
              'DecimationFactor',125, ...
              'OutputDataType','double');
rx.EnableBurstMode = true;
rx.NumFramesInBurst = 20;
rx.SamplesPerFrame = 37500;

Capture signal data using comm.DPSKDemodulaor System object.

demodulator = comm.DPSKDemodulator('BitOutput',true);

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

numFrames = 100;
for frame = 1:numFrames
        [data,len,overrun] = rx();
      if len>0
           demodulator(data);
          if (overrun)
           msg = ['Overrun detected in frame # ', int2str(frame)];
           disp(msg);
          end
      end
end
Overrun detected in frame # 1
Overrun detected in frame # 21
Overrun detected in frame # 41
Overrun detected in frame # 61
Overrun detected in frame # 81
release(rx)

Overruns are indicated at the start frame of transmission for each burst. 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.

Transmitter Burst Mode Processing

When you use burst mode for data transmission, the data is not transferred to the radio until the SDRu transmitter System object has been called NumFramesInBurst times. After the SDRu transmitter System object is called for NumFramesInBurst times, the whole burst is transferred to the radio and then transmitted.

Burst-Mode Buffering to Overcome Underruns at Transmitter

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.

Enable Burst Mode in SDRu Blocks

The SDRu Transmitter and SDRu Receiver blocks have an Enable burst mode parameter. When you select this parameter, the block produces a set of contiguous frames without underruns or overruns. Enable burst mode to simulate models that cannot run in real time. Specify the amount of contiguous data by using the Number of frames in burst parameter. The default number of frames in a burst is 100.

Related Topics