Commit graph

2,710 commits

Author SHA1 Message Date
Rey Tucker
10d0f549b2
host: add bladerf_adf4002_{get,set}_refclk and related functionality (#15)
* host: libbladeRF: add functions to get/set ADF4002 refclk frequency

* host: bladeRF-cli: add print/set adf_refclk

* host: python: add adf4002_refclk functions

This permits getting and setting the ADF4002 reference clock
frequency.

>>> import bladerf
>>> b = bladerf.BladeRF()
ad9361_init : AD936x Rev 2 successfully initialized
>>> b.adf4002_refclk
10000000
>>> b.adf4002_refclk = 9000000
>>> b.adf4002_refclk
9000000
>>> b.adf4002_refclk = 900000000
[ERROR @
"/home/rtucker/dev/privatebladeRF/host/libraries/libbladeRF/src/board/bladerf2/bladerf2.c":4360]
bladerf_adf4002_set_refclk: bladerf_adf4002_calculate_ratio failed:
Provided parameter was out of the allowable range
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File
"/home/rtucker/dev/privatebladeRF/host/libraries/libbladeRF_bindings/python/bladerf.py",
line 1581, in set_adf4002_refclk
    _check_error(ret)
  File
"/home/rtucker/dev/privatebladeRF/host/libraries/libbladeRF_bindings/python/bladerf.py",
line 998, in _check_error
    raise globals()[errorval.name](err)
bladerf.RangeError: Provided parameter was out of the allowable range
>>> b.adf4002_refclk
9000000
>>> b.adf4002_refclk = 10000000
>>> b.adf4002_refclk
10000000

* host: libbladeRF: make ADF convenience functions static

bladerf_adf4002_set_refclk is much nicer (and safer) than calculating
the R/N ratio and then doing a bladerf_adf4002_configure.

* host: python: update cffi header block
2018-03-23 11:10:14 -04:00
Rey Tucker
dd622a646d hdl: fx3_gpif: fix off-by-one in metafifo handling
As written, the overrun bits were clobbering the timestamp MSW.  This
should fix everything up.
2018-03-22 18:42:40 -04:00
Rey Tucker
4cf79bc8c0 host: python: add RSSI readback for AD9361 2018-03-15 18:24:58 -04:00
Rey Tucker
585cb926bb host: bladeRF-cli: add 'print rssi' function 2018-03-15 18:24:58 -04:00
Rey Tucker
8898192015 host: libbladeRF/bladeRF2: add AD9361 RSSI access
Adds bladerf_ad9361_get_rssi() API call, to query the RSSIs from the
AD9361 RFIC.
2018-03-15 18:24:58 -04:00
Rey Tucker
06fb60f719 host: libbladeRF/bladeRF2: fix doxygen grouping for Si53304 2018-03-15 18:24:07 -04:00
Rey Tucker
677216dfd5 host: libbladeRF: fix dependencies for doxygen
It should rebuild on any .h change, not just libbladeRF.h
2018-03-15 18:24:07 -04:00
Rey Tucker
b2786e9ce2
host: libbladeRF-bindings/python: general updates (#11)
* host: libbladeRF-bindings/python: general updates

This commit adds the following changes:

Overall:
* Adds an _import_header.py tool, which parses libbladeRF.h (or other
  headers) into a convenient string ready for ffi.cdef
* Passes pycodestyle and pyflakes checks cleanly

bladerf.py:
* Various new class wrappers for enums, etc
* Subclassed exceptions (e.g. bladerf.UnsupportedError will be raised if
  libbladeRF returns BLADERF_ERR_UNSUPPORTED)
* Added functions for bootloader firmware recovery
* More comments all around
* Use properties instead of getters/setters:
   >>> b = bladerf.BladeRF()
   >>> # OLD:
   >>> b.get_devinfo()
   >>> b.set_clock_select(ClockSelect.External)
   >>> # NEW:
   >>> b.devinfo
   >>> b.clock_select = ClockSelect.External
* Added more functions, particularly for bladeRF 2
* Added a Channel class, for channel-specific properties:
   >>> b = bladerf.BladeRF()
   >>> ch = d.Channel(bladerf.CHANNEL_RX(0))
   >>> ch.frequency = 2.45e9

bladerf-tool.py:
* General changes to use properties instead of get_/set_ functions
* Also updated to use subclassed exceptions from bladerf.py
* Dump a lot more info with the 'info' command
* Look for bootloader devices with the 'probe' command
* Added 'recover_fw' command, for firmware recovery
* Moved from single-channel paradigm to MIMO paradigm on 'rx', 'tx'

* host: python: implement more methods, various fixes

Implement loopback, rx_mux, ad9361_temperature, and adf4002_* functions

Fix set_clock_select type handling

Use 4-space indent in cffi block, for placating text editors

Add -v option to bladerf-tool.py info, to clean things up a bit
2018-03-15 11:45:11 -04:00
Rey Tucker
eb9a7a313d
host: libbladeRF/bladerf2: Fix safety checks on board-specific functions (#10)
Some are missing, others are too noisy in practice. Uniformly return BLADERF_ERR_UNSUPPORTED.

* host: bladerf2: test for board support in bias_tee

* host: bladeRF2: be quieter on unsupported gain mode query

* host: bladerf2: check for compat on ina219 reads

* host: libbladeRF/bladerf2: fixup remaining board compat checks
2018-03-15 11:43:27 -04:00
Brian Glod
3d54be5937 host: bladeRF-cli: Add bladeRF2 clock_out command
Allow user to control whether to enable the external clock output (UFL
CLKOUT).
2018-03-09 13:04:38 -05:00
Brian Glod
22e90c763c host: libbladeRF: Clock output enable for bladeRF2
Add functinos to enable/disable the external clock output (UFL CLKOUT).
2018-03-09 13:04:38 -05:00
Brian Glod
6ae3419abf host: bladeRF-cli: Add bladeRF2 clock_sel command
Allow user to control which Si53304 clock input to select: onboard
VCTCXO or external UFL clock. The external clock must be present before
changing the active clock, otherwise the host connection to the bladeRF
will drop.
2018-03-09 12:50:51 -05:00
Brian Glod
2f4ec99c3d host: libbladeRF: Clock input select for bladeRF2
Si53304 clock input selection getter and setter functions.
2018-03-09 12:50:51 -05:00
Brian Glod
b6d8a415b2 hdl: bladeRF: Update suppressed messages
- Ignore tx_pilot being assigned but not read in atsc_tx.vhd
- Ignore warning 10542, using initial value expression for variable
2018-03-06 13:56:45 -05:00
Brian Glod
9f6c696442 hdl: bladeRF: Assign initial values to FIFO signals 2018-03-06 13:56:45 -05:00
Brian Glod
d9a237ca9c hdl: bladeRF: Clean up warnings atsc_tx 2018-03-06 13:56:45 -05:00
Brian Glod
4790d9261c hdl: bladeRF: Fix latches in DAC SPI process 2018-03-06 13:56:45 -05:00
Brian Glod
0d320fd53d host: bladeRF-cli: Add print_power_source function 2018-03-01 15:20:19 -05:00
Brian Glod
75bf9d0043 host: libbladeRF: Add power source accessor
Intended for use by bladeRF-micro, which has a TPS2115A auto power
mux. The function will read the power status bit from the Nios GPIO and
set the human-readable enum corresponding to the active power source.
2018-03-01 15:20:19 -05:00
Brian Glod
017b294a54 hdl: bladeRF-all: Change direction of Nios control PIO
Changed from "output" to "inout" to accept inputs. In this mode, the
GPIO has two independent buses, one for input, one for output. In order
to maintain previous behavior, which allowed the Nios to read the
current values being output, we must explicitly feed back the output bus
to the input bus.
2018-03-01 15:20:19 -05:00
Brian Glod
3b670ca799 hdl: bladeRF: nios_gpio_t, fifo_t, bladerf_p.vhd
Add bladerf_p.vhd package, which handles nios_gpio packing and unpacking
between bits and record elements. This consolidates bit-to-function
mapping, making it easier to modify the mapping in the future.

This package also defines the FIFO record types and the nios_system
component for easier re-use.
2018-03-01 15:20:19 -05:00
Rey Tucker
01cdbc78f5 host: libbladeRF: fix lock collision in load_fpga
Because we call bladerf*_initialize from within bladerf*_load_fpga, and
we then do things that do their own locking from within
bladerf*_initialize, problems ensue when loading FPGAs from bladeRF-cli.

This removes the lock from the greater load_fpga call, and moves it to
just around the dev->backend->load_fpga call.
2018-03-01 15:20:02 -05:00
Rey Tucker
21831477f1 host: libbladeRF: force AD9361 freq change on init
The EVM coming out of the AD9361 is about 1% worse than it should be,
when doing a TX directly after initialization.  However, by changing the
frequency and changing it back, the EVM returns to the expected level.

I suspect libad9361 is missing a calibration step somewhere in the
initialization, but we can work around this by doing two frequency
changes during initialization.
2018-03-01 15:18:28 -05:00
Brian Glod
a4681812ca ip: nuand/atsc_tx: Fix power-up/reset value mismatch 2018-02-22 15:57:32 -05:00
Brian Glod
9632450d40 hdl: build: Add build time output
Prints total time taken to build the FPGA image.
2018-02-16 18:45:48 -05:00
Brian Glod
37de987a36 hdl: build: Delete empty SOPC directories
Delete empty SOPC directories created by Quartus during IP core
generation. These empty directories are created in the user's home
directory and can accumulate if left unchecked. Use `find' with
approprate filters to (hopefully) avoid deleting anything important!
2018-02-16 13:29:23 -05:00
Brian Glod
c86fb65bff hdl: bladeRF-all: Rename lms_spi to rffe_spi
Quick change so that LMS references are not present in the bladeRF-micro
platform.
2018-02-14 18:14:07 -05:00
Brian Glod
3a71aee58a hdl: build: Add build flow support
Quartus supports different build flows. Adding support for that so that
a user can choose to simply generate the project files, run synthesis
only (e.g. to check syntax), or do the full place and route to generate
programming files.
2018-02-09 17:57:25 -05:00
Brian Glod
236a639021 hdl: build: Fix Quartus project revision parameter
The project revision option specified on the command line was not being
passed to the build Tcl file.

Changed handling of message suppression files. Filename should be the
same as the revision name. Instead of managing potentially several
identical or nearly identical .srf files, just manage the one and have
the build script rename it when copying it to the build directory.

Fixed references to the nios_system.qip file in bladerf-fsk_bridge.qip
and bladerf-qpsk_tx.qip.
2018-02-09 17:54:20 -05:00
Brian Glod
4faf3d172a hdl: build: Better checking for Quartus binaries
- Check for qsys-* binaries
- Check for nios2-* binaries

These binaries do not exist in the same directory as quartus_sh.
2018-02-09 17:42:06 -05:00
Brian Glod
3b5c432f0c hdl: build: getopts, help text
- Add "board" as a required option in help text
- The description of the SignalTap force option was vague.
- Added check for null argument.
- Do not print full usage information for an invalid option.
2018-02-09 17:37:38 -05:00
Brian Glod
8a162b337e hdl: build: Remove NiosII/s option
Beginning in Quartus 14.0, the NiosII processor split into two versions:
Classic and Gen 2. Development of new features for the Classic ceased in
Quartus 14.0. Nuand upgraded to the Gen 2 core for the release of the
bladeRF micro. The Gen 2 core does not have an option for the
Small (NiosII/s) implementation, so the option was removed from the
build script.

Nuand may add a NiosII/s approximation of the NiosII/f in the
future. This will happen quicker if we get requests to do so. :)
2018-02-09 13:01:27 -05:00
Brian Glod
a975f782e6 hdl: bladerf: Suppress fifo_reader null range warning
A null range in this function is expected for SISO platforms.
2018-02-07 20:04:16 -05:00
Brian Glod
c027a47697 hdl: ip/nuand: Fix edge detector reset value
Fixes presettable/clearable register to latch conversion warning 13004.
2018-02-07 20:02:55 -05:00
Brian Glod
0e74d15784 hdl: bladerf: Fix signal assignment warnings
Removed unused signals and fixed implicit defaults.
2018-02-07 19:37:56 -05:00
Brian Glod
b143190aae nios: Add agc_dc_corr_write() to devices.h
Add function declaration to devices.h
2018-02-07 18:16:45 -05:00
Brian Glod
3a5ec43b25 hdl: ip/nuand: Initialize sync output to RESET_LEVEL 2018-02-07 18:01:17 -05:00
Brian Glod
8692edff2e hdl: ip/nuand: Add async reset to sensitivity list 2018-02-07 17:27:50 -05:00
Brian Glod
e492403d7a hdl: ip/nuand: Add MIT License to pps_counter.vhd
This license should have been present from the start.
2018-02-07 17:25:30 -05:00
Brian Glod
e2876203c0 hdl: ip/nuand: Fix implicit default arbiter.vhd
The waitreq output port was never assigned a value.
2018-02-07 17:17:51 -05:00
Brian Glod
0be88bb868 hdl: build: Fix adding FPGA size to work dir name
This commit should be squashed into:

4f9a59aafd
  "hdl/build: Fix clearing of work directory"
2018-02-07 17:02:36 -05:00
Rey Tucker
a8cad99887 host: libbladeRF: harmonize get_gain_stage_range
Sync up bladerf_get_gain_stage_range between bladeRF 1 and bladeRF 2,
and let a null range argument be okay
2018-02-05 17:20:42 -05:00
Rey Tucker
f7f150fb49 host: libbladeRF: allow null range on bladerf_get_gain_stage_range()
In the event a library user needs to test for the existence of a gain
stage, the bladerf_get_gain_stage_range function may now be called with
a null range, and the return value can be checked to determine whether
it exists.
2018-02-05 16:49:57 -05:00
Rey Tucker
ac55b6edeb
host: libbladeRF: add per-device query of supported loopback modes
* host: libbladeRF: add bladerf_get_loopback_modes

Returns a pointer to an array of supported loopback modes.

* host: libbladeRF: add bladerf_is_loopback_mode_supported()

Tests if a given loopback mode is supported on a device
2018-02-05 16:34:14 -05:00
Rey Tucker
84e1b5d099 host: libbladeRF: use common macro for channel decoding 2018-02-05 15:35:28 -05:00
Rey Tucker
ee2c85d02a host: bladeRF-cli: refactor out str<->channel conversions 2018-02-05 15:35:28 -05:00
Rey Tucker
dab88815b1 host: libbladeRF: add BLADERF_CHANNEL_IS_TX() macro
Convenience macro that evals to true if the argument is a TX channel,
false otherwise.
2018-02-05 15:35:28 -05:00
Rey Tucker
14e7f317a2 host: common/conversions: add str2channel
Converts from a string to a bladerf_channel
2018-02-05 15:35:28 -05:00
Rey Tucker
b9db604801 host: common/conversions: add firmware and rf_bist loopback options 2018-02-05 15:35:28 -05:00
Brian Glod
5832522f68 hdl: ip/nuand: Move arbiter source files to .qip 2018-02-01 15:05:13 -05:00