This example shows how to use the USRP® Embedded Series Radio Support Package with Simulink® to determine the frequency offset between SDR devices. The transmitter sends a 10 kHz sine wave with the Frequency Offset Calibration (Tx) Using USRP® E310 model. The receiver receives the signal, calculates the frequency offset and displays the offset in the Frequency Offset Calibration (Rx) USRP® E310 model.
Refer to the Guided Host-Radio Hardware Setup documentation for details on configuring your host computer to work with the Support Package for USRP® Embedded Series Radio.
This example uses a matched pair of models to determine the frequency offset between two SDR devices:
The transmitter sends a 10 kHz tone. The receiver detects the transmitted tone using an FFT-based detection method. The offset between the transmitted 10 kHz tone and the received tone can then be calculated and used to compensate for the offset at the receiver. The pair of models provides the following information:
A quantitative value of the frequency offset
A graphical view of the spur-free dynamic range of the receiver
A graphical view of the qualitative SNR level of the received signal
Before running the example, make sure you have performed the following steps:
1. Configure your host computer to work with the Support Package for USRP® Embedded Series Radio. See Guided Host-Radio Hardware Setup for help.
Some additional steps may be required if you want to run two radios from a single host computer. See Setup for Two Radios Connecting to One Host for help.
2. Make sure that you have both the transmitter model usrpe3xxFrequencyCalibrationTxSL and the receiver model usrpe3xxFrequencyCalibrationRxSL open, with each configured to run on its own SDR hardware in its own instance of Simulink.
Start the transmitter model running, and then start the receiver model.
The calculated frequency offset is shown by the Frequency Offset Display block in the receiver model. The Spectrum Analyzer block in the Receiver subsystem shows the spectrum of the received signal. A sample spectrum is shown below.
In this case, the frequency with the maximum received signal power is at about 2.85kHz. Since the transmitter is sending a tone at 10 kHz, this means the frequency offset is about 7.15kHz. The spurious free dynamic range of the signal is about 46 dB.
To compensate for a transmitter/receiver frequency offset, add the displayed frequency offset value to the Center frequency parameter of the E310 Receiver block. Be sure to use the sign of the offset in your addition. Rerun the receiver with the applied frequency offset compensation. The calculated offset frequency displayed should now be close to zero, and the peak in the spectrum should be close to 10 kHz.
It is important to note that the frequency offset value is only valid for the center frequency used to run the calibration.
The following figure shows the transmitter model:
The transmitter sends a 10 kHz tone at a default center frequency of 2.4 GHz i.e. the tone is transmitted at 2.4 GHz + 10 kHz.
The following figure shows the receiver model:
The following figure shows the detailed structure of the Receiver subsystem:
The Spectrum Analyzer block computes and displays the power spectral density of the received signal.
The Find Peak Frequency subsystem uses an FFT to find the frequency with the maximum power in the received signal.
The Find Peak Frequency subsystem finds the frequency with the maximum power in the received signal. The subsystem is shown below:
In this subsystem, the Periodogram block returns the PSD estimate of the received signal. The Probe block finds the frame size and the frame sample time. With this information, the MATLAB® function block findpeakfreq finds the index of the maximum amplitude across the frequency band and converts the index to a frequency value according to the following calculation:
Foffset = IndexofMaxAmplitude * FrameSize / (FFTLength * FrameSampleTime)
Note that the FFT performed by the Periodogram uses 4096 samples. This means that the frequency offset calculated is limited to a resolution of 48 Hz.
This example describes the Simulink implementation of a pair of models for performing frequency offset calibration between two SDR devices. You can also view a MATLAB implementation of these models in Frequency Offset Calibration Transmitter Using USRP® E310 using MATLAB and Frequency Offset Calibration Receiver Using USRP® E310 using MATLAB.
If the received signal is very weak, you can try increasing the receiver gain by changing the Source of gain variable to Input port for the manual gain control mode or by changing it to 'AGC Fast Attack' or 'AGC Slow Attack'.
If you run the example as described but fail to see a signal like the one shown (e.g. you only receive noise or the spectrum display is never updated), see Common Problems and Fixes.
USRP® is a trademark of National Instruments Corp.