Documentation chapters

How-to

GNU Octave

In GNU Octave the vortarian MEX file receives both links on its own threads, aligns them by the datagram headers and returns a contiguous block of all four channels as an int16 matrix.

Requirements

ItemValue
HostLinux x86-64 (the MEX file uses recvmmsg)
GNU Octavetested with 8.4; no additional packages
Binaryvortarian.mex: vortarian-octave releases
Example scriptshost-tools
Host settingsHost setup

Put the MEX file in one folder with the scripts and add the folder to the path:

addpath('~/vortarian');
vortarian('version')

Calls

CallFunction
vortarian('version')Version of the MEX file.
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. Commands: Board control.
[iq, info] = vortarian('rx', N)Captures N contiguous samples per channel from the running streams.
[iq, info] = vortarian('rx', N, ...)The same with the options below.
Option of 'rx'Meaning
'on', 'debug on'Command sent before the capture: starts the streams.
'off', 'debug off'Command sent after the capture: stops the streams.
'ports', 10700One link only: iq has four columns.
'margin', MDatagrams kept per link while waiting for the other link; default 8192 (67 MB per link).

Returned data

Column of iqContent
1, 2I, Q of RX A
3, 4I, Q of RX B
5, 6I, Q of RX C
7, 8I, Q of RX D
  • int16; full scale 32768.
  • Row k is the same sampling instant in all four channels.
  • The block is always contiguous. When a datagram is lost, the block restarts after the gap.
  • info reports the datagrams lost before the block was complete.

Conversion to complex samples of all four channels:

x = complex(double(iq(:, 1:2:end)), double(iq(:, 2:2:end))) / 32768;

Memory

QuantitySize
1 s of all four channels, as datagrams1 GB per link
1 s of all four channels, complex double8 GB
Socket buffer requested per link256 MB

Process long records in parts.

Timing

  • The capture start is a software event: its timing against the outside world varies by milliseconds.
  • Within a block, the samples are spaced exactly 1/fs = 8 ns.
  • Each vortarian('rx', N) call opens the sockets, takes the next N contiguous samples and closes the sockets; the datagrams between two calls are not received.
  • When the sockets open, one link can start about 1 ms after the other. With repeated calls on running streams use 'margin', 1024.
  • A call for 262 144 samples (2.1 ms) takes about 10 to 15 ms on the test host.

Minimal capture

vortarian('config', 'host', '192.168.67.2');
vortarian('cmd', 'init');                        % once after power-up
vortarian('cmd', {'adc 1 nco 375000000', 'adc 2 nco 375000000'});
iq = vortarian('rx', 2^21, 'on', 'debug on', 'off', 'debug off');
x  = complex(double(iq(:, 1:2:end)), double(iq(:, 2:2:end))) / 32768;

Example scripts

ScriptFunction
vortarian_spectrogram.mSpectrogram of one channel: 221 samples (16.8 ms), 1024-point Hann FFT, dBFS, IF and RF axes.
vortarian_spectrogram_4ch.mSpectrograms of all four channels from one capture, common colour scale.
optimize_eth_config.shHost interface settings.

The same scripts run in MATLAB unchanged; only the default colour map differs. Scaling of the spectra: Spectrum scaling.

Spectrograms of RX A to RX D around 2450 MHz over 16.8 ms: Wi-Fi frames of several transmitters and a pulsed carrier on RX A and RX B

vortarian_spectrogram_4ch.m with the 4R2C-2G5 front-end (2450 MHz at IF 375 MHz), RF gain 20 dB, antennas on RX A and RX B, none on RX C and RX D. Wi-Fi frames of several transmitters between 2400 and 2470 MHz, with different levels on the two antennas; a pulsed carrier at 2450.5 MHz, one pulse about every 510 µs, with the frequency sweep of its switch-off as dashes up to 2485 MHz. The colour scale runs from 10 dB below the median to the maximum of the capture, here −104.6 to −45.9 dBFS.

Signal in the time domain

A narrow-band signal is taken out of the capture by mixing it to 0 Hz, filtering and decimating. With x from the minimal capture (NCO 375 MHz at RF 2450 MHz), the Bluetooth Low Energy advertising channel on 2402 MHz of RX A:

fs = 125e6;  D = 5;
n  = (0:size(x, 1) - 1)';
y  = x(:, 1) .* exp(-2i * pi * (2402e6 - 2450e6) / fs * n);     % 2402 MHz to 0 Hz
h  = conv(ones(50, 1), ones(50, 1));                            % low-pass, about 2 MHz wide
y  = filter(h / sum(h), 1, y);  y = y(1:D:end);                 % 25 MS/s
level = 20 * log10(abs(y) + 1e-9);                              % envelope [dBFS]
f  = angle(y(2:end) .* conj(y(1:end-1))) * (fs / D) / (2 * pi); % instantaneous frequency [Hz]

The filter is two moving averages of 50 samples in series; it needs no toolbox or package.

Envelope, I and Q, and instantaneous frequency of a Bluetooth Low Energy advertising packet received on RX A, drawn in GNU Octave, with the decoded preamble and access address bits

One advertising packet, antenna on RX A, RF gain 20 dB, drawn in GNU Octave. Top: envelope, −29.3 dBFS; the transmitter is on for about 400 µs. Middle: I and Q of the first 44 µs. Bottom: instantaneous frequency, GFSK at 1 Mbit/s with about ±230 kHz deviation; the 8 preamble bits and the 32 bits of the advertising access address 0x8E89BED6 can be read directly. The bit labels were added for the figure.

A detail of a pulsed signal, with a zoomed spectrogram: Python.

Error messages

MessageCause
vortarian:busyAnother client holds the control port: board console, a second Octave session, GNU Radio.
vortarian:boardThe board answered with an error, for example “Board initialization has not been run”: init has not run since power-up.
vortarian:nodata, timeoutNo datagrams arrive: links, host addresses, firewall for UDP 10700 and 10701.
no ... contiguous packets present in all streamsDatagrams lost on the host: MTU, ring size, pause frames, net.core.rmem_max; or raise 'margin'.