Skip to content

Configuring SoapySDR devices

Tomasz Lemiech edited this page Oct 18, 2021 · 9 revisions

In order to be usable in RTLSDR-Airband, the SoapySDR device must support at least one of the following sample formats:

  • CU8 (complex unsigned 8-bit)
  • CS8 (complex signed 8-bit)
  • CS16 (complex signed 16-bit)

RTLSDR-Airband chooses the appropriate format automatically, preferring the native format (to avoid costly reconversion) and then 8-bit formats (for lower CPU usage).

Syntax

Configuration of any device supported by SoapySDR looks as follows. Settings which are commented out with # are optional and their default values are shown.

devices:
({
  type = "soapysdr";
  device_string = "driver=airspy,device_id=0";
# channel = 0;
  gain = 25.0;
# gain = "LNA=15,MIX=15,VGA=5";
# correction = 0.0;
# antenna = "";
# mode = "multichannel";
# sample_rate = 2.56;
  centerfreq = 120.0;
  channels: ( ... );
});

Explanation of keywords

  • type (string, required) - indicates the device type (Note: this should always be equal to "soapysdr", regardless of the actual type and model of the hardware).

  • device_string (string) - a string consisting of comma-separated variable=value stanzas. It sets the driver to be used and all necessary parameters required to identify and use the device. RTLSDR-Airband does not care what you put in here - if SoapySDR library is able to make any sense out of it, then it should work. Use the SoapySDRUtil program to find out your devices and all parameters which can be put into device_string. Or scroll down below for some examples.

  • channel (integer, optional) - identifies the physical channel on the device which is to be used for reception. Most devices only support channel number 0, which is the default.

  • gain (required) - the gain value to be set on the device. This setting comes in two variants (both shown in the above example):

    • gain = 25.0 - just do whatever is necessary to set the device gain to the given value. Many SDR devices have individual components with separate gain knobs. If this is the case, SoapySDR will attempt to distribute the given gain value across available gain components automatically.
    • gain = "LNA=15,MIX=15,VGA=5" - configures gain for each component separately. This gives better control and might be very handy in case when automation does not perform well enough. To find out all gain components of your device and supported value ranges, use SoapySDRUtil --probe="driver=<driver_name>" command.
  • correction (float, optional) - use this if your device has a non-zero frequency tuning error, which requires correcting. Put correction value in ppm here. If the device tunes too high, this value shall be positive and negative otherwise. Default is 0.0.

  • antenna (string, optional) - if the device has several antenna ports, you can select the desired one with this setting.

  • mode (string, optional) - takes one of two values: "multichannel" or "scan". The default is "multichannel".

  • sample_rate (frequency, optional) - the sampling rate to be configured on the device. This is equal to the bandwidth which the device working in multichannel mode will cover. If this setting is absent, RTLSDR-Airband checks for sample rates supported by the device and chooses the closest value to 2.56 Msps.

  • centerfreq (frequency, required in multichannel mode) - the center frequency which the dongle shall be tuned to. Required in multichannel mode, ignored in scan mode.

Note: RTLSDR-Airband does not check if configured values are actually supported by the hardware, assuming that you know what you are doing. This applies to the channel number, gain, correction, centerfreq and sample rate. For example, if the configured sample rate is not supported, either the device initialization will fail or the device will run at a different sample rate than the program thinks it does, which will result in strange problems (wrong audio speed at best). This is intentional - for example, Airspy Mini unofficially supports sampling rate of 10 Msps. This rate is not reported by the driver, but it can be set and used. Had RTLSDR-Airband returned an error because of an unsupported sampling rate, using the sampling rate of 10 Msps would not be possible.

The correct way is to probe the device using SoapySDRUtil and pick correct values from its output.

Device string examples

Here is how to use RTLSDR dongle via SoapySDR library with SoapyRTLSDR plugin:

device_string = "driver=rtlsdr,rtl=0";

Same thing, but identifying the device with its serial number:

device_string = "driver=rtlsdr,serial=00000349";

Using non-default number of RTLSDR buffers:

device_string = "driver=rtlsdr,serial=00000349,buffers=10";

Using SDRPlay RSP1 identified by serial number, with RF Gain Select knob set to 3:

device_string = "driver=sdrplay,hardware=46493836302,rfgain_sel=3";

Using Airspy:

device_string = "driver=airspy,device_id=0";

Using RTLSDR dongle connected to another machine (needs SoapyRemote installed and running):

device_string = "remote=10.0.0.5,driver=remote,remote:timeout=100000,remote:driver=rtlsdr,rtl=0";
Clone this wiki locally