Commit graph

408 commits

Author SHA1 Message Date
Jon Szymaniak
c3a674ea62 libbladeRF: Added CHANGELOG 2014-07-05 03:25:48 -04:00
Jon Szymaniak
14f515e467 libbladeRF: Version bumped to v0.16.0
Changes include:

- Added XB-200 support
- Added experimental DC calibration and DC calibration table support
- Added "software autoload" of FPGAs and DC cal tables from config directories
- Added "File not found" (BLADERF_ERR_NO_FILE) return code
- Allow tuning up to 3.8GHz
- Fixed incorrect version checks
    + This resolves issue where VCTCXO value isn't loaded when using FPGA v0.0.3
- Fixed intermittent FPGA load failures
2014-07-04 11:40:17 -04:00
Jon Szymaniak
d2d848cc44 libbladeRF: Added BLADERF_FREQUENCY_MIN_XB200 definition to API header 2014-07-04 10:50:04 -04:00
Jon Szymaniak
3b6f70a883 libbladeRF: Removed old bladerf_xb200_attach() function from API
This is a vestige of earlier code. bladerf_expansion_attach() is the
function that performs the desired functionality.

As such bladerf_xb200_attach() has been made static and renamed in xb.c.
2014-07-04 10:15:20 -04:00
Jon Szymaniak
339f0549c2 libbladeRF: Fixed flipped logic in version checks and an erroneous check
The implementations of these were the opposite of what is described
in the associated function descriptions.

Additionally, a version check was incorrectly testing the device's
firmware version instead of the FPGA version.
2014-07-03 15:40:44 -04:00
Jon Szymaniak
0eb27140f9 libbladeRF: Don't enable LMS DCCAL clocks when reading back DC cal values
The DCCAL clocks need to be enable when using DC_LOAD.

However, it appears that enabling the DCCAL clocks when reading back
values at later time yields intermittently corrupted read values
2014-07-02 23:22:25 -04:00
Jon Szymaniak
39799711ef libbladeRF: Fixed unintentional switch case fall-throughs 2014-07-02 01:06:16 -04:00
Jon Szymaniak
a5402b78d9 libbladeRF: Fixed incorrect LMS LPF register configuration
Two issues existed in the LMS LPF configuration:

(1) The LPF bypass was not being disabled when switching to
BLADERF_LPF_DISABLED. Therefore, its state would be different depending
on whether the previous state was BLADERF_LPF_BYPASSED or
BLADERF_LPF_NORMAL.

(2) BLADERF_LPF_BYPASSED was leaving the LPF powered on. According to
the TX/RX LPF block diagram (Figure 3.5, in v1.1r4) in the LMS6002D
programming guide, this implies that the LPF was enabled while its
input was shorted to its output.
2014-07-01 23:02:00 -04:00
Jon Szymaniak
1b1a61bc88 libbladeRF: Removed 3.72GHz SW limit. Allow tuning up to 3.8GHz.
This was limited due to 3.72GHz being the maximum value show in the
LMS6002D programming guide's FREQSEL table. According to a response
on the limemicro-opensource Google group, we should be able to use
the same FREQSEL value from 3.72GHz - 3.8GHz.
2014-06-30 23:32:02 -04:00
Jon Szymaniak
93d180c908 libbladeRF: Reset frequency when existing loopback mode
This ensures that device registers (e.g., SELOUT) are restored properly
upon exiting loopback mode, as the user may have crossed bands.
2014-06-30 20:45:05 -04:00
Jon Szymaniak
3c2d571e45 bladeRF-cli, libbladeRF: Fixed DC cal table extension (.tbl)
As noted in commit 67938789f9, the calibration tables were intended to
have a .tbl extension. However, the calibration table functionality in
the previous commits were incorrectly using a .bin extension.
2014-06-30 20:06:57 -04:00
Jon Szymaniak
83800540a4 libbladeRF: Ensure device is configured after FPGA "software autoload"
bladerf_load_fpga() is now used, as it will initialized the device after
and FPGA load, if needed.
2014-06-30 19:40:24 -04:00
Jon Szymaniak
7ce4b81258 libbladeRF: Fixed memory leaks in DC cal table autoload 2014-06-30 00:04:39 -04:00
Jon Szymaniak
406c8d3fa2 Windows warning cleanup 2014-06-30 00:04:39 -04:00
Jon Szymaniak
67938789f9 libbladeRF: Load calibration tables or FPGA bitstream on device open
On Linux and OSX, the following directories will be searched,
in the order listed:
    ~/.config/Nuand/bladeRF
    ~/.Nuand/bladeRF
    /etc/Nuand/bladeRF

In Windows, %appdata%/Nuand/bladeRF will searched.

The following files will be loaded, if found in these search paths:

    FPGA image: hostedx40.rbf or hostedx115.rbf, depending on the
                size of the FPGA reported by the device.

    DC Calibration tables: <serial>_dc_<rx|tx>.tbl

libbladeRF: Added Windows support to file_find
2014-06-30 00:04:39 -04:00
Jon Szymaniak
6c20a6784e libbladeRF: Added function to search for files and read their contents. 2014-06-30 00:04:39 -04:00
Jon Szymaniak
7f4e0e8b6f libbladeRF: Aesthetic cleanup of labels in file_ops.c 2014-06-30 00:04:38 -04:00
Jon Szymaniak
c1ffb2dafe libbladeRF: Moved ARRAY_SIZE() macro to host config header 2014-06-30 00:04:38 -04:00
Jon Szymaniak
e28f973a4b libbladeRF: Removed calibration load from public API
This will be replaced by some detection from a config file
2014-06-30 00:04:38 -04:00
Jon Szymaniak
d3b9bbf86f libbladeRF: The LPF Tuning DC value is not always 23 2014-06-30 00:04:38 -04:00
Jon Szymaniak
ed83325d66 libbladeRF: Fixed table assignments during TX DC cal table loading
Items were being assigned to the RX module
2014-06-30 00:04:38 -04:00
Jon Szymaniak
bb1d618bf9 libbladeRF: Added a means to clear and disable calibration tables 2014-06-30 00:04:38 -04:00
Jon Szymaniak
3a487a4827 libbladeRF: Apply LMS reg values and reset freq when loading DC cal tbl 2014-06-30 00:04:38 -04:00
Jon Szymaniak
601672a033 libbladeRF, bladeRF-cli: DC calibration table entry size fixes, added fields
The DC calibration table entries' offset values are int16_t, not
uint8_t. Although the actual register values are uint8_t, the libbladeRF
interface has normalized them.

We might want to bypass this normalization to reduce the size of this
calibration table, especially if we want to fit it in flash.
2014-06-30 00:04:38 -04:00
Jon Szymaniak
eaa76ee831 libbladeRF: Added bladerf_load_calibration_table()
This function provides the ability to load DC offset tables, and will
be used to support loading of IQ balance correction tables in the future.
2014-06-30 00:04:38 -04:00
Jon Szymaniak
0d2f271ef1 bladeRF-cli: Added DC offset calibration table generation 2014-06-30 00:04:38 -04:00
Jon Szymaniak
e05eb84e9b libbladeRF: Added image types for additional calibrations, typo fix 2014-06-30 00:04:37 -04:00
Jon Szymaniak
a1b9f80671 libbladeRF: Added functions to get/set LMS DC calibration values 2014-06-30 00:04:37 -04:00
Jon Szymaniak
e73438dddc libbladeRF: Removed LMS DC cal routines from device init
In order for the DC cal tables to work, the LMS calibration values will
need to be the same as when the table was generated. Therefore, we
cannot perform these cal routines during device init.
2014-06-30 00:04:37 -04:00
Jon Szymaniak
952db39be0 libbladeRF: Added DC calibration table structure and routines 2014-06-30 00:04:37 -04:00
Jon Szymaniak
29c5a6c65c libbladeRF: Perform LMS RX DC cal during device initialization 2014-06-30 00:04:37 -04:00
Jon Szymaniak
8c31580c9d libbladeRF: Disable LNA while performing LMS DC tuning 2014-06-30 00:04:36 -04:00
Brian Padalino
8b8f2dc101 libbladeRF: Be explicit with RXVGA2 cal.
It was seen that the VCM will sometimes come back in a bad state.
This register has a very well known value that it should be.  Setting
it to be these explicit values seems to help alleviate putting the
LMS is a bad state.

Investigation is required to figure out why the VCM is coming back
scrogged.
2014-06-30 00:04:36 -04:00
Jon Szymaniak
cfa916c942 libbladeRF: Added register settings from LMS FAQ to DC calibration fns
The following changes have been added to lms_dc_cal_loop() and
lms_calibrate_dc(), based upon recommendations from the LMS 6002D FAQ
(version 1.0r10).

    - Use the DC_REGVAL to determine success or failure, as DC_LOCK
      is reported (in the FAQ) to be unreliable. Retry if the result is
      31, setting the count to DC_CNTVAL to 0.

    - Enable DC comparators during DC calibration (default), and
      disable them upon completion to address linearity issues.

    - Disable DACs while performing TXLPF DC calibration
2014-06-30 00:04:36 -04:00
Jon Szymaniak
d4b79cddba libbladeRF: Moved LPF DC tuning value write into address loop
This is just for readability. There's no functional change, since
there's only 1 address to loop over anyway.
2014-06-30 00:04:36 -04:00
Brian Padalino
e03a1144b0 Calibration update. 2014-06-30 00:04:36 -04:00
Brian Padalino
f5fb4617ef Modify the RXVGA2 calibration routines to enable test mode signals 2014-06-30 00:04:36 -04:00
Ryan Tucker
b24cf702b6 Support Windows builds with MinGW
- Our surrogate inttypes.h is only needed for Visual Studio 2010 and
  earlier, due to the lack of C99 support.
- Move all the inttypes.h includes into host_config.h, where we can
  do the ugly in a centralized location
- MinGW on Linux is case-sensitive -- reflect that when including
  windows.h.
2014-06-21 13:41:44 -04:00
Jon Szymaniak
4455994904 libbladeRF: Minor API header touch-ups and Doxygen fixes 2014-06-20 00:13:33 -04:00
Jon Szymaniak
588c8602bd libbladeRF: Fixed Windows build issue (warning + /WX)
Removed narrowing assignment from double to unsigned int.
2014-06-19 00:14:16 -04:00
Jon Szymaniak
0ec9c9c41a libbladeRF: Removed incorrect usage of error_conv()
In this case, status is already a libbladeRF error value.

Fixes #257
2014-06-17 19:39:46 -04:00
Robert Ghilduta
cb0af5a16c libbladeRF: add initial XB-200 transverter support 2014-06-17 09:47:59 -07:00
Jon Szymaniak
923e242484 libbladeRF: Removed end_fpga_programming() call from FPGA load
This function was causing intermittent failures because it would
return an error if it detected that that FPGA was not yet loaded,
which is a likely possibility.

Since this function no longer issues a vendor request to device to
perform a post FPGA load operation, it serves no purpose and has been
removed.
2014-06-11 22:46:58 -04:00
Jon Szymaniak
d6682e54c2 libbladeRF: Addressed items identified by Clang scan
tests/test_sync/src/test.c:
    Changed sample buffer type to int16_t. These alleivates noise from static
    analysis tools regarding a type mismatch with sizeof(), and better
    exemplifies the buffers that should be used in conjunction with the SC16 Q11
    format.

tests/test_repeater/src/repeater.c:
    Fixed unchecked pthread_cond_wait result.

tests/test_async/main.c:
    Fixed unchecked return values, minor cleanup.

src/lms.c:
    Removed dead assignment.

src/backend/usb/usb.c:
    Corrected unchecked return value.

src/backuend/usb/libusb.c:
    Fixed uninitialized variable in error path.
2014-05-28 21:33:33 -04:00
Jon Szymaniak
ce1fcb9602 libbladeRF: Added "File not found" API return code
Operations that open files (e.g., firmware flash, FPGA load) now
return BLADERF_ERR_NO_FILE instead of BLADERF_ERR_IO when a file not
found. This is intended to help differentiate between user-error in the
aforementioned operations and a device-failure.
2014-05-25 00:51:18 -04:00
Jon Szymaniak
425239863b libbladeRF: Fixed leak in FPGA flashing failure case (CID 1104234) 2014-05-23 13:44:52 -04:00
Jon Szymaniak
cdba131f25 libbladeRF: Fixed potential memory leak in cases with bad args (CID 1213846) 2014-05-23 13:44:28 -04:00
Jon Szymaniak
137e39b1df libbladeRF: Added error code return after assertion (CID 1213847)
Ensure this function can't proceed if release assertions become
disabled, and to appease static analysis tools.
2014-05-23 13:19:33 -04:00
Jon Szymaniak
54ce781e27 libbladeRF: Bumped revision to v0.15.0
Changes since v0.14.0 tag include:
 - Overhauled backend interface to decouple device logic from libusb
   code. Moved code to a generic USB interface and libusb code under
   that interface. This should allow host-specific drivers to be more
   easily integrated.
 - Addressed race conditions in the async RX/TX interface. pthreads is
   now a required dependency of libbladeRF.
 - Bug fixes for the sync RX/TX interface
 - Windows build and compatibility fixes
 - API changes:
    + Added functions:
        - FPGA timestamp access (requires FPGA v0.0.4+)
        - Expansion board GPIO and SPI accessors (requires FPGA v0.0.4+)
        - Firmware loopback (requires FX3 FW v1.7.0+)
    + Changed SPI flash access functions
        - Functions operate in units of erase blocks and pages
        - Removed un-aligned accesses
2014-05-17 23:40:32 -04:00
Jon Szymaniak
61fa9c3eda libbladeRF: Check for required FW version when enabling FW loopback 2014-05-17 23:40:32 -04:00