Commit Graph

31 Commits

Author SHA1 Message Date
Robert Ghilduta 9cb023b00a bladeRF: Add XB-200 support
This commit adds support for the bladeRF XB-200 transverter expansion
board. To enable the expansion board and to allow the osmocom source or
sink to tune down to 0Hz, parameter xb200 has to be set. XB-200 comes
with 4 filter banks which can be selected by passing their name as
a value of the xb200 parameter. Automatic filter selection will be
enabled if no value is given to the xb200 parameter.

Example:

osmocom_fft -a bladerf,xb200
osmocom_fft -a bladerf,xb200=50M

The following values are valid:
   "custom"  : custom band
   "50M"     :  50MHz band
   "144M"    : 144MHz band
   "222M"    : 222MHz band
   "auto3db" : Select fiterbank based on -3dB filter points
   "auto"    : Select filerbank based on -1dB filter points (default)
2014-07-11 16:53:23 +02:00
Jon Szymaniak c65d205d3b bladerf: Accept 'loopback' parameter only on a source
To alleviate some confusion (described below), the 'loopback' parameter
may now only be applied to a bladeRF source. A warning will be printed
if it is applied to a sink.

This is intended to help users avoid the case where two different
loopback options are applied to the same device. In this case, the
loopback setting on whichever initializes last will be applied. This,
coupled with the fact that not specifying a loopback defaults to
loopback=none, yields rather unintuitive behavior.
2014-05-06 22:39:06 +02:00
Jon Szymaniak 00b579532c bladerf: Apply 'verbosity' parameter before performing other operations
Setting the libbladeRF verbosity level needs to be performed prior to
other operations. Otherwise, the desired diagnostic output will not
appear for startup operations (e.g., device opening, enabling loopback).
2014-05-06 22:39:01 +02:00
Jon Szymaniak 23ea2fcfb4 bladeRF: Fixed typo in handling 'stream_timeout_ms' device argument 2014-04-14 00:30:17 +02:00
Jon Szymaniak 542a3dbb2b bladerf: Fixed bug in cached device cleanup
A couple issues were present in bladerf_common::close, which caused
entries in the _devs list (our "device cache") to not be removed. This
would result in a stale device handle being used upon attempting to
reopen the device.

Two issues were associated with this bug:
 - The weak_ptr expired() conditional was incorrect; the logic was
   inverted.
 - The list item removal and iterator increment was done incorrectly
   and would result in a crash after the first item was fixed.
2014-03-10 15:36:59 +01:00
Brian Padalino 4e0a2c28e3 bladerf: Updated source/sink to use libbladeRF's sync interface 2014-03-10 15:34:19 +01:00
Jon Szymaniak 7a1f12cfcf bladeRF: RXVGA2 range is [0, 30]
While the RXVGA2 gain can technically go up to 60 dB, the LMS6002D
datasheet recommends it be clamped to 30dB. libbladeRF clamps to a max
of 30dB, so there's no use in setting max to 60 dB here.
2014-02-16 09:00:05 +01:00
Jon Szymaniak 751ad0f582 bladerf: Added 'verbosity' and 'loopback' device parameters
The 'verbosity' parameter may be used to increase or suppress output from
libbladeRF. The available log levels are, in order of decreasing
verbosity are:
    verbose, debug, info, warning, critical, silent

The 'loopback' parameter may be used to put the bladeRF into one of the
supported loopback modes.  The valid modes are listed below. Their
descriptions may be found in the libbladeRF documentation:

      bb_txlpf_rxvga2, bb_txlpf_rxlpf bb_txvga1_rxvga2, bb_txvga1_rxlpf
      rf_lna1, rf_lna2, rf_lna3
2014-02-16 08:59:58 +01:00
Brian Padalino d960d1119c bladeRF: Modifying correction calls.
Modifying correction function calls to match libbladeRF API.
2014-01-18 20:20:19 +01:00
Jon Szymaniak 03c387bcda bladerf: Removed sign extension and masking of samples
This is no longer required as of FPGA v0.0.1, and has been removed to
remove some unnecessary computation on samples.
2014-01-13 18:43:14 +01:00
Jon Szymaniak 4a0d74f059 bladerf: Updates for libbladeRF v0.11.0 API changes 2014-01-13 17:31:07 +01:00
Jon Szymaniak 748ac00b25 bladerf: Use rational sample rate functions
libbladeRF provides accessors for rational sample rates, which the
integer sample rate functions use under the hood. Therefore, there's no
need to check if the requested rate contains a fractional portion and
switch between the two sets of functions.
2014-01-13 17:30:32 +01:00
Jon Szymaniak 8bbd2b5bb5 bladerf: Added start()/stop() implementations 2014-01-13 17:19:44 +01:00
Dimitri Stolnikov 5d0bade320 bladerf: shorten the serial number that is being shown to the user 2014-01-11 09:03:28 +01:00
Dimitri Stolnikov e68f8505df bladerf: implement DC offset and IQ imbalance correction
This patch has been provided by Brent J.
2014-01-11 08:57:49 +01:00
Dimitri Stolnikov df443ff5bd bladerf: prepare functions to control DC offset / IQ balance (WIP) 2013-12-28 01:02:35 +01:00
Jon Szymaniak b844149628 bladerf: Don't reload the FPGA unless the force-reload param is set 2013-10-30 18:59:59 +01:00
Jon Szymaniak 44bd325a86 bladerf: Moved initializations to bladerf_common.c, misc. cleanup
Common parameter handling has been moved into bladerf_common::init().

The buflen parameter is now in units of samples, not bytes. This
deviates from the other gr-osmosdr items. However, with the requirement
that buffers be in multiples of 1024 samples, this makes specifying this
parameter a bit easier. The user shouldn't need to know we're operating
on SC16Q12 values under the hood, and have to calculate accordingly.

To avoid confusion when both a bladeRF source and sink are in a flow
graph a [bladeRF source/sink] prefix has been added to output. Error
number have been replaced with bladeRF string representations of these
error values.

Firmware flashing has been removed. The bladeRF-cli or bladeRF-flash
tools are the preferred route for firmware upgrades.
2013-10-30 18:59:54 +01:00
Jon Szymaniak 03c42ef320 bladerf: Moved no longer "common" items out of bladerf_common
The gr_complex FIFO is no longer used on the TX side, so it doesn't
really make sense to have it in bladerf_common. The associated items
have been moved into bladerf_source, and some renaming has been done in
bladerf_sink to tidy up.

Pending further performance tests of the bladerf_source, the _fifo
member (boost::circular_buffer) may need to be replaced.
2013-10-30 18:59:48 +01:00
Daniel Gröber 46a241624a bladerf: Added device caching, this enables full-duplex operation. 2013-10-29 23:20:21 +01:00
Dimitri Stolnikov c744a7b35a remove unused variables 2013-10-25 23:32:13 +02:00
Dimitri Stolnikov 6f4e16ff28 bladerf: use newstyle version getters 2013-10-04 18:32:34 +02:00
Dimitri Stolnikov 2feacf957b bladerf: make source less picky wrt rf gain 2013-10-03 14:43:18 +02:00
Dimitri Stolnikov f057decd1c bladerf: implement automatic bandwidth selection 2013-09-28 13:49:13 +02:00
Jon Szymaniak 9b41c6aa20 bladeRF: Refactored buffering scheme in sink
Removed the use of an intermediate sample FIFO in the sink
implementation. Note the the FIFO has not been moved out of
bladerf_common --> bladerf_source_c in this commit.

work() now handles converting samples from complex to SC16_Q12, and filling
"transmit-ready" buffers. The callbacks are now only responsible for
marking the provided buffer free, and returning the next buffer.

It appears that a small deadlock issues remains in this changest, which
can be induced by:
 1: Using a small sample rate (160Khz)
 2: Switching back and forth between sinusoid <-> GSM burst

 In this case, it appears that work() is blocked waiting for a buffer to
 become free. More investigation here is required...
2013-09-28 00:07:55 +02:00
Dimitri Stolnikov ba7188727c bladerf: migration to async api (WIP)
receive works, transmit locks up in work() after few seconds
2013-09-28 00:07:49 +02:00
Frederik M.J. Vestre 68ed1854e7 Support setting external sampling to bladerf 2013-08-29 23:38:11 +02:00
Dimitri Stolnikov 265de87c45 bladerf: follow recent API changes
tested against aea04c5f119288370166ece05166a8a4157da6fa
2013-08-27 22:41:54 +02:00
Dimitri Stolnikov 9dfe3a6354 bladerf: update common sample rate values 2013-07-28 16:35:48 +02:00
Dimitri Stolnikov 93ad959d8d bladerf: migrate to new api to enable/disable TX/RX modules
TX support has been verified with osmocom_siggen and fpga image from git
f6c6a3abcb22d2794946e5adbc556805a73788a3
2013-07-26 21:46:47 +02:00
Dimitri Stolnikov e5f7b28093 bladerf: add support for nuand LLC bladeRF (WIP)
This is based on the original work (https://github.com/Nuand/gr-osmosdr)
done by folks at nuand LLC for the gr3.6 branch of gr-osmosdr.

The following modifications have been done in this commit:

* port to gr-osmosdr master codebase (gr3.7)
* moved shared properties to bladerf_common
* added & verified IF filter bandwidth setters
* set LMS6002D registers with values taken from FAQ 5.27
* print device information (serial/versions) on startup
* added fpga= and fw= device arguments to program MCU/FPGA
* added bladerf=# dev. arg. to select a specific bladeRF
* grc gain field controls RF path VGA for RX/TX
* grc BB gain field controls BB path VGA for RX/TX

Usage example:

osmocom_fft -a "bladerf,fpga=/tmp/hostedx115.rbf"

The following RX named gain stages are available:

LNA: 0 to 6 dB, in 3dB steps
VGA1: 5 to 30 dB, in 1dB steps; nonlinear mapping done inside the lib
VGA2: 0 to 60 dB, in 3dB steps; not recommended to be used above 30dB

The following TX named gain stages are available:

VGA1: -35 to -4 dB, in 1dB steps, BB side
VGA2: 0 to 25 dB, in 1dB steps, RF side

Thanks a lot to the team of nuand LLC for this major contribution.
2013-07-21 11:59:22 +02:00