Commit graph

121 commits

Author SHA1 Message Date
Martin Braun
754813b0d6 rfnoc: image builder: Add clock index support to image builder
- Image core files can now provide timebase_clock and ctrl_clock fields
  to blocks, which will populate the backend interface accordingly.
- Clocks ports now have a direction associated (in, out).
2023-10-17 10:24:15 -05:00
Grant Meyerhoff
31bfb70dc8 usrpctl: add reset command 2023-08-04 19:42:57 -05:00
SaarthakMohanNI
41c0ab4d95 host/python: Update last_gain at end of run_rx_cal loop 2023-07-18 17:03:16 -05:00
Martin Braun
51c1a74eee examples: Amend tx_waveforms.py to use DramTransmitter
When calling tx_waveforms.py with the --dram option, it will internally
use DramTransmitter and first upload the signal before transmitting it
from DRAM.
2023-07-07 12:35:55 -07:00
Martin Braun
73fd6f8c0d python: Add 'const' to get_continuous_tone(); improve sanity-checks
- 'const' is now a valid waveform
- Fixes an issue with generating ramps and handling floating-point
  inputs
2023-07-07 12:35:55 -07:00
Martin Braun
c42cd3617c python: multi_usrp: Remove spurious print 2023-07-07 12:35:55 -07:00
Martin Braun
8c108418c9 python: Add DramTransmitter class
This class is a utility to more easily using an available replay block as
a transmitter.
2023-07-07 12:35:55 -07:00
Martin Braun
fc58ee343f python: Wrap direction_t 2023-06-29 09:39:47 -05:00
Martin Braun
2c057a37e9 python: signal: Add more waveforms to get_continuous_tone()
Still defaults to sine, can now also do square and ramp.
2023-06-28 10:45:39 -05:00
Wade Fife
e3794ba5ed python: Add X440 to image builder 2023-06-26 10:45:10 -05:00
Martin Braun
c385d20eee cmake: Fix auto-detection of Python install directory
This fixes an issue where on Ubuntu 22.04 (with Python 3.10), the
installation of the Python module would go to $PREFIX/local/lib even if
the rest goes to $PREFIX/lib. We achieve this by avoiding a) using
sysconfig.get_path() to get *both* the prefix and the library path, and
then also avoiding the `posix_local` install scheme.

Note: This same logic fails to work for MPM, so we don't touch that, but
simply force MPM to use the same path as UHD has. This means MPM is
unaffected when built by itself, but follows the UHD path when built as
part of UHD.

Hat-tip to Johannes Demel for pointing out this solution path.
2023-04-03 13:09:59 -07:00
Wade Fife
85f71cda7b rfnoc: Support multiple CHDR widths in RFNoC image builder
This adds support for different CHDR widths in the RFNoC image builder
and allows you to specify which crossbar paths to enable in the CHDR
crossbar.

In the HDL, a different CHDR width can be specified for each transport
adapter using Verilog parameters. In the RFNoC image YAML, the width of
each stream endpoint can be specified using the chdr_width parameter,
and the width for all blocks can be specified using the
block_chdr_width parameter.

With this change, the existing top-level "chdr_width" setting is now
effectively the default when not otherwise specified.

The crossbar_routes parameter can be provided using an NxN array where
N is the number of transport adapters + stream endpoints for the image
being built. For example, on X310 the following could be used:

crossbar_routes:
  #  eth0  pcie  ep1   ep3   ep5
  #     eth1  ep0   ep2   ep4
  - [ 1, 0, 0, 1, 1, 1, 1, 1, 1 ] # eth0 (10/1 GbE/Aurora)
  - [ 0, 1, 0, 1, 1, 1, 1, 1, 1 ] # eth1 (10 GbE/Aurora)
  - [ 0, 0, 1, 1, 1, 1, 1, 1, 1 ] # pcie
  - [ 1, 1, 1, 0, 0, 0, 0, 1, 1 ] # ep0 (radio0.0)
  - [ 1, 1, 1, 0, 0, 0, 0, 1, 1 ] # ep1 (radio0.1)
  - [ 1, 1, 1, 0, 0, 0, 0, 1, 1 ] # ep2 (radio1.0)
  - [ 1, 1, 1, 0, 0, 0, 0, 1, 1 ] # ep3 (radio1.1)
  - [ 1, 1, 1, 1, 1, 1, 1, 0, 0 ] # ep4 (replay0.0)
  - [ 1, 1, 1, 1, 1, 1, 1, 0, 0 ] # ep5 (replay0.1)

This would disable loopback paths between transport adapters, between
radio ports, and between replay ports.

Note that these features should be used with care. Removing some
crossbar routes may prevent the USRP from functioning correctly.
Specifying improper CHDR widths may lead to streaming issues.
2023-02-24 08:07:17 -06:00
Wade Fife
79eb470a93 rfnoc: Add options for RFNoC image core headers
This adds options to rfnoc_image_builder to make optional the fields of
the header in the generated RFNoC image core files. This includes the
copyright, license, date/time of generation, and source hash.
2023-02-22 21:55:02 -06:00
Wade Fife
d556d92f8f rfnoc: Set DEVICE_FAMILY on stream endpoints 2023-02-13 10:50:45 -06:00
David Raeman
51d4411ec1 e3xx: add support for power calibration api
This commit adds support for the UHD power calibration API on the E3xx
family of radios. It also updates the documentation to reflect this
support, and it adds support to the uhd_power_cal.py utility by adding a
"calibrator" subclass for E3xx radios.
2023-01-17 11:30:53 -08:00
Martin Braun
f14ce015b9 uhd: python: Bind {separate,combine}_device_addr{s}
This adds two functions from C++ land into Python:

- uhd.types.separate_device_addr()
- uhd.types.combine_device_addrs()

Signed-off-by: Martin Braun <martin.braun@ettus.com>
2022-10-28 10:15:20 -05:00
Martin Braun
e62a92793d fixup! mpm: Add CompatNumber utility class
The original commit did not add the compat_num.py file to the
CMakeLists.txt file. This would only be a problem when re-running
CMake with a different branch.
2022-07-20 17:08:33 -05:00
mattprost
f6101fb07d python: cmake: Detect python virtual environments
This allows a UHD build to link to python modules installed in a virtual
environment such a venv or pyenv.

Signed-off-by: mattprost <matt.prost@ni.com>
2022-06-23 05:57:12 -07:00
Wade Fife
ff8212ca84 python: Check rfnoc_version in rfnoc_image_builder 2022-05-11 12:29:35 -07:00
Wade Fife
c1f1f32d0b rfnoc: Update image builder to check for deprecated blocks
Adds checks for deprecated blocks (e.g., radio_1x64.yml instead of
radio.yml) as well as deprecated IO signature types (e.g., ctrl_port
instead of ctrlport).

Deprecated block descriptions are no longer parsed. Old IO signature
types are automatically converted to the new type. Warnings are
printed in both cases.
2022-04-12 13:31:19 -07:00
mattprost
b8acf58798 n310: Add Filter API to n310
Add the Filter API to n3xx specifically for the AD937x device.  The TX
filter is limited to 32 taps, and the RX filter is limited to 48 taps.

This feature requires MPM version 4.2 or later on the device.

Co-authored-by: bpadalino <bpadalino@gmail.com>
Signed-off-by: mattprost <matt.prost@ni.com>
2022-04-07 13:28:02 -07:00
mattprost
0cf8a60a4e types: filters: Add python support for digital filters
Signed-off-by: mattprost <matt.prost@ni.com>
2022-04-07 13:28:02 -07:00
Wade Fife
246b725195 rfnoc: Update image builder to check for deprecated port names 2022-03-31 13:51:23 -07:00
Lars Amsel
99ad89609b tools: Add general purpose tool for USRP configuration
Over the years the UHD code base got a whole bunch of tools to
control and configure devices. This is an attempt to unify these
tools into one.

Co-authored-by: Alexander Weber <alexander.weber@ni.com>
2022-03-23 16:27:04 -05:00
Martin Braun
850ff3b2bf python: Add __init__ to uhd.utils
Without this, the following code fails:

>>> import uhd
>>> U = uhd.usrp.MultiUSRP("type=x4xx")
>>> M = U.get_mpm_client()
Traceback (most recent call last):
  File "<input>", line 1, in <module>
    M = U.get_mpm_client()
  File ".../uhd/usrp/multi_usrp.py", line 37, in <lambda>
    setattr(self,
        'get_mpm_client', lambda: _get_mpm_client(token, mb_args))
  File ".../uhd/usrp/multi_usrp.py", line 19, in _get_mpm_client
    from uhd.utils import mpmtools
ModuleNotFoundError: No module named 'uhd.utils'
2022-03-14 15:50:57 -05:00
Martin Braun
bcdb8a1b8f python: rfnoc: Add connect_through_blocks() and get_block_chain()
These RFNoC C++ API calls were previously not exported into Python.
2022-02-24 13:39:56 -06:00
André Apitzsch
0db4d4124f python: Read number of ports from grc file in image builder 2022-02-24 13:33:22 -06:00
André Apitzsch
8b19791f37 python: Fix RuntimeError: dictionary changed size during iteration
Iterate over copy and delete from original dictionary.
2022-02-24 13:33:22 -06:00
Steven Koo
396ed0c8af fixup! cmake: Replace distutils.sysconfig with sysconfig
The original commit incorrectly fails the build
uhd in the meta-ettus context. This uses prefix
instead to get the base path.

Signed-off-by: Steven Koo <steven.koo@ni.com>
2022-01-20 08:31:50 -06:00
Aaron Rossetto
87bc7c1bde cmake: Replace distutils.sysconfig with sysconfig
This commit replaces uses of distutils.sysconfig's get_python_lib()
function with sysconfig's near-equivalent get_path() function to get the
directory for site-specific, platform-specific files. Unfortunately,
get_path() does not have a way to easily modify or strip the prefix
applied to the path like get_python_lib() does, so the code must
manually modify the path to get the same effect:

- First, the platlib path is retrieved from the get_path() call.
- Next, the default base that is used to form the pathlib path is
queried via the get_config_var('base') call.
- Next, the portion of the platlib path that matches the default base is
stripped, and any leading path separator remaining is stripped. This
fundamentally replicates the behavior of get_python_lib() with an empty
prefix (i.e., the prefix positional parameter is specified as '').
- If a different prefix is desired, then the os.path.join() function is
used to combine the new prefix with the stripped pathlib path, ensuring
that the platform-specific path separator is used in crafting the path.
2022-01-14 14:36:39 -06:00
Aaron Rossetto
6d746fd296 cmake: Replace distutils with CMake for version checks
This commit replaces the use of distutils.version.LooseVersion() with
CMake's version comparison operator, which implements relational version
string checking in the same manner (i.e., comparing numeric components
of a version string numerically).
2022-01-14 14:36:39 -06:00
Lars Amsel
9ad4bedd86 fixup! uhd: Allow pass raw IQ data array to tone generator 2022-01-13 14:32:31 -06:00
Lars Amsel
d33deb3cae uhd: Allow pass raw IQ data array to tone generator
Instead of calculating a tone from its parameter it is also useful
to pass an precalculated signal to be played. This change modifies
the __init__ to take an iq_data as parameter for the internal buffer
and moves the generation of the tone from rate, frequency and amplitude
into a class method. The streamer parameter was deleted (never used).
2022-01-10 13:31:44 -06:00
Lars Amsel
f59f3c2490 tools: Add check for SEP with ctrl enabled to rfnoc_image_builder
When creating RFNoC images at least one SEP needs to have ctrl enabled
otherwise one will end up with a non-functional image.

This commit adds a method to the image builder to do plausibility checks
on the configuration. The only check done for now is to verify that there
is at least one SEP with ctrl enabled.
2021-12-16 09:26:46 -06:00
Martin Braun
4e1068671f python: multi_usrp: Fix issues in send_waveform()
- Like with RX, this now allows passing in stream time and existing
  streamer
- There was no EOB being sent at the end (now there is)
- Fixed some linter issues
2021-10-06 11:57:25 -07:00
Martin Braun
9650342c12 python: multi_usrp: Fix issues with recv_num_samps()
- This function didn't set the time properly for multi-chan rx
- There was no way to set a start time manually
- It relied on garbage collection and correct destruction of streamers
  when being called multiple times. Addressed this by adding an option
  to pass in an existing streamer object.
- Linter wasn't too happy with this function.
2021-10-06 11:57:25 -07:00
Martin Braun
09d94529e5 cmake: Replace CMAKE_{SOURCE,BINARY}_DIR with UHD_*_DIR
See the CMake 3.8 documentation on these two variables:
https://cmake.org/cmake/help/v3.8/variable/PROJECT-NAME_SOURCE_DIR.html
https://cmake.org/cmake/help/v3.8/variable/CMAKE_SOURCE_DIR.html

Under normal circumstances, these two are identical. For sub-projects
(i.e., when building UHD as part of something else that is also a CMake
project), only the former is useful. There is no discernible downside of
using UHD_SOURCE_DIR over CMAKE_SOURCE_DIR.

This was changed using sed:

$ sed -i "s/CMAKE_SOURCE_DIR/UHD_SOURCE_DIR/g" \
    `ag -l CMAKE_SOURCE_DIR **/{CMakeLists.txt,*.cmake}`
$ sed -i "s/CMAKE_BINARY_DIR/UHD_BINARY_DIR/g" \
    `ag -l CMAKE_BINARY_DIR **/{CMakeLists.txt,*.cmake}`

At the same time, we also replace the CMake variable UHD_HOST_ROOT (used
in MPM) with UHD_SOURCE_DIR. There's no reason to have two variables
with the same meaning and different names, but more importantly, this
means that UHD_SOURCE_DIR is defined even in those cases where MPM calls
into CMake files from UHD without any additional patches.

Shoutout to GitHub user marcobergamin for bringing this up.
2021-09-10 15:08:10 -05:00
Wade Fife
3d7d5668fb rfnoc: Add vivado-path to rfnoc_image_builder
Adds a --vivado-path option to rfnoc_image_builder that, if present,
gets passed to setupenv.sh for the target device. This can be used to
specify the location of Vivado if it is not installed in one of the
default search locations.
2021-09-10 15:07:05 -05:00
Martin Braun
8708164ac8 cal: Add tune-settling time
This is a device-specific parameter to allow for the tune to settle
before proceeding with the calibration. On X410, we set this time to 500
ms. On other devices, we leave it at 0.
2021-06-24 12:05:49 -05:00
Lars Amsel
abcaa3f6a9 cal: ensure proper range handling
* frequency range adapts the lower limit to align with the step size
  the lower limit will be set to step size if it s smaller than the
  step size and not explicitly set. This prevents uneven measurment
  spots
* aranges upper limit is always increased by step size to ensure the
  upper limit is part of the range
* rearranged gain range calculation, create the range once and reverse
  it for RX
2021-06-23 13:57:15 -05:00
Lars Amsel
067411a352 cal: Remove silent capture of TypeError
Remove the silent capture of TypeError because it would also
catch TypeErrors is initilization errors in class creation. Instead
check obj to be a class first to ensure issubclass wont throw a
TypeError.
2021-06-23 13:57:15 -05:00
Lars Amsel
7efa398272 cal: add more error number for ADC overload
also added short comment which erro originates from which driver
2021-06-23 13:57:15 -05:00
Martin Braun
1ca9a45ff5 cal: Add support for X410 2021-06-23 13:57:15 -05:00
Lars Amsel
2a575bf9b5 uhd: Add support for the USRP X410
Co-authored-by: Lars Amsel <lars.amsel@ni.com>
Co-authored-by: Michael Auchter <michael.auchter@ni.com>
Co-authored-by: Martin Braun <martin.braun@ettus.com>
Co-authored-by: Paul Butler <paul.butler@ni.com>
Co-authored-by: Cristina Fuentes <cristina.fuentes-curiel@ni.com>
Co-authored-by: Humberto Jimenez <humberto.jimenez@ni.com>
Co-authored-by: Virendra Kakade <virendra.kakade@ni.com>
Co-authored-by: Lane Kolbly <lane.kolbly@ni.com>
Co-authored-by: Max Köhler <max.koehler@ni.com>
Co-authored-by: Andrew Lynch <andrew.lynch@ni.com>
Co-authored-by: Grant Meyerhoff <grant.meyerhoff@ni.com>
Co-authored-by: Ciro Nishiguchi <ciro.nishiguchi@ni.com>
Co-authored-by: Thomas Vogel <thomas.vogel@ni.com>
2021-06-10 12:01:53 -05:00
Martin Braun
4fd3bfe203 cal: Add min_freq and max_freq attributes to USRPCalibratorBase
These allow specifying a min/max frequency on a device basis, instead of
querying those from get_?x_freq_range(). The trouble with those methods
is, they include the tune range provided by DSP tuning, which is not
what we want for this calibration.
2021-06-10 08:12:45 -05:00
Martin Braun
a04e0c2d30 cal: Fix minor issues in the calibration utilities
- Whitespace issues
- Unclear help messages
- Unnecessary derive-from-object
2021-06-10 08:12:45 -05:00
Wade Fife
ca21048bd2 fpga: Change RFNoC YAML version numbers to strings
Change version from a numeric to a string, in order to
differentiate between versions like "1.1" and "1.10".
2021-06-08 15:48:59 -05:00
Lars Amsel
1f001f2c29 python: Add graceful exit of claim loop on SIGTERM 2021-06-03 09:34:20 -05:00
Wade Fife
4ac80a4312 rfnoc: Add image_core_name option to rfnoc_image_builder
This change adds the ability to specify in the YAML description for
your RFNoC image what the rfnoc_image_core should be named. This allows
you to have multiple RFNoC image cores generated for the same target.
2021-06-02 22:00:40 -07:00
Wade Fife
fcb44a0618 python: Add rfnoc_image_core.vh generation
This causes a header file, rfnoc_image_core.vh, to be generated along
with rfnoc_image_core.v so that parameters like the CHDR width can be
shared betweend RFNoC and the BSP.
2021-06-02 22:00:40 -07:00