Commit graph

92 commits

Author SHA1 Message Date
Ryan Thompson
da14b08f5c libbladeRF: OVERSAMPLE and DEFAULT sample rate guards implemented
Setting the sample rate will now check with the currently enabled 
feature. It tests if the sample rate is possible like before
and then checks if the currently enabled feature allows it.
2023-02-13 03:28:19 -08:00
Ryan Thompson
8903adb0ea libbladeRF: set samplerate OC compensation moved to libbladeRF
libbladeRF now halves the sent sample rate when OVERSAMPLE feature
is enabled. This is necessary as the AD9361 is not self aware of its
overclock but libbladeRF is.
2023-02-13 03:28:19 -08:00
Robert Ghilduta
27709317fc hdl: add Wishbone master IP NiOS peripheral 2022-04-03 19:39:10 -07:00
Robert Ghilduta
3b4f42dee4 Revert "ad936x_params: allow CTRL_IN to control gain in MGC mode"
This reverts commit a9712e73e8.
2021-02-06 17:38:56 -08:00
Robert Ghilduta
726a4b8d34 ad963x_params: add RFIC fast AGC settings 2020-11-23 19:27:47 -08:00
Robert Ghilduta
a9712e73e8 ad936x_params: allow CTRL_IN to control gain in MGC mode 2020-11-23 00:59:27 -08:00
Robert Ghilduta
93e80f8c80 fpga_common: avoid declarations if BLADERF_NIOS_BUILD is set 2019-12-18 15:55:53 -08:00
Robert Ghilduta
994b19a73e Revert "fpga_common: make the bladeRF2 default gain mode manual"
This reverts commit a739a73096.
2019-08-21 02:05:10 -07:00
Robert Ghilduta
553335bb10 bladeRF2: update RX parameters
To align RX1 and RX2, flip RX2 phase inversion
2019-08-21 02:04:24 -07:00
Robert Ghilduta
a739a73096 fpga_common: make the bladeRF2 default gain mode manual 2019-05-05 02:06:01 -07:00
Robert Ghilduta
0aca485ad0 libbladeRF: hdl: allow quicktune to control XB gpio register
This commit uses the reserved field of the pkt_retune NiOS packet to encode
xb_gpio register configuration data.
2019-04-02 01:59:55 -07:00
Rey Tucker
3eb52ea834 fpga_common: ad936x.h: remove unused struct member
This is not present in ad9361_api.h, removing to avoid conflicts...
2018-12-21 15:09:08 -05:00
Rey Tucker
8fa6c84856 fpga_common: ad936x.h: sync with adi's structs 2018-12-17 20:28:07 -05:00
Rey Tucker
54fefeb7ac fpga_common: defines and enums for FPGA RFIC control 2018-12-12 16:42:52 -05:00
Rey Tucker
3cdf9419ca hdl: nios/devices_rfic: fix gainmode setting
Somehow, bladerf2_rfic_init_params.gc_rx1_mode is being set to 0,
causing BLADERF_GAIN_DEFAULT to default to MGC.

This also reduces image size by removing dependency on a couple
functions, and pruning gainmode down to uint8_t.
2018-12-12 14:22:07 -05:00
Rey Tucker
f2c24d2872 fpga_common: assign user-defined space in bladerf_rfic_command 2018-12-11 12:17:55 -05:00
Rey Tucker
4e96014457 fpga_common: define bladerf_rfic_init_state enum 2018-12-06 14:45:24 -05:00
Rey Tucker
8a590e8e0b fpga_common: add BLADERF_RFIC_COMMAND_FASTLOCK 2018-12-06 14:45:24 -05:00
Rey Tucker
57b9970421 fpga_common: nios: NIOS_PKT_16x64_TARGET_RFIC definition
fpga_common: nios: stub out NIOS_PKT_16x64_TARGET_RFIC

fpga_common: add a status register for RFIC control

fpga_common: add 16x64 RFIC status register bit

fpga_common: add NIOS_PKT_16x64_RFIC_TXMUTE target addr

fpga_common: add RSSI readback shifts/masks

fpga_common: clean up old RFIC cmd defines from pkt_16x64

fpga_common: only build bladerf2_common if required
2018-12-06 14:45:24 -05:00
Rey Tucker
caf3497d7f fpga_common: ad936x_helpers: omit on non-libad936x Nios builds 2018-12-06 14:45:24 -05:00
Rey Tucker
a20fd82aca fpga_common: lms.c: fix up vtune_str ifdefs
we also need this if BLADERF_NIOS_DEBUG is enabled
2018-12-06 14:45:24 -05:00
Rey Tucker
79b936a811 fpga_common: ad936x_helpers: fix for loop initial declaration 2018-11-26 18:03:45 -05:00
Rey Tucker
05f7fd571a host: refactoring bladerf2.c
General documentation cleanup, function name adjustments, merging of
redundant structures, etc.

fpga_common/ad936x_helpers:
    Contains wrappers for AD936x RFIC functionality.

fpga_common/bladerf2_common:
    Contains bladeRF2-specific helper functions and constants.

fpga_common/ad936x_params:
    Reformat (no more tabs, phew)

    Move ina219 shunt const to bladerf2_common

host/common/range:
    Move functions and macros for handling bladerf_range structs

../libbladeRF/include/bladeRF2.h:
    Explicitly index RX/TX FIR enums

    Update references to ad936x_params.c

../libbladeRF/src/board/bladerf2/common:
    New macros for boilerplate:
        - WITH_MUTEX: wrap around locked blocks
        - CHECK_STATUS: calls function, checks return code
        - CHECK_AD936X: calls function, checks return code, translates
          from AD936x to libbladeRF error codes
        - CHECK_*_LOCKED: above, but unlocks mutex before erroring
        - NULL_CHECK: checks a var for null

    Move helper functions into here

../libbladeRF/src/board/bladerf2/bladerf2.c:
    Use new macros

    Code style fixes

    Remove redundant code
2018-11-26 18:03:45 -05:00
Rey Tucker
1c09cad506 host: bladerf2: use higher-level fns for ad936x TX atten
ad9361_api.h already has good functions for handling TX
attenuation, so use those instead.
2018-11-26 18:03:45 -05:00
Rey Tucker
7939453551 host/fpga_common/thirdparty: move ad936x.h, params.c, config.h
Move these files into more common places, so they can be
used from the FPGA side of the world as well.
2018-11-26 18:03:45 -05:00
Brian Glod
4d9cc217f9 nios: add fast lock save via 8x32 packet ID 0x05
When an 8x32 packet is received with target ID 0x05, the
ad9361_fastlock_save() function is executed. The packet requires an
address to be specified, which is used to determine whether the
operation is for the RX or TX module. Valid addresses are:

  0x00  : receive module
  0x01  : transmit module
  others: do not use, but would be passed to the receive module
2018-11-26 16:03:46 -05:00
Brian Glod
28ea59c83b fpga_common: add retune2 Nios packet format
This is the retune packet for use with bladeRF2 devices.
2018-11-26 16:03:46 -05:00
Rey Tucker
146215e2f3 fpga_common: lms.h: check return val in lms_set_frequency (fixes #691)
If lms_calculate_tuning_params is unsuccessful, then
lms_set_precalculated_frequency is called with an uninitialized
lms_freq struct.
2018-11-12 17:20:33 -05:00
Vanya A. Sergeev
ca0dc6b348 fpga_common: fix overrun in 16x64 NIOS II packet packing 2017-12-21 12:54:57 -05:00
Robert Ghilduta
026e4d11f6 Add INA219 FPGA read/write elements 2017-12-21 12:54:56 -05:00
Robert Ghilduta
b8719317b2 Add ADI AXI FPGA read/write elements 2017-12-21 12:54:56 -05:00
Brian Glod
85b0af2b88 bladerf-micro: nios: Connect ADF400x to 8x32 target 2017-12-21 12:54:55 -05:00
Brian Glod
134d061c2f bladerf-micro: nios: Connect AD5621 to 8x16 packet 2017-12-21 12:54:55 -05:00
Brian Glod
b235397036 bladerf-micro: nios: Add NIOS_PKT_8x32_TARGET_RFFE_CSR
This new 8x32 target is for a 32-bit GPIO for controlling RFFE
signals. Examples include TX/RX band selection switches, resets, and
readback of status outputs.

New default is such that AD9361 is held in reset and not enabled. The
host will have to deassert reset and assert the enable signal before the
AD9361 can be configured.
2017-12-21 12:54:55 -05:00
Brian Glod
088f455277 libbladeRF: Add BLADERF_NIOS_BUILD functions 2017-12-21 12:54:55 -05:00
Vanya A. Sergeev
604337d7d6 fpga_common: add 16x64 NIOS II packet format 2017-12-15 18:15:56 -05:00
Vanya A. Sergeev
562243c80d libbladeRF: refactor codebase for multi-board support
Includes fixups for clean rebase atop bladeRF commit 8b420eb
2017-12-15 18:15:06 -05:00
Robert Ghilduta
d8aa462e6a add libbladeRF and bladeRF-cli support for setting AGC DC correction LUT 2017-07-05 08:58:53 -07:00
Jan Dohl
0d765b70ab fpga_common: Added 8x8 packet IDs RX & TX trigger control packets 2016-05-08 23:17:05 -04:00
Jon Szymaniak
ccce423cff libbladeRF: Added BLADERF_MODULE_INVALID enumeration value 2015-12-28 22:20:20 -05:00
Jon Szymaniak
6cf29edca5 lms: Use internal termination when running calibration routines
In terms of avoiding interference from external signals, the
internal termination may be a better option than exposing the
signal path to external pads.
2015-12-28 16:10:39 -05:00
Jon Szymaniak
9cdfbedd5d libbladeRF: Adding VCTCXO tamer mode selection support 2015-12-14 15:29:59 -05:00
Jon Szymaniak
77b8e019f4 nios: Added VCTCXO tamer mode access via 8x8 packet ID 0x02 2015-12-14 15:29:59 -05:00
Jon Szymaniak
859377326b nios, lms, libbladeRF: Utilize FPGA support for atomic NINT/NFRAC write
Both the host and NIOS II FPGA retuning modes now make use of
FPGA v0.4.0's atomic write of the LMS6002D NINT and NFRAC PLL registers.

This helps avoid changing the PLL multiple times when attempting to
configure it.
2015-08-27 15:54:25 -04:00
Jon Szymaniak
d0f8af8d8e lms: Adjusted debug/warning level for tuning events 2015-08-25 13:28:05 -04:00
Jon Szymaniak
91b5c474da lms: Further relaxed VCO4 upper limit
We were still seeing some boards that wind up a bit too near the
upper edge of the VCO4 range. This change resolves this on the boards
we've tested.
2015-08-25 13:28:05 -04:00
Jon Szymaniak
df4a48fffd lms: Removed disabled code 2015-08-25 13:28:05 -04:00
Jon Szymaniak
a29bf54e78 lms: Account for long VTUNE transitions during HIGH<->LOW change
The cause of tuning failures in "FPGA tuning" mode is caused by
long VTUNE settling times when switching between the search for
VTUNE HIGH and VTUNE LOW.

We now try to force VTUNE to the opposite value and poll for the
expected change instead of simply delaying and hoping VTUNE
has settled before we sample it. If we don't hit the expected VTUNE
value, we'll attempt to walk VTUNE into that region.
2015-08-25 13:28:05 -04:00
Jon Szymaniak
d919a173be lms: Adjusted upper limit of VCO4 range
With the addition of a warning to the lms.c code, we've been seeing
some codes hit a max VCOCAP value before hitting a VCO limit, indicating
that we're too close to the edge of a band.
2015-08-25 13:28:05 -04:00
Jon Szymaniak
75e7793636 libbladeRF: Added bug catcher for CID 1308077
This addresses an item picked up by Coverity. Defects in bands[] or
frequency checks could potentially cause an out-of-bounds memory access.

A bounds check has been added to avoid an invalid access, should one of
the aforementioned defect ever creep in.
2015-08-12 15:50:00 -04:00