Amarisoft

SDR Spectrum Analyzer

 

The purpose of this tutorial is to shows how to use sdr card on callbox or UE as a spectrum analyzer. It is useful tool to check up the receiver functionality of the specified sdr card and check up the transmission functionality of other sdr (neighbouring) cards.

you don't need to have any separate hardware for the spectrum analyzer introduced in this tutorial. You can use any sdr cards that you already have installed in your Callbox or UEsim if you don't use it for any other purpose. For example, let's assume that you have two sdr cards in your system and you are running an LTE cell using the first sdr card (i.e, sdr0). Then you can use the second sdr cards (i.e, sdr1) as a spectrum analyzer.  If you are not running lte service meaning that you are not activating any cell (i.e, no LTE cell, no NR cell), you can use both cards (i.e, sdr0 and/or sdr1) as spectrum analyzer. So if you have a callbox or UEsim with multiple SDR cards, it is same as you have multiple spectrum analyzer for free.

Major features that SDR spectrum analyzer provides are listed below.

In some aspect, this spectrum analyzer is not like dedicated spectrum analyzer. Followings are what you should not expect in comparision to a dedicated spectrum analyzer

NOTE : A lot of new features has been added to sdr_spectrum. The look and feel of the screen and the detailed functionality may look different from the screenshot shown in this tutorial. But you may apply the same logic of software operation to whichever version you are using. Follow the operation key description on the left panel of the software.

NOTE : Be aware that I am doing most of the test in radiative setup (i.e, via antenna) not in conductive way (i.e, via RF cable) and sdr RX performance is not as good as commercialized/specialized spectrum analyzer. So the measurement result would not be as accurate as the dedicated spectrum analyzer. The purpose of this tutorial is to let you build up some intuitions on RF output from an sdr at various different conditions.    

NOTE (Warning) : When you use the sdr_spectrum, make it sure that the input power to the sdr card does not exceed +2 dBm peak for SDR 50  and +5 dBm peak for SDR 100.

 

 

Table of Contents

 

 

Why Spectrum Analyzer on Protocol Box ?

 

Based on my first and second hand experience in the field of testing in Protocol, RF and even in baseband, I experienced and saw many cases of verification/validation engineers struggling with troubleshooting their issues just because of the lack of cheap troubleshooting tools while they are using sub million dollar test equipment. For example, a lot of RF test fails because of protocol issues, not RF issues. In this case, relatively small investment for quick protocol test equipment (or selecting RF test equipment with better protocol analysis option) would save a lot of time and effort to troubleshoot and find root cause of the fails. On the contrary, many of protocol fails not because of protocol issues but because of RF (radio link) issues. Usually most of the protocol equipment is very expensive (usually starting from a few hundred K USD to over million dollars). When some test with such a super expensitive box fails  and  no clear root cause is found in terms of protocol itself, in many cause such a super expensive box goes idle and expensive verification engineers tend to get lost in wrong direction. In many cases when I see this kind of situation, I was wondering why it is so difficult for them to make such a small investment like just a few 10K USD for some basic spectrum analyzer to troubleshoot sub million dollar test equipmemt.

I think most of the readers would know why.. but it is what it is.  The best case would be to have a protocol box and spectrum analyzer in a bundle. That's what Amarisoft Callbox (UEsim as well) does.

Amarisoft box does not provide the spectrum analyzer as a separate hardware only for spectrum analyzer. It provides a special program (sdr_spectrum) that can convert a SDR card installed in the box into a spectrum analyzer. For example, if you have a Amarisoft callbox with 4 SDR cards. When you are using only one of the SDR cards for a specific test, you can use any one (or all) of the remaining 3 SDR card as spectrum analyzer. You can use it as a quick troubleshooting or visualization tool as introduced in this tutorial or you can use them to capture I/Q signal for your algorithm test or verification software.

 

 

Test Setup

 

Test setup for this tutorial is as shown below.  I would suggest you to connect antenna (or RF cables) to as many sdr cards as possible as per your needs. (NOTE : In this setup, sdr1 is measuring power from sdr0 via antenna. so the measured spectrum would not be as accurate and stable as RF cable. If you need more accurate / stable spectrum, connect the two sdr in conductive way (RF cable)). I just want you to build up some intuitions on the output power of a sdr depending on center frequency, channel bandwidth etc.

NOTE : Unless explicitely mentioned, it is assumed that the test is done with the < Setup A >.  < Setup B > is used only for a specific test.

NOTE (Warning) :  You should not input the total power greater than +2 dBm peak for SDR 50  and +5 dBm peak for SDR 100  to SDR input. If your power from SDR TX is high, adjust it with tx_gain parameter or put an external attenuator so that the sdr input power does not go over the input limit.

 

 

Setup A

TestSetup Callbox UE 2sdr 01

 

 

Setup B

 

       SDR 0 : TX1--------> SDR 1 : RX1  AND  SDR 0 : TX2 --------> SDR 1 : RX2  

TestSetup Callbox Cable sdr0 1

 

 

 

Key Command Line

 

Followings are the list of the important command used in this tutorial. You may copy and paste these examples and modify the parameter values as you need

 

 

 

Running on Callbox

 

If you want to run this directly on Callbox, you need to switch to graphics mode to launch spectrum window.

Switch to the graphics mode using following command

Sdr Spectrum Test 1 01

Open up two (or more) Terminals. One for running lte service and another for running spectrum analyzer

Sdr Spectrum Test 1 02

 

 

Running on ssh

 

If you want to run the spectrum from a remote PC via ssh. you can run the spectrum without running startx on the callbox. However, to run the spectrum (display the spectrum) on the remote PC, the remote PC should be running on X11.  The only restriction you have to do is to connect ssh with -X option as in following example.

A couple of example setup that works or does not work with ssh -X are as follows.

 

Example 1 >  Remote PC running on Fedora GUI (or any other X11 based Linux) mode  ==> OK

Example 2 >  Remote PC running on Windows ==> NOT OK. This would give you the message 'Could not display' when you run './sdr_spectrum'

Example 3 >  Remote PC running on Windows with Virtual box running X11 based GUI (e.g, Ubuntu) ==> OK

 

 

Test 1 : LTE on sdr 0 and Spectrum on sdr 1

 

Configuration

 

You may use any configuration. In this tutorial, I used the configuration for basic LTE attach as shown here .  In this test, I am measuring the spectrum for an LTE cell without any UE connected. It means the cell is just transmitting PSS/SSS/PBCH and SIB messages and there is no user traffic going on in this test.

 

Run Lte Service

 

In this tutorial, I will run a eNB/gNB on sdr0 and run the spectrum analyzer on another sdr (sdr 1 or 2 or 3) and measure spectrum of the signal transmitted by the tx port of sdr 0

Sdr Spectrum Test 1 03

 

Sdr Spectrum Test 1 04

 

Running Spectrum Analyzer with basic parameters

 

Go to /root/trx_sdr directory

Sdr Spectrum Test 1 05

Run sdr_spectrum program as follows. Notice that sdr1 is used and the center frequency is set to the tx frequency of sdr card to measure

         ./sdr_spectrum -args "dev0=/dev/sdr/sdr1" -rx_freq 2680e6

Sdr Spectrum Test 1 06

 

Sdr Spectrum Test 1 07

Change rx gain by Up/Down keys from previous screen to get this waveform

Sdr Spectrum Test 1 08

Press 'o' key (show sample power) on previous screen to switch to 'power vs time' mode as below

Sdr Spectrum Test 1 09

Press '+/-' key (change time scale) on previous screen to change time scale

Sdr Spectrum Test 1 10

If you are using the Callbox or UEsim later than the release 2022-02-23, you can get the waterfall plot as shown below. You can get the waterfall plot by pressing 'w' key. +/- keys for color change by shifting the power offset and 'Ctrl and +/-' keys for color contrast change. Use Left/Right arrow key to shift the plot on horizontal axis. Press 'n' key to capture only one radio plot and pause (i.e, capture the snapshot of one radio frame).

Sdr Spectrum Test 1 10 1

 

 

Running Spectrum Analyzer with more parameters

 

Run sdr_spectrum program with more parameters as follows. Notice that sdr1 is used and the center frequency is set to the tx frequency of sdr card to measure

Sdr Spectrum Test 1 11

 

Sdr Spectrum Test 1 12

Change rx gain by Up/Down keys from previous screen to get this waveform

Sdr Spectrum Test 1 13

Press 'o' key (show sample power) on previous screen to switch to 'power vs time' mode as below

Sdr Spectrum Test 1 14

Press '+/-' key (change time scale) on previous screen to change time scale

Sdr Spectrum Test 1 15

If you are using the Callbox or UEsim later than the release 2022-02-23, you can get the waterfall plot as shown below. You can get the waterfall plot by pressing 'w' key. +/- keys for color change by shifting the power offset and 'Ctrl and +/-' keys for color contrast change. Use Left/Right arrow key to shift the plot on horizontal axis. Press 'n' key to capture only one radio plot and pause (i.e, capture the snapshot of one radio frame).

Sdr Spectrum Test 1 15 1

 

 

Test 2 : LTE on sdr 0 with different frequencies and Spectrum on sdr 1

 

Configuration

 

You may use any configuration. In this tutorial, I used the configuration for basic LTE attach as shown here and just change frequency. In this test, I am measuring the spectrum for an LTE cell without any UE connected. It means the cell is just transmitting PSS/SSS/PBCH and SIB messages and there is no user traffic going on in this test.

 

LTE Band 1 at 2140.0 Mhz

NOTE : The two channels shown on the left side is from the live network. It is captured here since I am using antenna for the test.

Sdr Spectrum Test 2 Freq Band1 01

Sdr Spectrum Test 2 Freq Band1 02

 

 

LTE Band 2 at 1960.0 Mhz

 

Sdr Spectrum Test 2 Freq Band2 01

Sdr Spectrum Test 2 Freq Band2 02

 

 

LTE Band 3 at 1842.0 Mhz

 

Sdr Spectrum Test 2 Freq Band3 01

Sdr Spectrum Test 2 Freq Band3 02

 

 

LTE Band 4 at 2130.0 Mhz

 

Sdr Spectrum Test 2 Freq Band4 01

Sdr Spectrum Test 2 Freq Band4 02

 

 

LTE Band 5 at 881.5 Mhz

 

Sdr Spectrum Test 2 Freq Band5 01

Sdr Spectrum Test 2 Freq Band5 02

 

 

LTE Band 7 at 2680.0 Mhz

 

Sdr Spectrum Test 2 Freq Band7 01

Sdr Spectrum Test 2 Freq Band7 02

 

 

LTE Band 20 at 806.0 Mhz

 

Sdr Spectrum Test 2 Freq Band20 01

Sdr Spectrum Test 2 Freq Band20 02

 

 

LTE Band 71 at 634.4 Mhz

 

Sdr Spectrum Test 2 Freq Band71 01

Sdr Spectrum Test 2 Freq Band71 02

 

 

LTE Band 72 at 463.4 Mhz

 

Sdr Spectrum Test 2 Freq Band72 01

Sdr Spectrum Test 2 Freq Band72 02

 

 

Test 3 : LTE on sdr 0 (and 1) with different bandwidth and Spectrum on a remaining sdr

 

Configuration

 

You may use any configuration. In this tutorial, I used the configuration for basic LTE attach as shown here and just change channel bandwidth except the last case (the last case in this test is based on gnb-2cell-ho.cfg). In this test, I am measuring the spectrum for an LTE cell without any UE connected. It means the cell is just transmitting PSS/SSS/PBCH and SIB messages and there is no user traffic going on in this test.

 

LTE with BW 1.4 Mhz in Band 7

 

Sdr Spectrum Test 3 BW 1 4 01

Sdr Spectrum Test 3 BW 1 4 02

 

 

LTE with BW 3 Mhz in Band 7

 

Sdr Spectrum Test 3 BW 3 01

Sdr Spectrum Test 3 BW 3 02

 

 

LTE with BW 5 Mhz in Band 7

 

Sdr Spectrum Test 3 BW 5 01

Sdr Spectrum Test 3 BW 5 02

 

 

LTE with BW 10 Mhz in Band 7

 

Sdr Spectrum Test 3 BW 10 01

Sdr Spectrum Test 3 BW 10 02

 

 

LTE with BW 15 Mhz in Band 7

 

Sdr Spectrum Test 3 BW 15 01

Sdr Spectrum Test 3 BW 15 02

 

 

LTE with BW 20 Mhz in Band 7

 

Sdr Spectrum Test 3 BW 20 01

Sdr Spectrum Test 3 BW 20 02

 

 

LTE with 2 x BW 20 Mhz in Band 7

This configuration is based on gnb-sa-ho.cfg with frequency and bandwidth changes as follows.

Sdr Spectrum Test 3 BW 40 01

Sdr Spectrum Test 3 BW 40 02

 

 

Test 4 : sdr_test-generated OFDM signal on sdr 0 and sdr_spectrum on sdr 1

 

Configuration

 

In this test, I am not using Callbox software. I am using a generic OFDM signal generated by the tool called 'sdr_test' transmitted by sdr 0 and run sdr_spectrum on sdr 1.  To get more accurate spectrum, I used RF cable connection between sdr 0 and sdr 1 for this test as shown in Test Setup B.

The two commands that I used in this test are as follows :

     ./sdr_test -c <sdr_no> rfic_tx_test <sample rate> <frequency> <tx_gain> ofdm <bw>     <== OFDM signal generation

     ./sdr_spectrum -args "dev0=/dev/sdr1", -rx_freq <frequency>  <== spectrum plot

 

OFDM BW 5 Mhz at Center Frequency = 500 Mhz

Test 4 BW5 Freq500 01

Test 4 BW5 Freq500 02

 

OFDM BW 5 Mhz at Center Frequency = 1000 Mhz

Test 4 BW5 Freq1000 01

Test 4 BW5 Freq1000 02

 

OFDM BW 5 Mhz at Center Frequency = 1500 Mhz

Test 4 BW5 Freq1500 01

Test 4 BW5 Freq1500 02

 

OFDM BW 5 Mhz at Center Frequency = 2000 Mhz

Test 4 BW5 Freq2000 01

Test 4 BW5 Freq2000 02

 

OFDM BW 5 Mhz at Center Frequency = 2500 Mhz

Test 4 BW5 Freq2500 01

Test 4 BW5 Freq2500 02

 

OFDM BW 5 Mhz at Center Frequency = 3000 Mhz

Test 4 BW5 Freq3000 01

Test 4 BW5 Freq3000 02

 

OFDM BW 5 Mhz at Center Frequency = 3500 Mhz

Test 4 BW5 Freq3500 01

Test 4 BW5 Freq3500 02

 

OFDM BW 5 Mhz at Center Frequency = 4000 Mhz

Test 4 BW5 Freq4000 01

Test 4 BW5 Freq4000 02

 

OFDM BW 5 Mhz at Center Frequency = 4500 Mhz

Test 4 BW5 Freq4500 01

Test 4 BW5 Freq4500 02

 

OFDM BW 5 Mhz at Center Frequency = 5000 Mhz

Test 4 BW5 Freq5000 01

Test 4 BW5 Freq5000 02

 

OFDM BW 5 Mhz at Center Frequency = 5500 Mhz

Test 4 BW5 Freq5500 01

Test 4 BW5 Freq5500 02

 

OFDM BW 5 Mhz at Center Frequency = 5990 Mhz

Test 4 BW5 Freq5990 01

Test 4 BW5 Freq5990 02

 

 

 

Test 5 : sdr_test-generated CW signal on sdr 0 and sdr_spectrum on sdr 1

 

Configuration

 

In this test, I am not using Callbox software. I am using a generic CW signal generated by the tool called 'sdr_test' transmitted by sdr 0 and run sdr_spectrum on sdr 1.  

The two commands that I used in this test are as follows :

     ./sdr_test -c <sdr_no> rfic_tx_test <sample rate> <frequency> <tx_gain> tone <tone_offset>     <== CW signal generation

     ./sdr_spectrum -args "dev0=/dev/sdr1" -rx_freq <frequency>  <== spectrum plot

NOTE : special comments for tone_offset parameter

NOTE : You can use your own spectrum analyzer instead of ./sdr_spectrum

 

 

CW at User Defined tone_offset

 

Sdr Spectrum Test 5 CW UserDefinedOffset 01

Sdr Spectrum Test 5 CW UserDefinedOffset 02

 

 

CW at default tone_offset

 

Sdr Spectrum Test 5 CW DefaultOffset 01

Sdr Spectrum Test 5 CW DefaultOffset 02

 

 

 

Enabling AGC / Finding Optimal Spectrum

 

Right after sdr_spectrum execution. rx_gain not optimized and you would notice high adjacent power.

Sdr Spectrum EnableAGC 01

After the application of AGC, sdr_spectrum automatically adjust rx_gain and optimum spectrum ( NOTE : press 'a' key to enable / disable AGC).

Sdr Spectrum EnableAGC 02

 

 

 

Power with Frequency Range

 

You should use the software release 2022-04-01 or later to use this feature.

Sdr Spectrum PowerInFrequencyRange 01

 

 

 

Time Domain Waterfall Plot

 

You can get the time domain waterfall plot by higging 't' key from other plots. You should use the software release 2022-04-01 or later to use this feature.

Sdr Spectrum TimeDomainWaterfall 01

 

 

Trigger Mode

sdir_spectrum support level trigger. As an application of the feature, you can detect PRACH using the trigger. This example shows the detected PRACH in LTE.

NOTE : It would be relatively easy to detect PRACH in this way in FDD, but it would be much tricky to detect PRACH in TDD because the spectrum would get both Uplink and Downlink through the input port and the trigger may gets ON by DL signal (e.g, MIB/SIB signals). It would be better to separate UL and DL signal using RF Circulator in TDD case and connect UL signal only to the spectrum input port.

Sdr Spectrum Trigger 01

Sdr Spectrum Trigger 02

Sdr Spectrum Trigger 03

Sdr Spectrum Trigger 04

Sdr Spectrum Trigger 05

 

 

 

Mixed Mode

 

From 2023-09-08 release, a special display mode called 'Mixed Mode' is supported. It shows both waterfall and the frequency waveform on the same display. You can switch back and forth between frequency spectrum and mixed mode by toggling 'x' key as shown below.

Sdr Spectrum MixedMode 01

Following is a full screen showing the mixed mode display.  By default, the 'frequency waveform (the upper plot)' corresponds to the frequency scan line at the top of the waterfall plot.

Sdr Spectrum MixedMode 02

You can scan (scroll) up and down along the waterfall plot in 'line mode'. You can get in and out of the line mode as shown below.  Once you get in the line mode, you can scroll up and down using the up/down arrow key.

Sdr Spectrum MixedMode 03

Following is an example of showing a waveform corresponding to a specific time indicated by 'red line' in waterfall.

Sdr Spectrum MixedMode 04

Here you see how it looks in Animation.  This example is from one radio frame of LTE radio frame with 5Mhz channel bandwidth. This was captured when eNB is running but no UE is connected. So you see CRS (Cell Reference Signal), PBCH/PSS/SSS and PDSCH for SIBs as it walk down along the radio frame. Since there is no UE connected and no user traffic PDSCH, you would see some empty symbols.

sdr spectrum MixedMode Animation 01.gif

 

 

Full Frequency Spectrum

you can plot the spectrum for the full frequency range that the sdr card support using -zoom option as shown below.

Sdr Spectrum FullFrequencySpectrum 08

Sdr Spectrum FullFrequencySpectrum 09

 

 

 

Channel Scan

You can scan and detect all the active channel within a specified band as shown below.

NOTE : This feature is verified only for sdr50. It would take unreasonably long time or may not work properly with sdr100

NOTE : This feature may not work properly in latest release. In this case, try out ltescan tool.

Sdr Spectrum FullFrequencySpectrum 01

Sdr Spectrum FullFrequencySpectrum 02

After the scan is completed, sdr_spectrum prints out all the detected channels in text.

Sdr Spectrum FullFrequencySpectrum 03

You can save the result of the scan into a file by running with a redirection to file as shown below.

Sdr Spectrum FullFrequencySpectrum 04

When the Channel scan is done, the result is saved in the specified file as shown below.

Sdr Spectrum FullFrequencySpectrum 05

 

You can specify the range of the scan in frequency rather than band using the options -scan_start and -scan_end as shown below.

Sdr Spectrum FullFrequencySpectrum 06

Sdr Spectrum FullFrequencySpectrum 07

 

 

Saving I/Q Data into a file

 

You can save the IQ data into a binary file and you can analyze it with your own program (e.g, Matlab etc)

 

Saving I/Q with command

Save a file in command line as shown below

Sdr Spectrum SaveIQ 01

The command will popup the spectrum window first and collect / save the IQ data into the specified folder (/tmp in this case).

Sdr Spectrum SaveIQ 02

NOTE : The I/Q samples are saved as little endian 32 bit float values, in I/Q order. The sample values are between -1 and 1

 

Saving I/Q in Spectrum Plot

You can save I/Q directly from the spectrum plot usng 's' key as shown in the Keys menu in the plot.  A good way to capture the I/Q in a good quality are as follows.

Sdr Spectrum SaveIQ 03

 

 

Spectrum from a file

 

Assume that you have a binary file captured as shown below.

Sdr Spectrum From File 01

You can get the spectrum by following command. NOTE : in this case you don't have to specify any sdr card since this is not using any hardware

Sdr Spectrum From File 02

In the spectrum from file, you would notice there is only a few menu available. Most of other menus especially related to hardware (e.g, rx_gain, AGC etc) are not available

Sdr Spectrum From File 03

If you want to plot the file in 'time vs power' mode, you have to speficy it at the command line as shown below ('-t 1' indicates 'time vs power' mode)

Sdr Spectrum From File 04

Sdr Spectrum From File 05

If you are using the Callbox or UEsim later than the release 2022-02-23, you can get the waterfall plot as shown below. You can get the waterfall plot by pressing 'w' key. +/- keys for color change by shifting the power offset and 'Ctrl and +/-' keys for color contrast change. Use Left/Right arrow key to shift the plot on horizontal axis. Press 'n' key to capture only one radio plot and pause (i.e, capture the snapshot of one radio frame).

Sdr Spectrum From File 06

 

 

Signal Generation from a file

You can play the binary file (IQ file) in the hardware (i.e, generating physical signal from sdr card) using a program called sdr_play as shown below.

This command plays the file only once and quit the program

Sdr Spectrum SignalGeneration From File 01

This command (with -loop option) continuously playing the file.

Sdr Spectrum SignalGeneration From File 02

And you can plot the spectrum using sdr_spectrum as shown below.

Sdr Spectrum SignalGeneration From File 03

Sdr Spectrum SignalGeneration From File 04