Commit graph

1,245 commits

Author SHA1 Message Date
Jon Szymaniak
90741dbd94 cmake: Set Windows-specific LIBUSB_PATH default only for WIN32 systems 2014-10-27 11:52:58 -04:00
Jon Szymaniak
2dfab156c0 libbladeRF: Continue searching USB devices after encountering a failure
Bailing out immediately upon failing to open or claim a device prevents
us from being able to open any available device if one or more is
already in use.
2014-10-27 11:29:43 -04:00
Jon Szymaniak
d7d93c173c hdl: Store build artifacts in a timestamped directory, with reports
FPGA build artifacts are now copied to a <rev>x<size>-<timestamp>
directory. The .rbf, SHA256 & MD5 checksums, and reports/summaries are
copied into this directory.

This is intended to help keep files with their associated FPGA images, as
items in work/ are clobbered with each invocation of build_bladerf.sh.
2014-10-23 13:02:31 -04:00
Jon Szymaniak
2f193db170 bladeRF-cli: Fixed memory leak in error condition (CID1234624) 2014-10-23 12:01:46 -04:00
Jon Szymaniak
0deeb4dd05 libbladeRF/tests: Fixed memory leak in error condition (CID1232259) 2014-10-23 11:40:41 -04:00
Jon Szymaniak
8d931671b9 libbladeRF: Fixed memory leak in error condition (CID1232258) 2014-10-23 11:36:53 -04:00
Jon Szymaniak
3fd13f7627 libbladeRF/tests: Fixed dead code (CID1232254), fixed bandwidth range
Removed unnecessary check for low bandwidth; this cannot occur.

Fixed random range to not be so biased toward clamping to the max bw.
2014-10-23 11:32:15 -04:00
Jon Szymaniak
073bd463b3 libbladeRF/tests: Fixed dead code (CID1232253), fixed samplerate range
Removed unnecessary check for low sample rate; this cannot occur.

Fixed the random range to not be so biased toward clamping to the max
sample rate.
2014-10-23 11:22:50 -04:00
Jon Szymaniak
30aab0e684 hdl: Print MD5 & SHA256 checksums of FPGA images at the end of the build 2014-10-22 17:22:12 -04:00
Jon Szymaniak
47a971a32c hdl, libbladeRF: Bumped FPGA version to v0.1.1 for SPI timing fix fpga_v0.1.1 2014-10-22 17:22:12 -04:00
Brian Padalino
9c0bbfe61a hdl: Updating LMS SPI component.
Changing the LMS SPI component to have a clock phase/polarity of
[0,0] instead of [1,1], modifying the SDC to constrain the interface
which was done by mistake and caused timing errors and missed bits.

Also increasing the SCLK frequency to 40MHz.
2014-10-22 17:22:12 -04:00
Jon Szymaniak
97a44f94e4 cmake: Explicitly link libusb at runtime for version check in Windows
FindLibUSB.cmake presents issues with its try_compile() invocation
when using some dated CMake versions, such as 2.8.7 and 2.8.11, while
operating fine with more recent versions (e.g., 2.8.12.2, 3.0.0).

Using try_run() is a cleaner solution than a combination of try_compile() and
execute_process(). However, in Windows we need to stage libusb-1.0.dll in the
directory containing the resulting libusb_version.exe. As try_run() creates a
a temporary build directory and deletes it when done, this originally
posed a challenge to copying libusb-1.0.dll to the correct directory.

To address both of these challenges, the Windows version of this program now
explicitly links libusb at runtime, provided the path to the libusb DLL.

OSX and Linux variants assume libusb is in the library path, and link against
the library at compile-time.
2014-10-22 02:54:15 -04:00
Brian Padalino
8b8997c35a hdl: Adding handshake to list of required source. 2014-10-21 22:02:24 -04:00
Jon Szymaniak
72c64badf4 libbladeRF: Clarified "new version detected" version messages
Instructing the users to notify developers isn't helpful if the user is
simply on an older libbladeRF version. These messages have been changed
to just describe the situation.

These are now also INFO rather than WARNING to be less obnoxious in
cases where users are already aware of the situation and know that
their FPGA/Firmware is compatible, but cannot update libbladeRF.
(For example, they're running a live image and want some FPGA fixes.)
2014-10-21 08:01:30 -04:00
Jon Szymaniak
9cbebe86a8 libbladeRF: Fixed CMakeLists.txt regression (enabling sync verbosity)
ENABLE_LIBBLADERF_SYNC is no longer used, as this interface is now
always present. Since this CMake variable is no longer set, this was
preventing ENABLE_LIBBLADERF_SYNC_LOG_VERBOSE from taking effect.
2014-10-21 08:01:29 -04:00
Jon Szymaniak
d88ab63917 libbladeRF: Made enumeration value references Doxygen links 2014-10-21 08:01:29 -04:00
Jon Szymaniak
f7a4345257 libbladeRF: Added more complete examples for the synchronous interface
The existing bladerf_sync_rx() snippet in the libbladeRF API docs has
been replaced by a more complete snippet in libbladeRF/doc/examples.

From now on, major snippets and examples to be included in
Doxygen-generated documentation shall now be placed in the
libbladeRF/doc/examples directory, and must be buildable and testable.

The Doxygen "snippet" command to shall be used to include the relevant
code from the example program.

libbladeRF: [WIP] Use a simple delay to wait for TX samples in example
2014-10-21 08:01:28 -04:00
Jon Szymaniak
fbe0b6a81e libbladeRF: Introduced timestamp metadata support for sync data i/f
API support for timestamp metadata has been introduced. This is made
available when using the newly introduced BLADERF_FORMAT_SC16_Q11_META
format value.

When using the synchronous interface, metadata is exchanged between the
caller and the API via the updated bladerf_metadata structure. Users of
the asynchronous interface must currently manually manage the metadata
headers as desired, as documented in libbladeRF.h.

When using the BLADERF_FORMAT_SC16_Q11_META format in conjunction with
the synchronous interface, it is possible to retrieve the timestamp for
received samples and an indication of overrun.  An RX operation may also
be scheduled for at a specific timestamp value the future.  Similarly,
bursts of samples can be scheduled to be transmitted at a specific
timestamp value, or at the first available timestamp ("now").
2014-10-21 08:01:28 -04:00
Jon Szymaniak
5774aa0ad6 libbladeRF: Added API definition for FPGA counter mode enable bit 2014-10-21 11:07:38 -04:00
Jon Szymaniak
de761af50b libbladeRF: Updated outdated comments
The situation has changed since thread-safety changes in 7b0cc24f.
2014-10-21 11:07:38 -04:00
Jon Szymaniak
da19ed24d0 libbladeRF: Removed SC16_Q12 reverse compat macro
This has been scheduled for removal since RC1 and RC2.
2014-10-21 11:07:38 -04:00
Jon Szymaniak
58fc84105c hdl, libbladeRF: Bumped FPGA version to v0.1.0 fpga_v0.1.0
Minor revision bumped to denote the addition of backwards-compatible
features:
    - Added divide-by-two option for sample counter
    - TX_NOW operation
2014-10-21 11:07:38 -04:00
Brian Padalino
36e37dfd11 hdl: Keeping contnuity of RX samples.
During an RX sample overflow, keeping the metadata timestamp and
the sample stream in-sync with each other.
2014-10-21 10:54:35 -04:00
Brian Padalino
54f239a968 hdl: Sending a few more samples when first enabled
Helps mitigate the high default output power from the LMS after
initialization of the device.  The observed time appears <200us.
2014-10-21 10:54:35 -04:00
Brian Padalino
d6caa95e20 hdl: Adding TX NOW and RX metadata gating.
Adding a zero sample to the beginning of the burst tests so initial
power out from the LMS is minimized.

I tried adding a single sample to the DAC output but it didn't seem
to want to work appropriately, so there is around 700us worth of output
power after an initial boot of the board and loading of the FPGA.
2014-10-21 10:54:35 -04:00
Brian Padalino
ebde6e1aa7 hdl: Making some timestamp changes. 2014-10-21 10:54:35 -04:00
Brian Padalino
f1071345b3 hdl: Fixed timing issue in time_tamer.vhd
Some bits of the timestamp values were reading out incorrectly.
Registered the output on the rising edge of the clock to address this.
2014-10-21 10:54:35 -04:00
Brian Padalino
281bb96d47 hdl: Fixed timestamp readback.
Inserted an appropriate handshake to the time_tamer module for reading
back the current timestamp of either the TX or RX timestamp.
2014-10-21 10:54:35 -04:00
Brian Padalino
6ed8428570 hdl: Added option to divide sample counter by two
The sample counter increments once per I and once per Q. However,
the host side will want timestamps that increment once per entire
sample.
2014-10-21 10:45:03 -04:00
Jon Szymaniak
3c48b55645 libbladeRF: Added additional elaboration to SC16Q11 format 2014-10-21 10:45:03 -04:00
modustollens
35e5a6ee06 hdl: Added ATSC TX FPGA implementation
This revision introduces an FPGA-based ATSC transmitter to offload the
pilot insertion, filtering, and shift to baseband.

This design expects that 4-bit ATSC symbols are written to the device in
little-endian 32-bit words, as shown below.

        |<-------                               32 Bit Word                                     ------->|
Bit     |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|09|08|07|06|05|04|03|02|01|00|
Symbol  [ X|   7    ][X|  6     ][X|   5    ][X|    4   ][X|   3   ][X|   2     ][X|    1   ][X|    0   ]

The FPGA transmits Symbol 0 first, and Symbol 7 last. The three
least-significant bits in each symbol's nibble contain values 0 to 7,
mapping to values of -7 to 7, with the most-significant bit left unused.

This FPGA image may be built by specifying the "atsc_tx" image to the
build_bladerf.sh script. The resulting output files will be
atsc_txx40.rbf and atsc_txx115.rbf for the x40 and the x115,
respectively.

Transmitting a pre-made stream on channel 14-1 can be achieved with the
following commands in the bladeRF-cli:

    set frequency 473000000
    set samplerate 32286713 2867 10000

    set txvga1 -4
    set txvga2 20

    tx config file=<path to file> repeat=0 delay=0
    tx start
2014-10-17 18:24:54 -04:00
Jon Szymaniak
dfa9f51a6f libbladeRF: Added CMake variable to disable USB timeouts
When debugging the FX3, NIOS, or FPGA, it's helpful if the host
side isn't constantly timing out. These can be disabled by defining:

    LIBBLADERF_DISABLE_USB_TIMEOUTS=Yes
2014-10-16 16:56:45 -04:00
Jon Szymaniak
6bb85a629f bladeRF-cli: return CLI_RET_* codes from calibrate_dc()
The caller in calibrate.c expects CLI return codes, not libbladeRF
return codes.
2014-10-16 15:46:26 -04:00
Jon Szymaniak
34151f6e71 host: Added a config-time libusb version check and errors/warnings
FindLibUSB.cmake now fetches the libusb version via libusb_get_version()
so that we can warn (or error out) about the system containing an
outdated libusb version.

The following policies have been based upon support experiences and the
libusb changelog:

    Windows: Error out for libusb < 1.0.19
        v1.0.19 provides Windows 8 SuperSpeed detection support,
        and appears to address a number of issues bladeRF users
        have reported with v1.0.18 and earlier.

        We force users to update here, given that some of the failures
        on earlier versions were yielding corrupted samples.

    OSX: Warn for libusb < 1.0.18:
        v1.0.16 - v1.0.18 introduced SuperSpeed and 64-bit support,
        as well as fixes for compile-time and run-time issues.

    Linux: Warn for libusb < 1.0.16:
        This is largely based upon feedback from bladeRF users. While
        older versions may work, a number of users reported that issues
        appeared to be resolved after updating libusb to >= 1.0.16.
        (It isn't always clear if the reported update included Linux
         distro upgrades that included kernel updates.)

The version check may be skipped via LIBUSB_SKIP_VERSION_CHECK=Yes.
This is intentionally not noted in the warnings/errors, as it's
preferred that users update libusb rather than just skip the check.
2014-10-15 20:06:53 -04:00
Jon Szymaniak
695c095fb5 bladeRF-cli: Launch RX/TX tasks only when handling input
There's no point in starting these threads up if we're performing
operations from command line flags that will cause the program to
exit, rather than enter the main input loop, which may execute
the rx or tx commands.
2014-10-15 12:33:14 -04:00
Jon Szymaniak
9e465cc427 libbladeRF: Workaround for deadlock condition
This is a workaround for issue (#324).

We appear to have a lock ordering issue with our stream->lock and the underlying
libusb event lock.  When a libusb event occurs, it acquires its event lock and
then our callback acquires a stream lock.  When we asynchronously submit a
transfer, we acquire the stream lock and then libusb acquires its event lock
under the hood. If a callback occurs while we're submitting a transfer on the
same stream, deadlock ensues, due to the above asymmetry in lock acquisition.

Ultimately, we'll need to review our locking scheme and libusb event handle to
address underlying design issues here, and potentially trim some fat.

For now, the lock is just dropped after all metadata has already been updated,
and reacquired after submission.
2014-10-15 12:33:14 -04:00
Jon Szymaniak
6344e20363 bladeRF-cli: Remove duplicate message from probe when no device is found 2014-10-15 11:09:46 -04:00
Jon Szymaniak
fd093a80b9 bladeRF-cli: Added brief summary of how to add new commands 2014-10-15 11:09:46 -04:00
Jon Szymaniak
6fc039e83f bladeRF-cli: Matched mimo cmd usage to help text, status code cleanup
The help text reports the usage of the mimo command to be:
    mimo [master | slave]

Since there was no alternative to argv[1] being anything other than "clk"
this was dropped so the invocation matches the help text.

If an error occurred, this command was returning a libbladeRF status
code directly, instead of returning a CLI_RET code. This has been fixed.
2014-10-15 11:09:46 -04:00
Jon Szymaniak
e4fb53ae99 bladeRF-cli: Made output formatting more consistent
The preferred output format for commands is a leading newline, content
indented two spaces, and a trailing newline. Sub-levels should be
indented an additional two spaces.

Example:

bladeRF> my_cmd arg1 arg2

  Info1: Something about arg1
  Info2: Something about arg2
    Subinfo 1: abc
    Subinfo 2: xyz

bladeRF> my_cmd badarg arg2

  Error: Message about badarg

bladeRF>
2014-10-15 11:09:46 -04:00
Jon Szymaniak
f8a6b912ef libbladeRF: Check for BLADERF_FORCE_NO_FPGA_PRESENT environment variable
Setting this environment variable forces libbladeRF to always report
that no FPGA is loaded, rather than query the device.

This is intended for debugging and to provide a workaround for
issue #327, where users with a pre-v0.0.1 FPGA being autoloaded from SPI
flash are unable to open a device handle because the FPGA does not
supply a version number (which is now required by libbladeRF).
2014-10-14 16:57:41 -04:00
Jon Szymaniak
e0b5f9289f cmake: Fixed 'make uninstall' issue (#314)
This addresses an error where 'make uninstall' would fail with:

    CMake Error at cmake_uninstall.cmake:4 (message):
        Cannot find install manifest:
        "<path>/build/host/install_manifest.txt".

The problem was that using CMAKE_CURRENT_BINARY_DIR in
cmake_uninstall.cmake wasn't really appropriate in our particular case,
as the "current" directory would be host/ once CMake dove into that
subdirectory.  This has been changed to CMAKE_BINARY_DIR to ensure
we're reference the top-level of the build.
2014-10-13 18:15:50 -04:00
Jon Szymaniak
21c844a15f host: Updated README.md
Updated backend flags and removed items from ee618d3e1.

Added additional Windows build information and the availability
of the Cypress backend.
2014-10-13 15:09:53 -04:00
Jon Szymaniak
0d74ca353b libbladeRF: Updated README.md
Added new backend option, removed documentation for items removed
in commit ee618d3e1.
2014-10-13 14:08:46 -04:00
Jon Szymaniak
7767c9756a cmake: Set FX3 SDK path variable's default value from environment variable
The FX3 SDK installer creates the FX3_INSTALL_PATH variable, so there's
no need to hardcode a default path.
2014-10-13 09:55:31 -04:00
Jon Szymaniak
a02a2ec37a libbladeRF: Minor touch-ups in libusb backend
Removed switch() on sample format and replaced it with a call to the
new async_stream_buf_bytes(). This will become more relevant in upcoming
changesets when new formats are added.

Other changes are just aesthetic house-cleaning items. Shortening some
lines and long variable names.
2014-10-12 22:48:01 -04:00
Jon Szymaniak
ee618d3e13 libbladeRF: Updated default backend selections, remove unused items
The libusb and Cypress backends are now defaulted to ON if they are
detected on the system, and OFF otherwise.

The deprecated Linux kernel driver option has been removed. It will
be re-added if and when this code is updated/rewritten.

The "detach kernel module" libusb option has been removed, as it was
unused anyway.
2014-10-12 18:14:08 -04:00
Jon Szymaniak
4e1077e8fc libbladeRF: Don't fail out of probe/open if device can't be opened
libusb appears to return a "not supported" error if a device is currently
associated with a different driver, such as CyUSB3.

We'll want to continue looking for libusb devices rather than bail out
if we encounter this error, as we may have hit a device belonging to
our CyUSB backend
2014-10-12 18:13:10 -04:00
Jon Szymaniak
481e460d85 bladeRF-cli: Updated backend names reported by info/probe 2014-10-12 21:55:26 -04:00
Jon Szymaniak
0b7f43712c libbladeRF: Added support for Cypress Windows Driver & API backend
A USB backend based atop of the Cypress CyAPI (which is based atop the
Cypress CyUSB3 driver) has been introduced. This is intended to provide
Windows users with an additional driver to use if they encounter issues
with their USB host controller and libusb.

To build and use this backend, the Cypress FX3 SDK must be installed and
the following CMake flags should be provided:
    -DENABLE_BACKEND_CYAPI=Yes -DFX3_SDK_PATH=<path to SDK>

A modified cyusb3.inf is provided in host/drivers/windows/cyusb3. Upon
performing a build this inf file and the associated driver files from
the FX3 SDK will be copied into the "output" directory along with the
bladeRF.dll and bladeRF-cli.exe. To install the driver, point the
Windows driver update to this location and accept the warning about the
driver being unsigned; this occurs because the Cypress driver wasn't
signed with bladeRF VID/PID values.

The libbladeRF device string for this backend is: "cypress"

Many thanks go out to LazyDodo for all his efforts in spearheading the
development of this backend -- much of this code is either his doing or
is directly based upon his efforts.
2014-10-12 21:55:26 -04:00