Commit Graph

28 Commits

Author SHA1 Message Date
Jon Szymaniak b986e31e63 bladeRF: Fixed typo in handling 'stream_timeout_ms' device argument 2014-05-03 18:37:34 +02:00
Jon Szymaniak 2ae3fdbc22 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-05-03 18:27:47 +02:00
Brian Padalino 79ad6f6a76 bladerf: Updated source/sink to use libbladeRF's sync interface 2014-05-03 18:27:02 +02:00
Jon Szymaniak 40f93c2ae1 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:30:49 +01:00
Jon Szymaniak 1633dbaa74 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 09:30:46 +01:00
Brian Padalino 36a6b8fe1f bladeRF: Modifying correction calls.
Modifying correction function calls to match libbladeRF API.
2014-01-26 17:19:06 +01:00
Jon Szymaniak cd38413803 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-26 17:18:45 +01:00
Jon Szymaniak 43af3a851e bladerf: Updates for libbladeRF v0.11.0 API changes 2014-01-26 17:17:19 +01:00
Jon Szymaniak 734ba42989 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-26 17:17:14 +01:00
Jon Szymaniak 1e742bc186 bladerf: Added start()/stop() implementations 2014-01-26 17:16:53 +01:00
Dimitri Stolnikov aaedaa2c97 bladerf: shorten the serial number that is being shown to the user 2014-01-26 17:08:47 +01:00
Dimitri Stolnikov 58648a3124 bladerf: implement DC offset and IQ imbalance correction
This patch has been provided by Brent J.
2014-01-26 17:08:31 +01:00
Dimitri Stolnikov 5da9aafa2c bladerf: prepare functions to control DC offset / IQ balance (WIP) 2014-01-26 17:08:22 +01:00
Jon Szymaniak 743dc07b43 bladerf: Don't reload the FPGA unless the force-reload param is set 2013-11-04 22:11:23 +01:00
Jon Szymaniak b7fff27300 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-11-04 22:10:59 +01:00
Jon Szymaniak 892433836f 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-11-04 22:09:27 +01:00
Daniel Gröber 54f2e08dd7 bladerf: Added device caching, this enables full-duplex operation. 2013-11-04 22:09:23 +01:00
Dimitri Stolnikov 0923bcb687 remove unused variables 2013-10-25 23:46:34 +02:00
Dimitri Stolnikov c7dcddc3cd bladerf: use newstyle version getters 2013-10-04 18:32:40 +02:00
Dimitri Stolnikov a81016d230 bladerf: make source less picky wrt rf gain 2013-10-03 14:50:24 +02:00
Dimitri Stolnikov 681e3b7d4a bladerf: implement automatic bandwidth selection 2013-09-28 13:59:03 +02:00
Jon Szymaniak a0b534d118 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:42:46 +02:00
Dimitri Stolnikov 1c9a793a70 bladerf: migration to async api (WIP)
receive works, transmit locks up in work() after few seconds
2013-09-28 00:37:58 +02:00
Frederik M.J. Vestre 2e9828f120 Support setting external sampling to bladerf 2013-08-29 23:38:20 +02:00
Dimitri Stolnikov c16a562ddc bladerf: follow recent API changes
tested against aea04c5f119288370166ece05166a8a4157da6fa
2013-08-27 22:42:24 +02:00
Dimitri Stolnikov 11841ccb29 bladerf: update common sample rate values 2013-07-28 20:04:27 +02:00
Dimitri Stolnikov 41bb9a0ef9 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-28 20:04:17 +02:00
Dimitri Stolnikov 65e34f6863 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-28 19:57:45 +02:00