Commit Graph

497 Commits

Author SHA1 Message Date
Ryan Tucker ea6cc4beb9 bladerf_common: add agc= option to set gain mode 2018-08-15 19:53:26 +02:00
Ryan Tucker 0132f6c494 bladerf: use nchan option to enable multi-channels
By default, the bladeRF source and sink will expose 1 channel, unless
nchan is set, in which case it will expose either that number of
channels, or the number of channels supported by the device if lesser.

If nchan > 1 (after validation), MIMO mode is enabled.
2018-08-15 19:53:26 +02:00
Ryan Tucker 814fe0809c bladerf: fix get_gain_names population
Instead of haphazardly iterating through the gain strings, just use the
count returned.
2018-08-15 19:53:26 +02:00
Ryan Tucker 077697cb2d bladerf: formatting/style fixes on .h files 2018-08-15 19:53:26 +02:00
Ryan Tucker 399db91385 bladerf: formatting/consistency fixes 2018-08-15 19:53:26 +02:00
Ryan Tucker ed4dda192b bladerf_common: formatting/whitespace/consistency 2018-08-15 19:53:26 +02:00
Ryan Tucker cee878536a bladerf: replace bladerf_module with bladerf_direction
More closely matches the handling in the API
2018-08-15 19:53:26 +02:00
Ryan Tucker 07babe997d bladerf_common: cleanup on set_gain_mode
Turns out that source/sink_impl already handle the AGC->MGC gain
preservation, so this was redundant and counterproductive.

Also DRY the code a bit.
2018-08-15 19:53:26 +02:00
Ryan Tucker 3523097e00 bladeRF: fix identification of channels 2018-08-15 19:52:57 +02:00
Ryan Tucker 855ac41c12 bladeRF: remove set_bb_gain
This is not meaningful with bladeRF hardware
2018-08-15 19:52:57 +02:00
Rey Tucker 4ffccd1363 update copyright dates 2018-08-15 19:52:57 +02:00
Rey Tucker a6209e3250 formatting/wording tweaks 2018-08-15 19:52:56 +02:00
Ryan Tucker 107b35bee3 bladerf2: add get_gain_mode and set_gain_mode 2018-08-15 19:52:56 +02:00
Ryan Tucker 708096f6e4 WIP: libbladeRF rev2 refactoring etc 2018-08-15 19:52:56 +02:00
Ryan Tucker 4395c3e6c7 WIP: more port work 2018-08-15 19:52:56 +02:00
Rey Tucker 56da34f7f2 bladerf: initial support for new bladeRF hardware
Relies on some new libbladeRF API calls. Has been tested
with gqrx on new bladeRF hardware (as a source) but have
not yet tested sink, or existing bladeRF hardware.
2018-08-15 19:52:56 +02:00
Josh Blum 0b5c3911f7 link with pthreads only when using gcc
Fix from c98be5dd for MSVC which does not require pthreads for boost threading library.
Under gcc -pthread adds support for multithreading with the pthreads library.
2018-08-15 19:52:23 +02:00
Dimitri Stolnikov ea1fc34766 Merge branch 'master' of git.osmocom.org:gr-osmosdr 2018-08-15 19:47:37 +02:00
Maxime Vincent c98be5dd9d Fix compilation with boost-1.67
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2018-06-17 17:56:50 +02:00
Dimitri Stolnikov ea6b356cfd Remove workaround for gnuradio bug #528 as it has been fixed in 3.7.9.1 2017-06-14 20:42:59 +02:00
Dimitri Stolnikov c653754dde Merge branch 'master' of git.osmocom.org:gr-osmosdr 2017-06-12 00:04:36 +02:00
Dimitri Stolnikov b7aab458ed freesrp: whitespace fixes 2017-06-11 23:55:17 +02:00
Lukas Lao Beyer 1693e4e9d8 FreeSRP: Add support for multiple devices in get_devices 2017-06-11 23:52:12 +02:00
Dimitri Stolnikov 3c7d3f1664 rtl,rtl_tcp: add bias=0|1 parameter to switch off|on bias voltage on
gpio0
2017-06-11 22:04:03 +02:00
Dimitri Stolnikov a3b4e5c815 rtl_tcp: delete LUT table in destructor 2017-06-11 21:42:05 +02:00
Krzysztof Halasa 26f93e4687 RTL-TCP: Convert to single class model
The existing RTL TCP driver is quite different from its brother RTL_SDR.
It's much more complicated, uses gr::blocks::deinterleave and
gr::blocks::float_to_complex, and generally doesn't work correctly
(e.g. https://github.com/csete/gqrx/issues/99
 Spectrum is mirrored when filter or demodulator changes (rtl_tcp) #99)

I've converted the RTL TCP driver to the model used by RTL_SDR,
simplifying it in the process, and fixing the GQRX issue.
2017-06-11 21:30:47 +02:00
Krzysztof Halasa 33a8d1c2ae RTL-SDR: convert _lut to float[] to reduce size by a factor of 256
The _lut is being indexed by I + Q (16 bits = 65536 entries), however
both samples can be processed independently, resulting in 8-bit LUT.
Saves a bit of RAM and CPU cache.
2017-06-11 21:30:38 +02:00
Josh Blum cf9549485a soapy - correct constant for frequency correction
This is a typo, some modules use the "CORR" string
in the setFrequency(dir, chan, name, value) API
to perform fine frequency adjustments.
Updated modules will use setFrequencyCorrection(),
this is support for backwards compatible implementations.
2017-04-21 11:29:30 -07:00
Josh Blum 117f648859 soapy: support set/getFrequencyCorrection() API
backwards compatible changes with #ifdef
set/get_freq_corr() call directly into the SoapySDR
equivalent when supported by the API version.
2017-04-18 16:29:02 -07:00
Josh Blum b361fa5a77 soapy: support newer getSampleRateRange() API call
Switch to the newer API call which can provide a list of ranges.
There are feature detection ifdefs provided by the library
so that code will always correctly compile.
2017-04-18 16:29:02 -07:00
Josh Blum a9e536f45b soapy - check for freq corr before invoking
set_freq_corr() is often a NOP for devices.
checking avoids crashes for some applications (ex GQRX)
2017-04-18 16:29:02 -07:00
Lukas Lao Beyer 5ecfa255d2 Add support for FreeSRP
This patch adds support for both receiving and transmitting using
the FreeSRP. More information on the FreeSRP can be found at:

http://freesrp.org

The gr-osmosdr blocks added make use of libfreesrp, the library
required for interfacing with this device. The libfreesrp source
code is freely available at

https://github.com/freesrp/libfreesrp

Usage example:

osmocom_fft -a "freesrp"
2017-04-18 23:48:08 +02:00
Dimitri Stolnikov e9dde9afd7 bladerf: discover and use Volk 2017-02-27 23:23:54 +01:00
Sylvain Munaut 71846180f5 bladeRF: Use VOLK for type conversion
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2017-02-27 23:03:43 +01:00
Dimitri Stolnikov 43df1c98c4 rfspace: use boost::chrono for sleeping 2017-02-27 23:03:09 +01:00
Dimitri Stolnikov 20a5fd1a68 hackrf: correct gcc6 warnings 2017-02-27 23:01:51 +01:00
Dimitri Stolnikov 6a0cac6609 airspy: correct gcc6 warnings 2017-02-27 23:01:15 +01:00
Alexandru Csete c6ed80aea7 rtl, rtl_tcp: Use std::abs.
Fixes compile error on Mac OS X.
2017-02-27 22:29:18 +01:00
Alexandru Csete 3823c8efce Custom FIR kernels for Airspy. 2017-02-27 22:27:53 +01:00
Alexandru Csete 6ea6c19028 rfspace: Send periodic keep-alive packets.
This patch enables sending keep-alive packets at 1 minute interval to
RFSpace networked radios. Without this the TCP connection to the radio
is closed after about 5 minutes (by the OS?).
2017-02-27 22:26:26 +01:00
Alexandru Csete 0dc8154f08 rfspace: Wait 10 ms before sending queries to device.
This is necessary to esatablish a working connection to the RFSpace
CloudIQ. Without this delay the radio will not be ready and we never
receive any response to the queries and the radio will close the
connection after 5 seconds.
2017-02-27 22:26:09 +01:00
Josh Blum 2a2236cc9e soapy: support step size in gain ranges
* This change is backwards compatible and checks for API support for step size.
* Created soapy_common.cc/h to house common gain range functions
* Moved factory mutex declaration to common source files as well
2017-02-02 11:33:34 -08:00
Josh Blum 3511defbf4 soapy: added device::find() support
Was missing from the implementation.
Now devices with a label show up nicely in GQRX
2017-02-02 11:10:08 -08:00
Josh Blum ae686c462d soapy: support newer getBandwidthRange() API call
Switch to the newer API call which can provide a list of ranges.
There are feature detection ifdefs provided by the library
so that code will always correctly compile.
2016-06-22 18:13:11 -07:00
Josh Blum 860e9a1a72 soapy: provide default gain range step
The soapysdr range type does not provide a step size,
however apps like the osmocom siggen use this size for a slider,
and a value of zero will cause a divide by zero error.

Although many ranges are not actually linear,
the idea to provide some default step to avoid crashes.
A future addition to the API may include providing a step.
2016-06-07 13:52:52 -07:00
Josh Blum e3b6560b04 soapy: support automatic bandwidth param
When the special 0.0 bandwidth setting is used, set the filter bandwidth to rate * 0.75.
Passing automatic 0.0 bandwidth for some devices was problematic.
2016-06-07 13:45:25 -07:00
Dimitri Stolnikov 164a09fc11 airspy: Option pack={0,1} to enable USB bit packing
Patch provided by Martin Smith.

Last July there were several changes made to the Airspy firmware and
libairspy that added support for a new bit packing mode where 4 sets of
12 bit samples are packed into 3 sets of 16 bits for the transfer across
the USB bus ( https://i.imgur.com/qXnWoEK.png?1 ). 25% less data is
transferred across the bus and this is good for some computers with
cheap USB chipsets. There is an overhead of extra memory bandwidth
required on the host side to unpack the data into a useful format, so
for optimal performance bit packing is disabled by default.

The data is automatically unpacked within libairspy before being passed
along, so no changes are required anywhere else if packing is enabled
(or not enabled). Airspy firmware older than v1.0.0-rc6 does not have
the function, but that is detected and handled by libairspy.

I wrote the attached patch to enable packing in gr-osmosdr, which I
tested and it works. It is basically a clone of the bias=0|1 lines as
pack=0|1 and calls the needed libairspy function.

ref:
https://github.com/airspy/firmware/commit/7e1806b
https://github.com/airspy/firmware/commit/5b7dcab
https://github.com/airspy/host/commit/a51eccb

---
Do some Baseline test with Airspy command line tools to have something
to compare USB throughput results
--------------------------------------------------------------------------------------------------------
$ sudo mount -t debugfs none /sys/kernel/debug
$ sudo modprobe usbmon
$ wireshark -i usbmod3 &
$ airspy_info ; sleep 120 ; \
airspy_rx -t 4 -r /dev/null -n 2400000000 ; sleep 120 ; \
airspy_rx -t 4 -r /dev/null -p 1 -n 2400000000 ; sleep 120 ; \
airspy_info
Wireshark->Statistics->IO Graph
The Bytes/Tick are double the actual data rate because of way wireshark
collects the USB packets, I could have added a filter to fix this. But
the relationship is valid 25% less with packing enabled. The data rate
in the IO Grahp drops from 80MB/sec (in+out) [really 40MB/sec] to
60MB/second (in+out) [really 30MB/sec] from unpacked to packed.
10MSPS no packing, packing https://i.imgur.com/pA9LPdE.png?1
2.5MSPS no packing, packing https://i.imgur.com/lA8q5aq.png?1

Verification test with my patched gr-osmosdr
--------------------------------------------
$ sudo mount -t debugfs none /sys/kernel/debug
$ sudo modprobe usbmon
$ wireshark -i usbmod3 &
$ osmocom_fft -a "airspy=0" -s 10000000 --fft-rate=1
$ osmocom_fft -a "airspy=0,pack=1" -s 10000000 --fft-rate=1
$ osmocom_fft -a "airspy=0" -s 2500000 --fft-rate=1
$ osmocom_fft -a "airspy=0,pack=1" -s 2500000 --fft-rate=1
$ osmocom_fft -a "airspy=0" -s 2500000 --fft-rate=1
$ osmocom_fft -a "airspy=0,pack=0" -s 2500000 --fft-rate=1

I ran all of the above tests and the wireshark USB throughput graphs
showed exactly what was expected.
40MB/sec(10MSPS+normal),30MB/sec(10MSPS+packing),10MB/sec(2.5MSPS
+normal),7.5MB/sec(2.5MSPS+packing),10MB/sec(2.5MSPS+normal),10MB/
sec(2.5MSPS+normal).

25% less when packing was enabled and if you did not specify the
"pack=1", then no bit packing is performed by libairspy. All the
magnitudes within the FFT windows looked exactly the same as they do
without bit packing.
2016-02-28 17:52:01 +01:00
Dimitri Stolnikov b206a90f49 apps: implement --peak-hold option for fft 2016-02-28 17:50:54 +01:00
Dimitri Stolnikov e6f46a1c04 apps: added --clock-source option to fft and siggen 2016-02-28 17:46:55 +01:00
Dimitri Stolnikov 2b79811350 bladerf: implement options for clock configuration
Since firmware 2016.01-rc1 bladeRF has the ability to lock to an
external reference as well as produce arbitrary frequency signal
(25 MHz here) on its clock output.

Use gr-osmosdr source with the following arguments to produce 25
MHz on the SMB connector:

osmocom_fft -a bladerf,smb=25e6

smb=25e6

To lock the bladeRF itself to an external GPSDO reference, use
additional arguments tamer=external for 10MHz or tamer=external_1pps for
1PPS GPSDO signals.

osmocom_fft -a bladerf,smb=25e6,tamer=external

tamer={internal,external_1pps,external}

The described method requires https://github.com/Nuand/bladeRF/releases/
tag/2016.01-rc1

Carefully *read the instructions for external reference locking*
(especially max allowed voltage levels) on Nuand's blog https://
www.nuand.com/blog/2016-01-rc1-release/
2016-02-28 17:45:54 +01:00