· Updated · · VORTARIAN · 16 min read

Spectrogram of the VORTARIAN SDR in GNU Octave

GNU Octave examples for the VORTARIAN 4R2T-10G: contiguous I/Q capture over 10 GbE and calibrated spectrograms of Wi-Fi and Bluetooth traffic at 2.45 GHz.

Spectrogram of RX A of the VORTARIAN SDR at 2.45 GHz: Wi-Fi traffic on channel 9 and a Bluetooth Low Energy advertising event

This article shows how to capture I/Q samples from the VORTARIAN 4R2T-10G in GNU Octave and draw a spectrogram calibrated in dBFS. The first example shows one receive channel, the second all four channels at once. Apart from the vortarian MEX file, the scripts use only core Octave, and they also run in MATLAB.

Signal path

Each of the four receive inputs is sampled directly at 500 MS/s; the standard build covers 250 to 500 MHz, the second Nyquist zone. The digital down-converter (DDC) in each dual-channel ADC mixes the samples with a complex NCO and decimates by 4, so each channel arrives as 16-bit complex I/Q at fs = 125 MS/s and covers fNCO ± 62.5 MHz. RX A and RX B share the NCO of ADC 1, RX C and RX D the NCO of ADC 2. The NCO frequency word has 48 bits, which gives a tuning step of 500 MHz / 248 ≈ 1.8 µHz.

An input tone at fin appears at fin − fNCO, without spectral inversion. Sampling folds the positive-frequency component of the tone to fin − 500 MHz, and the NCO, equivalent to fNCO − 500 MHz at the 500 MS/s rate, moves it to fin − fNCO. The negative-frequency component ends up outside the output band and the decimation filter removes it. The roll-off of this filter is visible at both edges of the span.

The captures in this article were taken with the VORTARIAN 4R2C-2G5, our angle-of-arrival (AoA) front end for the 2.4 GHz ISM band. It is a mezzanine mounted on the base board, with four phase-coherent receive paths that convert the band to the intermediate frequency (IF) of the board; with the settings used here, 2450 MHz falls on the NCO frequency of 375 MHz. Its instantaneous bandwidth of more than 100 MHz covers the whole band from 2400 to 2483.5 MHz in one capture. The scripts therefore also take the RF frequency that corresponds to the NCO frequency and draw an RF axis under the IF axis.

Capture over 10 GbE

The FPGA sends the samples of each ADC as UDP datagrams, with no processor in the data path: ADC 1 (RX A, RX B) on FO1 to UDP port 10700, ADC 2 (RX C, RX D) on FO2 to port 10701. A datagram carries a 32-byte header and 1024 samples of both channels as 16-bit I and Q, 8192 bytes of samples and 8.192 µs of signal; The VORTARIAN I/Q Datagram Header describes the header. At 122 070 datagrams per second each link carries about 8.1 Gb/s. The datagrams do not fit a standard Ethernet frame, so both host interfaces need jumbo frames (MTU 9000).

The host starts a capture with a request over the network. It opens both UDP sockets, sends debug on to the control port, TCP 5025, and collects datagrams until it holds N contiguous samples per channel on both links; then it sends debug off. The header numbers the datagrams and gives the board time of their first sample, so the receiver finds lost datagrams and knows which datagrams of the two links hold the same sampling instant; the board enables both senders with one register write. When a datagram is lost, the block restarts after the gap, and the returned block is always contiguous. The start is a software event, so its timing against the outside world varies by milliseconds; within the block, the samples of all four channels are spaced exactly 1/fs.

Scaling

The scripts normalize the samples to complex full scale, x = (I + jQ)/32768, and compute the FFT of consecutive blocks of NFFT samples weighted by a Hann window w[n]:

P_m[k] = 20·log10( |Σ_n w[n] · x[m·N_FFT + n] · exp(−j2π·k·n / N_FFT)| / Σ_n w[n] )   [dBFS]

With the division by Σw, a complex tone of amplitude A centred in a bin reads 20·log10(A) dBFS for any NFFT and any window, and a full-scale tone reads 0 dBFS. Noise behaves differently: each bin collects the noise within its equivalent noise bandwidth, ENBW = NFFT·Σw²/(Σw)², which is 1.5 bins for the Hann window. For white noise of total power σ²:

noise per bin = σ² · ENBW / N_FFT                       N_FFT = 1024: 28.3 dB below σ²
noise density = noise per bin / (ENBW · f_s / N_FFT)    N_FFT = 1024: 52.6 dB below the noise per bin

Each doubling of NFFT lowers the noise per bin by 3 dB, while tones stay where they are. The SoapyVortarian README gives a noise floor of about −113 dBFS per bin for a 65 536-point Hann FFT. That is −147.6 dBFS/Hz, or −95 dBFS per bin at NFFT = 1024, the floor seen in the captures below.

The FFT length sets the resolution in frequency and in time:

NFFTBin spacingLength of one spectrumSpectra in 221 samples
256488 kHz2.05 µs8192
1024122 kHz8.19 µs2048
409630.5 kHz32.8 µs512
163847.63 kHz131 µs128

The Hann window has its highest sidelobe at −31.5 dB and loses up to 1.42 dB for a tone halfway between two bins. Next to strong tones, where more than about 90 dB of dynamic range is needed, a 4-term Blackman–Harris window (sidelobes below −92 dB, ENBW 2.0 bins) is a better choice; the division by sum(w) keeps the calibration. Without overlap, the window gives little weight to the samples near the block edges, and a pulse much shorter than a block reads low when it falls on a boundary. With a hop of NFFT/2 the shifted Hann windows add up to a constant and every sample counts equally:

idx = (1:nfft)' + (0:2*M-2) * nfft/2;     % blocks overlapping by half
S = fftshift(fft(x(idx) .* w), 1) / sum(w);
t = (0:2*M-2) * nfft/2 / fs * 1e3;

Setup

The board is a VORTARIAN 4R2T-10G with FO1 and FO2 connected to a dual-port 10 GbE network card; the cards and modules we have tested are listed in Tested 10 GbE Network Cards, Switches and SFP+ Modules. The host runs 64-bit Linux and GNU Octave, with no additional Octave packages. We tested the scripts with Octave 8.4.

VORTARIAN 4R2T-10G with the 4R2C-2G5 front end on top, a 2.4 GHz patch antenna on a bracket above the boards and two fibre links on the left

The setup on our bench: the VORTARIAN 4R2T-10G with the 4R2C-2G5 AoA front end on top and a 2.4 GHz patch antenna on a bracket above it. The fibres on the left are the FO1 and FO2 links to the host, and the fan cools the open boards.

Host portAddressCarries
connected to FO1192.168.67.10/24RX A and RX B (UDP 10700), board control at 192.168.67.2
connected to FO2192.168.68.10/24RX C and RX D (UDP 10701)

Both links together carry 16.1 Gb/s over the PCIe bus of the network card. A dual-port card therefore needs PCIe 3.0 x4 or PCIe 2.0 x8, in a slot wired that wide; a PCIe 2.0 card in an x4 slot carries about 13 Gb/s and loses about 18 % of the datagrams when both links stream. /sys/class/net/<interface>/device/current_link_width shows the negotiated width.

Both interfaces need jumbo frames, the largest receive ring and no Ethernet pause frames: a pause frame from the host stops the stream of the board until the next debug on. The MEX file asks for a 256 MB receive buffer per socket, about a quarter of a second of data, so the system limit has to be raised:

sudo ip link set <FO1 interface> mtu 9000
sudo ip link set <FO2 interface> mtu 9000
sudo ethtool -G <FO1 interface> rx 8192        # the maximum of the card, see ethtool -g
sudo ethtool -G <FO2 interface> rx 8192
sudo ethtool -A <FO1 interface> autoneg off rx off tx off
sudo ethtool -A <FO2 interface> autoneg off rx off tx off
sudo sysctl -w net.core.rmem_max=268435456

The scripts control the board over TCP port 5025. The control daemon serves one client at a time, so close the board console while a script runs; otherwise the MEX file reports vortarian:busy.

The vortarian MEX file

The MEX file receives the datagrams on its own threads, aligns the two links by the datagram headers and returns an int16 matrix. Download vortarian.mex for Linux x86-64 from the releases of vortarian-sdr/vortarian-octave, put it in one folder with the example scripts and add the folder to the Octave path:

addpath('~/vortarian');
vortarian('version')
CallFunction
vortarian('config', 'host', '192.168.67.2')Sets the defaults for the following calls
txt = vortarian('cmd', 'adc 1 nco 375000000')Sends a command, or a cell array of commands, and returns the answer; an error answer raises vortarian:board
[iq, info] = vortarian('rx', N, 'on', 'debug on', 'off', 'debug off')Captures N contiguous samples per channel

iq has eight int16 columns: I and Q of RX A and RX B (port 10700), then of RX C and RX D (port 10701). With the option 'ports', 10700 it holds only the first four. info gives the number of datagrams lost before the block was complete. The block is kept in RAM together with 8192 spare datagrams (67 MB) per link. One second of all four channels is 1 GB of datagrams per link and 8 GB as complex double in Octave, so long records are better processed in parts.

Example 1: one channel

The captures in this example are from RX A (ch = 1). Without a front end, connect the antenna or signal source directly to the board input and keep the level below about −10 dBm.

% vortarian_spectrogram.m - spectrogram of one VORTARIAN receive channel

host  = '192.168.67.2';   % board address
ch    = 1;                % 1 = RX A, 2 = RX B, 3 = RX C, 4 = RX D
f_nco = 375e6;            % NCO frequency, centre of the IF axis [Hz]
f_rf  = 2450e6;           % RF frequency at the IF centre [Hz]
fs    = 125e6;            % sample rate [S/s]
N     = 2^21;             % samples, 16.8 ms
nfft  = 1024;             % FFT length, 122 kHz per bin

adc  = 1 + (ch > 2);            % RX A, B: ADC 1, UDP port 10700
port = 10700 + (ch > 2);        % RX C, D: ADC 2, UDP port 10701
col  = 2 * mod(ch - 1, 2) + 1;  % I column in iq, Q is the next one

vortarian('config', 'host', host);
vortarian('cmd', 'init');                       % needed after power-up
vortarian('cmd', sprintf('adc %d nco %.0f', adc, f_nco));
iq = vortarian('rx', N, 'ports', port, 'on', 'debug on', 'off', 'debug off');
x  = complex(double(iq(:, col)), double(iq(:, col + 1))) / 32768;

M = floor(N / nfft);                            % number of spectra
w = 0.5 - 0.5 * cos(2*pi*(0:nfft-1)' / nfft);   % Hann window
S = fftshift(fft(reshape(x(1:M*nfft), nfft, M) .* w), 1) / sum(w);
P = 20 * log10(abs(S) + 1e-12);                 % dBFS

f_if = (f_nco + (-nfft/2:nfft/2-1) * fs / nfft) / 1e6;   % [MHz]
t    = (0:M-1) * nfft / fs * 1e3;                        % [ms]

figure('Color', 'w', 'Position', [100 100 1200 800]);
ax = axes;
imagesc(f_if, t, P.');  axis xy;
caxis([median(P(:)) - 10, max(P(:))]);
set(ax, 'FontSize', 14, 'TickDir', 'out', 'YTick', 0:t(end), ...
        'XTick', 10 * ceil(f_if(1) / 10) : 10 : f_if(end));
xlabel('IF [MHz]');  ylabel('Time [ms]');
title(sprintf('RX %c: RF %.1f MHz at IF %.1f MHz, %d spectra of %d samples', ...
              'A' + ch - 1, f_rf / 1e6, f_nco / 1e6, M, nfft), 'FontSize', 16);
cb = colorbar;  ylabel(cb, 'dBFS');
set(ax, 'Position', [0.07 0.21 0.82 0.71]);
set(cb, 'Position', [0.91 0.21 0.015 0.71], 'FontSize', 14);

% RF axis below the IF axis
rf = get(ax, 'XLim') + (f_rf - f_nco) / 1e6;
axes('Position', [0.07 0.11 0.82 0.001], 'Color', 'none', 'YTick', [], 'FontSize', 14, ...
     'TickDir', 'out', 'XLim', rf, 'XTick', 10 * ceil(rf(1) / 10) : 10 : rf(2));
xlabel('RF [MHz]');

ch selects the channel. RX A and RX B come from ADC 1 over FO1, RX C and RX D from ADC 2 over FO2. With one port open, iq has four columns: I and Q of the first channel of the pair, then of the second. The init command sets up the clocks, converters and synchronization; it is needed once after power-up. The colour scale runs from 10 dB below the median, close to the noise floor, up to the strongest signal; to compare several captures, fix it, for example with caxis([-105 -60]). The RF axis is the IF axis shifted by f_rf − f_nco, which holds for a front end that does not invert the spectrum. The labels in the figures were added for this article; the script draws the same figures without them.

Spectrogram of RX A from 2388 to 2512 MHz over 16.8 ms: one Bluetooth Low Energy advertising packet each on 2402, 2426 and 2480 MHz between 11.1 and 13.0 ms, and bursts at 2450.0 and 2466.6 MHz repeating every 0.51 ms

A Bluetooth Low Energy advertising event and a proprietary link. Between 11.06 and 12.95 ms a BLE device sends one advertising packet on each of the three advertising channels, 2402, 2426 and 2480 MHz, starting 0.78 and 0.76 ms apart, at −50, −46 and −41 dBFS. Each packet lasts 360 µs, close to the 376 µs of a legacy advertising packet with the full 31 bytes of data at 1 Mbit/s. The dotted line at 2450.0 MHz is a 2.4 GHz link that sends a 104 µs burst every 509.4 µs at −58 dBFS, and a weaker burst at 2466.6 MHz about 0.35 ms after it. Right after each burst at 2450.0 MHz a signal sweeps upwards by about 35 MHz in about 30 µs. One spectrum covers 8.19 µs and catches only part of such a sweep, so the sweeps appear as short horizontal lines, and because 509.4 µs is not a multiple of 8.19 µs, they form slanted ladders. The two continuous lines at 2400.0 and 2500.0 MHz are carriers at −63 and −61 dBFS; they are also present, 21 to 26 dB weaker, on the inputs without an antenna.

Spectrogram of RX A with a strong Wi-Fi transmission on channel 9 from 7.1 to 12.0 ms, a raised noise floor across the whole span during it, and a Bluetooth Low Energy advertising event between 2.3 and 4.9 ms

A strong Wi-Fi station on channel 9 (2452 MHz). From 7.07 to 11.97 ms it sends two transmissions of 2.43 and 2.45 ms with a 19 µs gap, at −36.5 dBFS per bin; the dark line in the middle is the unused DC subcarrier at 2452.0 MHz. While it transmits, the floor across the whole 125 MHz span rises by 8 dB on RX A and by 2.5 dB on RX B, where the signal is only 1.6 dB weaker; we have not separated the out-of-band emission of the transmitter from distortion in the receive path. Before it, a BLE device advertises on 2402 MHz at 2.30 and 3.12 ms (−67 dBFS), then on 2426 MHz and at 4.54 ms on 2480 MHz (−64 dBFS). The colour scale ends at the strongest signal, 15 dB higher than in the first figure, so the weaker signals look darker here.

Example 2: four channels

The second script opens both links and draws all four channels in one figure with a common colour scale. Both ADCs get the same NCO, so the panels share the frequency axis, and because the links are aligned by the datagram headers, row k of iq is the same sampling instant in all four channels. To see one signal on all four inputs, feed it through a 1:4 power splitter.

% vortarian_spectrogram_4ch.m - spectrograms of all four VORTARIAN receive channels

host  = '192.168.67.2';   % board address
f_nco = 375e6;            % NCO frequency of both ADCs, centre of the IF axis [Hz]
f_rf  = 2450e6;           % RF frequency at the IF centre [Hz]
fs    = 125e6;            % sample rate [S/s]
N     = 2^21;             % samples per channel, 16.8 ms
nfft  = 1024;             % FFT length, 122 kHz per bin

vortarian('config', 'host', host);
vortarian('cmd', 'init');                       % needed after power-up
vortarian('cmd', {sprintf('adc 1 nco %.0f', f_nco), sprintf('adc 2 nco %.0f', f_nco)});
iq = vortarian('rx', N, 'on', 'debug on', 'off', 'debug off');          % both links
x  = complex(double(iq(:, 1:2:end)), double(iq(:, 2:2:end))) / 32768;  % RX A to RX D

M = floor(N / nfft);
w = 0.5 - 0.5 * cos(2*pi*(0:nfft-1)' / nfft);
P = zeros(nfft, M, 4);
for c = 1:4
    S = fftshift(fft(reshape(x(1:M*nfft, c), nfft, M) .* w), 1) / sum(w);
    P(:, :, c) = 20 * log10(abs(S) + 1e-12);
end
f_if = (f_nco + (-nfft/2:nfft/2-1) * fs / nfft) / 1e6;
t    = (0:M-1) * nfft / fs * 1e3;
lim  = [median(P(:)) - 10, max(P(:))];          % one colour scale for all channels

figure('Color', 'w', 'Position', [100 100 1400 1100]);
for c = 1:4
    pos = [0.07 + 0.43 * mod(c - 1, 2), 0.58 - 0.455 * floor((c - 1) / 2), 0.37, 0.29];
    ax = axes('Position', pos);
    imagesc(f_if, t, P(:, :, c).');  axis xy;  caxis(lim);
    set(ax, 'FontSize', 12, 'TickDir', 'out', 'YTick', 0:2:t(end), ...
            'XTick', 20 * ceil(f_if(1) / 20) : 20 : f_if(end));
    xlabel('IF [MHz]');  ylabel('Time [ms]');
    title(sprintf('RX %c', 'A' + c - 1), 'FontSize', 14);

    rf = get(ax, 'XLim') + (f_rf - f_nco) / 1e6;    % RF axis below the IF axis
    axes('Position', [pos(1), pos(2) - 0.07, pos(3), 0.001], 'Color', 'none', ...
         'YTick', [], 'FontSize', 12, 'TickDir', 'out', ...
         'XLim', rf, 'XTick', 20 * ceil(rf(1) / 20) : 20 : rf(2));
    xlabel('RF [MHz]');
end

annotation('textbox', [0 0.92 1 0.05], 'EdgeColor', 'none', 'FitBoxToText', 'off', ...
           'HorizontalAlignment', 'center', 'FontSize', 16, 'FontWeight', 'bold', ...
           'String', sprintf('RF %.1f MHz at IF %.1f MHz, %d spectra of %d samples', ...
                             f_rf / 1e6, f_nco / 1e6, M, nfft));
cb = colorbar(ax);  ylabel(cb, 'dBFS');
set(ax, 'Position', pos);
set(cb, 'Position', [0.89 0.125 0.012 0.745], 'FontSize', 12);

Spectrograms of RX A to RX D around 2450 MHz over 16.8 ms with antennas on RX A and RX B: both show a Bluetooth Low Energy advertising event, the bursts at 2450.0 and 2466.6 MHz and a Wi-Fi frame on channel 1, RX C and RX D only a weak copy of the bursts

Antennas on RX A and RX B, none on RX C and RX D. The two live channels show the same signals, at levels set by the gain and position of each antenna: a BLE advertising event on 2402, 2426 and 2480 MHz, the link from Example 1 with its bursts at 2450.0 MHz at −59 and −49 dBFS, and from 14.7 to 15.8 ms a frame on Wi-Fi channel 1 (2412 MHz), 10 and 5 dB above the floor. The BLE packet on 2402 MHz starts at 7.029 ms on both channels. RX C and RX D, which have no antenna, show only the bursts at 2450.0 MHz, at −76 and −79 dBFS, and the carriers at 2400.0 and 2500.0 MHz.

All four channels are clocked from the same clock tree, and init aligns both ADCs and the FPGA with a common SYSREF pulse. The phase differences between the channels therefore stay constant during a capture. Angle-of-arrival measurement with the 4R2C-2G5 and beamforming rely on this; these examples only draw the spectrograms.

The board connectors are described in VORTARIAN 4R2T-10G Board Ports, and the full specification is in the VORTARIAN 4R2T-10G datasheet. For questions about the platform or a custom configuration, contact us.

Written by

· Lead RF/FPGA engineer at JSE

Jiří has designed RF and signal-processing hardware and FPGA firmware since 2003, starting with receivers and signal-processing boards for radar systems. He holds a master's degree in radio engineering from the Czech Technical University in Prague.

LinkedInGitHubAbout JSE

Share:
Back to Blog