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:
Check the underrun port on SDRu Transmitter block.
Check the overrun port on SDRu Receiver block.
To see if the transmitted or received data is contiguous for an SDRu System object:
Check the
underrun
output when you callcomm.SDRuTransmitter
System object.Check the
overrun
output when you callcomm.SDRuReceiver
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 100000
. For the first SDRu
receiver System object call, a whole burst (1,00,000 samples/frame X 10 frames/burst
= 1,000,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 B200 radio with serial number 30FD838. 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 overruns. Set the number of frames in a burst to 20 and the number of samples per frame to 37500.
Create an SDRu receiver System object to use for data reception.
rx = comm.SDRuReceiver(... Platform ="B200", ... SerialNum ="30FD838", ... CenterFrequency =2.5e9, ... MasterClockRate =56e6, ... DecimationFactor =125, ... OutputDataType ="double"); rx.EnableBurstMode = true; rx.NumFramesInBurst = 20; rx.SamplesPerFrame = 37500;
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.
numFrames = 100; for frame = 1:numFrames [data,overrun] = rx(); if ~(overrun) demodulator(data); end end release(rx)
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 B200 radio with serial number set to 30FD838
. 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 the number of frames in a burst to 20.
Create an SDRu Transmitter System object for data transmission.
tx = comm.SDRuTransmitter(... Platform = "B200", ... SerialNum = "30FD838", ... 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.
numFrames = 100; for frame = 1:numFrames underrun = tx(modSignal); end
no tx ack
release(tx)
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 Examples
- WLAN Beacon Receiver Using Software-Defined Radio (WLAN Toolbox)
- OFDM Transmitter Using Software-Defined Radio
- OFDM Receiver Using Software Defined Radio