Amarisoft

IQ Capture

 

There are roughly two different way of capturing IQ data. One is to capture IQ using sdr_spectrum and another way is to capture the IQ from callbox/UEsim software using Remote API.  For capturing IQ with sdr_spectrum, refer to this tutorial. In this tutorial, I will demonstrate on how to capture IQ from callbox software.

Why do we want to capture IQ ?  There can be various answers, but the common typical answer would be :  (Of course, you may have your own purpose that are not listed here. )

The data format of IQ capture file in Amarisoft product is very simple. It is the repetition of 32 bit - I value and 32 bit Q value and it does not have any other information (e.g, file header or meta data) at the beginning of the file (NOTE : check out here if you want further details). so you may easily read the saved IQ file and process it with your own program.

 

 

Table of Contents

 

 

Test Setup

 

TestSetup Callbox UE 1sdr 01

 

 

Configuration

 

I would not suggest any specific configuration here. You can use any configuration that fits your demand. enb.default.cfg or gnb-sa.cfg can be a good start.

 

 

Test 1 : Capturing IQ with Remote API

Run LTE service and check some basic information as shown below. It is not mandatory to check all these information but it is worth knowing sample rate and center frequency at least.

IQ signal capture and analysis results related to IQ Capture Test 1 Run 01

IQ signal capture and analysis results related to IQ Capture Test 1 Run 02

Put the communication into a status that you want. If you just capture idle mode downlink signal, you don't need to connect any UE. If you want to capture signal in connected mode, power on UE and wait until it gets into connected mode

IQ signal capture and analysis results related to IQ Capture Test 1 Run 03

 

Once the call is in the status that you like, collect IQ using Remote API as shown below. (If you are not familiar with RemoteAPI basics, refer to this tutorial).

# ws.js enb '{"message":"trx_iq_dump", "duration":<value in ms> , "rx_filename":<file name>, "tx_filename":<file name>}'

IQ signal capture and analysis results related to IQ Capture Test 1 Run 04

NOTE : This dumps the IQ samples directly extracted out of the RF, i.e baseband IQ samples in time domain.

 

Confirm that the IQ has been captured as you specified.

IQ signal capture and analysis results related to IQ Capture Test 1 Run 05

 

NOTE : You can capture the multiple channel (e.g, MIMO) as follows.

# ws.js enb '{"message":"trx_iq_dump", "rx_channels":<array>, "tx_channels":<array>, "duration":<value in ms> , "rx_filename":<file name%d>, "tx_filename":<file name%d>}'

 

 

Plotting Spectrum with sdr_spectrum

 

Once you have I/Q files captured, you may want to use your own software (e.g, Matlab) if you want to process it in your own way, but you can use sdr_spectrum program in the installation package for basic spectrum analysis. (If you are not familiar with sdr_spectrum basics, refer to this tutorial)

 

You can plot spectrum with sdr_spectrum with the syntax as below :

sdr_spectrum -iq <filename> -rx_freq <frequency> -rate <sample_rate>

IQ signal capture and analysis results related to IQ Capture SdrSpectrum 01

IQ signal capture and analysis results related to IQ Capture SdrSpectrum 02

IQ signal capture and analysis results related to IQ Capture SdrSpectrum 03

 

 

Plotting Spectrum with Octave/Matlab

 

You can post process the captured IQ data as you like. Following is an example Octave code just to show you on the file format  and how to read the captured I/Q.

    % By following routine, the whole data are read and stored in the variable 'data'. I ran this on Windows PC and tx.bin file is located in C:\temp folder.

    fid = fopen('C:\\temp\\tx.bin','r');

    [data,count] = fread(fid, 'single');

    fclose(fid);

     

    % I want to display the data in frequency domain, but I will slice out only a small portions of the data

    % since the total number of data is too big.

    ChunkStart = 1;

    ChunkLength = 1024*2*10;

    DataChunk = data(ChunkStart:ChunkStart+ChunkLength-1);

     

    % Now I will separate I value and Q value and save them into separate variable.

    DataChunkI = DataChunk(1:2:length(DataChunk));

    DataChunkQ = DataChunk(2:2:length(DataChunk));

     

    % I will combine the I data and Q data into an array of Complex Number

    DataChunkComplex = DataChunkI + (DataChunkQ .* j);

     

    % Do FFT and plot it in dB scale.

    DataChunkFFT = fftshift(fft(DataChunkComplex));

    DataChunkFftdB = 20*log(abs(DataChunkFFT));

     

    % Plot the data in frequency and time domain

    subplot(1,2,1);

    plot(DataChunkFftdB);xlim([1, length(DataChunkFftdB)]);

    subplot(1,2,2);

    plot(abs(DataChunkComplex));

    xlim([0 length(DataChunkComplex)]);

 

This is a result of the sample code. (NOTE : The IQ data shown below is the LTE DL signal without any UE connected. So the signal in time domain looks bursty).

IQ signal capture and analysis results related to IQ Capture Octave 01

 

 

 

Tips

 

Changing Sampling Rate

 

If the Sampling Rate for the captured data is not what you wanted, you can resample the data from the captured IQ using your own software or you can change the sampling rate in configuration file as shown in the following example. This example is the configuration that I set in LTE configuration.

You can specify the sample rate in the configuration file as shown below.

IQ signal capture and analysis results related to IQ Capture Tips SampleRate 01

You can confirm the changed sample rate in (enb) screen as shown below.

IQ signal capture and analysis results related to IQ Capture Tips SampleRate 02