GNU Radio block for interfacing with various radio hardware
Go to file
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
apps apps: implement --peak-hold option for fft 2016-02-28 17:50:54 +01:00
cmake cmake: If we are cross compiling, we shouldn't make decisions based on 2016-01-10 22:17:09 +01:00
docs introduce osmosdr namespace, remove _c suffix 2013-05-30 16:14:22 +02:00
grc bladerf: implement options for clock configuration 2016-02-28 17:45:54 +01:00
include/osmosdr introduce time & clock synchronisation APIs 2014-11-25 20:47:59 +01:00
lib airspy: Option pack={0,1} to enable USB bit packing 2016-02-28 17:52:01 +01:00
python python: Remove an old workaround for a swig bug 2014-08-25 22:33:12 +02:00
swig introduce time & clock synchronisation APIs 2014-11-25 20:47:59 +01:00
AUTHORS cmake: update component name & update AUTHORS file 2016-01-10 22:28:15 +01:00
CMakeLists.txt bladerf: implement options for clock configuration 2016-02-28 17:45:54 +01:00
COPYING update license file to GPL v3 as in source 2012-04-21 14:07:25 +02:00
MANIFEST.md updated MANIFEST.md 2015-05-14 00:22:39 +02:00
README update documentation 2015-12-18 22:20:27 +01:00
gnuradio-osmosdr.pc.in cmake: update url to documentation page 2013-06-08 17:39:09 +02:00

README

While primarily being developed for the OsmoSDR hardware, this block
as well supports:

 * FUNcube Dongle through libgnuradio-fcd
 * FUNcube Dongle Pro+ through gr-fcdproplus
 * sysmocom OsmoSDR Devices through libosmosdr
 * RTL2832U based DVB-T dongles through librtlsdr
 * RTL-TCP spectrum server (see librtlsdr project)
 * MSi2500 based DVB-T dongles through libmirisdr
 * SDRplay RSP through SDRplay API library
 * gnuradio .cfile input through libgnuradio-blocks
 * RFSPACE SDR-IQ, SDR-IP, NetSDR (incl. X2 option)
 * AirSpy Wideband Receiver through libairspy
 * CCCamp 2015 rad1o Badge through libhackrf
 * Great Scott Gadgets HackRF through libhackrf
 * Nuand LLC bladeRF through libbladeRF library
 * Ettus USRP Devices through Ettus UHD library
 * Fairwaves UmTRX through Fairwaves' fork of UHD
 * Red Pitaya SDR transceiver (http://bazaar.redpitaya.com)

By using the OsmoSDR block you can take advantage of a common software api in
your application(s) independent of the underlying radio hardware.

For installation and usage guidelines please read the documentation available
at http://sdr.osmocom.org/trac/wiki/GrOsmoSDR

For the impatient :) a short excerpt:

The Gnu Radio block requires a recent gnuradio (>= v3.7) to be installed.

Before building the block you have to make sure that all the dependencies
(see list of supported devices above) you are intend to work with are
properly installed. The build system of gr-osmosdr will recognize them and
enable specific source/sink components thereafter.

Please note: prior pulling a new version from git and compiling it,
please do a "make uninstall" first to properly remove the previous version.

Building with cmake:

git clone git://git.osmocom.org/gr-osmosdr
cd gr-osmosdr/
mkdir build
cd build/
cmake ../
make
sudo make install
sudo ldconfig

NOTE: The osmocom blocks will appear under 'Sources' and 'Sinks' categories
in GRC menu.