Steps for Implementing Frequency Offset Calibration with USRP Hardware
1. Connect one USRP to a virtual machine which acts as a transmitter whereas the other USRP to another virtual machine which acts as a receiver. In addition to this, connect a spectrum analyzer at the receiver side.
2. Copy 'sdruFrequencyCalibrationTransmitter.m' and ‘configureFreqCaliTx.m’ MATLAB scripts on the transmitter machine and 'sdruFrequencyCalibrationReceiver.m' and ‘configureFreqCaliRx.m’ at the receiver machine, respectively.
3. The USRP transmitter sends a sine wave at 100Hz which is defined with the variable bbTxFreq and the RF center frequency(rfTxFreq) is fixed at 915MHz. These values can be defined in 'sdruFrequencyCalibrationTransmitter.m' script.
4. In ‘configureFreqCaliTx.m’ script, change the value of prmFreqCalibTx.USRPGain to 31.5dB and prmFreqCalibTx.TotalFrames to 10,000.
5. Make sure that the variables bbRxFreq and rfRxFreq are also set to 100Hz and 915MHz respectively in the 'sdruFrequencyCalibrationReceiver.m' script.
6. Type ‘findsdru’ in the command window at both transmitter and receiver end. The status should be ‘Success’ as shown in the screenshot below.
7. Run the 'sdruFrequencyCalibrationTransmitter.m' and then sdruFrequencyCalibrationReceiver.m' scripts simultaneously.
8. The transmitted signal can be observed as the output after running 'sdruFrequencyCalibrationTransmitter.m' script. The output is as shown below. Click on the ‘Peak Finder’ icon which is present at the top left to find the highest amplitude peak. It can also be enabled by clicking on Tools -> Measurements -> Peak Finder.
As can be observed, the signal is not exactly centered at 0Hz. The RBW is 130 Hz and therefore the actual signal which is 100 Hz creates a peak at 130 Hz instead of 100 Hz. If the value is changed to 260 Hz then the peak will move to the next marker position. Therefore, it is not possible to represent every possible frequency with a limited RBW. The same applies to the receiver as well.
9. Observe the transmitted signal on the spectrum analyzer as well. The signal should be centered at 915MHz as shown in the figure below. The blue wave represents peak hold signal and yellow represents the transmitted signal.
10. At the receiver output, a spectrum is observed as shown below.
Enable the peak finder as mentioned in step 8. It is observed that the maximum amplitude peak is shifted by 0.52KHz. Thus, this is the frequency offset at the receiver which needs to be compensated. The offset compensation value is also printed on the command window. Add this value to the variable rfRxFreq. Thus, the value is (rfRxFreq=915e6+520). The sign of the shift needs to be taken into account.
11. Again follow the steps from 7 to 9. The receiver output can now be observed where the signal is centered at 0Hz.
This suggests that frequency offset compensation is achieved at the receiver.
References: