Commit Graph

17 Commits

Author SHA1 Message Date
Oliver Jowett 7b1771cdad Fix limesdr build 2021-07-21 20:03:06 +08:00
Oliver Jowett 56625449e8
Adaptive gain, first pass (#134)
This PR adds basic adaptive gain support, which adjusts SDR gain on the fly based on the noise & signal levels seen.

There are two control mechanisms:

Dynamic range control is enabled by the --adaptive-range option. This adjusts SDR gain to try to achieve a minimum dynamic range, regardless of the exact hardware in the RF path.

Burst (loud message) control is enabled by the --adaptive-burst option. This decreases SDR gain when undecodable loud messages are heard, allowing for better reception of nearby aircraft at the expense of range.

This is only the basic implementation - see the PR for remaining work to do.
2021-06-29 20:11:13 +08:00
Oliver Jowett c3cd1ec0de limesdr: use --gain (in dB) if --limesdr-gain was not specified 2020-10-01 13:53:50 +08:00
Oliver Jowett d5d04060de Support older limesuite versions e.g. what's available on Raspbian Buster.
Unfortunately limesuite doesn't seem to provide an API identifier, so
we can't detect whether LMS_PATH_AUTO is supported or not. Change the
fallback to LMS_PATH_LNAW, since that appears to work on both mini
and full-fat limesdrs.
2020-08-05 19:50:38 +08:00
Oliver Jowett 74607b31ed Factor out FIFO handling; reimplement as a linked list, not a circular buffer.
Update all the SDR implementation to use it.

This was getting pretty ugly with code getting copy&pasted in all the SDR
implementations. Unify it all and give it a simpler API. Linked list works out
much simpler than the circular buffer. Also, simplify copying the overlap region
around by just using a separate buffer (it's only a few hundred bytes long, so
the double copy is not a big deal).
2020-08-05 19:50:38 +08:00
Oliver Jowett 8b21104d66 Factor out sdr thread CPU monitoring 2020-08-05 19:50:38 +08:00
Oliver Jowett 84c2d67601 limesdr: fix missing trailing \n 2020-08-03 18:05:32 +08:00
Oliver Jowett 9520740a12 limesdr: try to select an appropriate antenna based on the limesuite antenna metadata. 2020-08-03 18:02:27 +08:00
Oliver Jowett b70898cd27 Placate -Wmissing-declarations 2020-08-03 15:17:29 +08:00
Gluttton bb158d929c limesdr: add ability to set bandwidth
Add ability to set calibration bandwidth via input command line options.
By default the bandwidth is equal to 2.5 MHz.

Test: connect LimeSDR device, try to set different bandwidth and check
    logs:
    $ ./dump1090 --device-type limesdr --limesdr-bw 5000000
    $ ./dump1090 --device-type limesdr --limesdr-bw 500000

Signed-off-by: Gluttton <gluttton@ukr.net>
2020-07-31 00:18:22 +03:00
Gluttton 95ae1a92be limesdr: add ability to set LPF bandwidth
Add ability to set LPF bandwidth via input command line options.
By default the bandwidth is equal to the default sample rate 2.4 MHz.

Test: connect LimeSDR device, try to set different bandwidth and check
    logs:
    $ ./dump1090 --device-type limesdr --limesdr-lpfbw 2500000
    $ ./dump1090 --device-type limesdr --limesdr-lpfbw 500000

Signed-off-by: Gluttton <gluttton@ukr.net>
2020-07-31 00:18:22 +03:00
Gluttton c32ed2866e limesdr: add ability to set normalized gain
Add ability to set the combined normalized gain via command line
options. By default the gain is equal to 0.75.

Test: connect LimeSDR device, try to set different gain and check logs:
    $ ./dump1090 --device-type limesdr --limesdr-gain 0.01
    $ ./dump1090 --device-type limesdr --limesdr-gain 0.5
    $ ./dump1090 --device-type limesdr --limesdr-gain 0.99

Signed-off-by: Gluttton <gluttton@ukr.net>
2020-07-31 00:18:22 +03:00
Gluttton da1aeeeea6 limesdr: add ability to set RF oversampling ratio
Add ability to set RF oversampling ratio via command line options. By
default the default value is used.

Test: none.

Signed-off-by: Gluttton <gluttton@ukr.net>
2020-07-31 00:18:22 +03:00
Gluttton eb476d2e75 limesdr: add ability to select RX channel
Add ability to select an RX channel by number. By default channel 0 is
used.

Test: connect LimeSDR device and try to select the RX channel by number:
    OK: $ ./dump1090 --device-type limesdr --limesdr-channel 0
    OK: $ ./dump1090 --device-type limesdr --limesdr-channel 1
    NG: $ ./dump1090 --device-type limesdr --limesdr-channel 2
        $ limesdr: Invalid channel number.

Signed-off-by: Gluttton <gluttton@ukr.net>
2020-07-31 00:18:22 +03:00
Gluttton 7267d8aff9 limesdr: add ability to select desired device
Add ability to select a desired LimeSDR device by serial number. It is
not necessary to pass a whole serial number, but its key part is enough.
The first device which serial contains the passed key is selected.

Test: connect LimeSDR device and try to select it by serial number,
    below an example for a device with serial 0009081C05C00000:
    OK: $ ./dump1090 --device-type limesdr --limesdr-serial 9
    OK: $ ./dump1090 --device-type limesdr --limesdr-serial 90
    OK: $ ./dump1090 --device-type limesdr --limesdr-serial 908
    NG: $ ./dump1090 --device-type limesdr --limesdr-serial 999
    It hasn't been tested with several devices!

Signed-off-by: Gluttton <gluttton@ukr.net>
2020-07-31 00:18:12 +03:00
Gluttton f314e20342 limesdr: set verbosity level via input options
Add ability to set verbosity level for LimeSDR messages via command line
options. The range of available levels is from 0 to 4 and defined by the
constants from the `LimeSuite.h` file:
 - LMS_LOG_CRITICAL 0;
 - LMS_LOG_ERROR    1;
 - LMS_LOG_WARNING  2;
 - LMS_LOG_INFO     3;
 - LMS_LOG_DEBUG    4.
By default the verbosity level is 3 (INFO).

Test: launch the program with different verbosity level and ensure that
    number of messages is changed, for example:
    $ ./dump1090 --device-type limesdr --limesdr-verbosity 4
    $ ./dump1090 --device-type limesdr --limesdr-verbosity 3
    $ ./dump1090 --device-type limesdr

Signed-off-by: Gluttton <gluttton@ukr.net>
2020-07-30 00:39:37 +03:00
Gluttton 53183c0b2a limesdr: basic implementation of LimeSDR support
The commit provides a basic implementation of support for LimeSDR USB
receivers based on LMS7002 chip. The solution has several limitations:
 - passing parameters for tune LimeSDR receiver via command-line
   options is not implemented;
 - only hardcoded configuration is used (channel 0 of lower band LNA,
   LMS_FMT_I16 format, gain, bandwidth and timeout);
 - only one device is supported and it is not possible to select a
   desired one in case if several devices are connected to the host.

Test: compare the output of the program for RTL and LimeSDR receivers.
Environment:
 - RTL2832SDR dongle;
 - LMS7002M based USB LimeSDR board;
 - 800MHz-2200MHz omnidirectional antenna with SMA connector.
Procedure:
 - connect RTL dongle to the host and start the program with the
   following parameters:
   $ ./dump1090 --device-type rtlsdr --interactive
 - wait until several planes will be detected;
 - stop the program, connect the LimeSDR board to the host and restart
   the program with the following parameters:
   $ ./dump1090 --device-type limesdr --interactive
 - ensure that the same planes are detected.
Acceptance criteria: the same planes are detected using both receivers
   and track information matches with information from the
   FlightRadar24 application.

Signed-off-by: Gluttton <gluttton@ukr.net>
2020-07-29 23:09:27 +03:00