Commit Graph

493 Commits

Author SHA1 Message Date
Virendra Kakade
d6608fc4d0 fixup! examples: L band capture example using dual rate 2023-11-02 08:30:45 -05:00
Virendra Kakade
33a869892f examples: L band capture example using dual rate
This example demonstrates the simultaneous capture of the entire L-band
which extends from 1 GHz to 2.4 GHz using one channel on each of the two
radios using the dual rate feature. This is supported ionly on the X440 device.
Read the comments in the example for details.

Does the following:
- Sets up connections in rfnoc graph
- Configures radios and dual replay blocks
- Synchronously captures data and streams to replay block
- Fetches data to host and plots a windowed FFT.
- Repeat.

Signed-off-by: Virendra Kakade <virendra.kakade@ni.com>
Co-authored-by: Martin Anderseck <martin.anderseck@ni.com>
2023-10-27 15:43:18 -05:00
Aki Tomita
261f6ec1df tests: fix when the rx cmd's stream_now is set 2023-08-24 19:59:44 -05:00
Martin Braun
ebd5dd03cf Apply clang-formatting to all C/C++ files
- Used clang-format version 14
- Ran ./tools/clang-formatter.sh apply
2023-08-07 15:35:56 -05:00
Saarthak Mohan
cc36b4e35d examples: Add power controls to rx_ascii_art_dft.cpp 2023-07-11 11:46:08 -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
e398d13d67 examples: Remove default --ref and --pps values
This changes the behaviour of the examples in a way that leaving
out the --ref argument will not force it to be 'internal'. Previously,
the following command:

    rx_samples_to_file --args type=xxx,clock_source=external

would still use the internal reference, because the default value for
--ref was internal, and no other value for --ref was provided. Even
worse, the following command:

    rx_samples_to_file --args \
        type=xxx,clock_source=external,time_source=external

might throw errors/warnings, because internal clock source plus external
time source is generally not supported, and the example would force the
clock source to be internal unless `--ref internal` was also provided.

For all cases that `clock_source` or `time_source` were not given as
a device argument, this is a no-op because `internal` is the default
value anyway.

In two examples, this includes minor code changes:
- In rfnoc_radio_loopback, if both --ref and --pps were given, we now
  use set_sync_source() to speed up setting the reference sources. On
  the N310/N300 series in particular, this saves a few seconds at
  initialization over the previous implementation (which set clock and
  time reference separately).
- In test_dboard_coercion, the code would fail without a default value
  for --ref, so we no longer require such a default value.
2023-05-19 08:52:20 -05:00
mkoop
9c2df8cc9a extension: windows: Fixed linking extension example to uhd.lib
Symtom to observed
Example of how to use a (new) feature/behavior
2023-03-30 08:00:47 -05:00
Wade Fife
02558b69f7 examples: Add throttle to replay_capture.py
Adds --throttle argument, which controls the playback rate to the host
and is set as a percentage of maximum stream endpoint throughput.

Also adds --no-progress to disable the TQDM progress bar and increases
the buffer size used with TQDM to avoid overusing the CPU during
playback to the host.
2023-03-13 17:51:17 -04:00
Virendra Kakade
a5bd377eca tests: benchmark_rate improvements
- Move default delay determination logic from the
  individual streamer functions to the main loop
  to ensure accurate run durations.
- Use a default delay in multi_streamer multi-channel
  configurations to ensure that all channel streamers
  are setup before streaming starts and thus prevent any
  errors during streamer setup.
- Fix some formatting errors and comments.

Signed-off-by: Virendra Kakade <virendra.kakade@ni.com>
2023-03-01 21:52:28 -05:00
Wade Fife
69b0989397 fpga: Update RFNoC YAML copyright 2023-02-22 21:55:02 -06:00
Wade Fife
d647481681 examples: Fix play region in replay_capture.py 2023-02-06 13:09:11 -06:00
Adam Vander Pas
0695a93077 examples: rx_samples_to_file: multi_streamer option
Add 'multi_streamer' command line parameter to enable
using a additional thread for each channel used in the
example run.
2023-02-02 14:50:03 -06:00
Adam Vander Pas
4d9b68aa6a examples: rx_samples_to_file: Add disk write speed check
Run 'dd' utility for 1 second to quickly benchmark the
write speed of the file location. A warning is then displayed
to the user if the rate/channel count/data type selection is
likely to cause overflows.
2022-12-13 13:03:07 -06:00
Adam Vander Pas
d91c86dd33 examples: rx_samples_to_file: Add multichannel option
This modifies the command line parameters of rx_samples_to_file to
allow setting multiple RF channels to recieve from.

Data recieved from each channel is saved in a different file using
ch0_<filename> prefixes.
2022-12-07 15:32:30 -06:00
Wade Fife
1e718d9be8 examples: Upgrade RFNoC example to Vivado 2021.1 2022-10-20 10:15:18 -05:00
Martin Braun
a835bb67bc examples: remote_rx: Add --mac-address argument
This allows manually overriding the MAC address for a target.
2022-09-23 13:01:58 -07:00
Martin Braun
4d6b7263f5 Revert "uhd: Revert Raw UDP Host Changes"
This reverts commit 6cb1dcca83.

Raw UDP support is added back in on both MPM and UHD side.
2022-09-21 15:35:55 -07:00
Steven Koo
6cb1dcca83 uhd: Revert Raw UDP Host Changes
This reverts the Raw UDP host changes which is breaking
multiple interface streaming.

Commits addb81aa5d2d6adcd3a0c7a8d59fcd96af0c1ec4^..b1ca51f97aaa2226ed6ef339fb26fbea54ab7593
are reverted.

Reverts:
doc: Update manual on streaming
examples: Add remote RX streaming example
rfnoc: Enable remote UDP streaming
mpm: e320: Enable raw UDP streaming
mpm: n3xx: Enable raw UDP streaming
mpm: x4xx: Enable transport manager adapter
mpm: Enable opt-in transport adapter control
rfnoc: Transition stream managers and mgmt_portal to topo_graph_t
rfnoc: Add topology graph object
uhd/mpm: Add API to set remote routes
mpm: xports: Add XportAdapterMgr class
2022-09-12 17:00:19 -05:00
Martin Braun
d31e4a4ffe examples: Add remote RX streaming example
Co-authored-by: Virendra Kakade <virendra.kakade@ni.com>
2022-08-30 13:43:36 -05:00
Martin Anderseck
4f993faf13 extension: Add extension example
Added example for extension framework which can be used as template for
own extensions.
2022-08-30 08:49:26 -05:00
Martin Anderseck
4789c32f40 extension: Add extension framework
This change adds the extension framwork that enables external libraries
to extend the UHD functionality in MultiUSRP and RFNoC. Its main purpose
is to be able to use external frontend modules, signal conditioning
modules etc. and to control them together with the USRP device. To make
it easier to install into the correct directory the UHD_MODULE_PATH gets
exported in CMake.
2022-08-30 08:49:26 -05:00
mattprost
94f78c50a0 examples: Enable radio loopback for a single radio
Utilize the skip_property_propagation option in the case of looping back
to a single radio block. Looping back to the same block causes a cycle
in the graph, which is not supported with property propagation. To work
around this, remove the forward property edge on the radio connection,
which breaks the cycle. The properties will then propagate forward once
through each block in the chain and then back.

Signed-off-by: mattprost <matt.prost@ni.com>
2022-08-22 18:06:52 -05:00
Wade Fife
4b03e237a9 fpga: Update makefiles to allow parallel FPGA builds
This adds the ability to do IP generation and FPGA builds using the
--jobs (-j) option with Make. For example, rather than generating each
IP one after another, you can generate up to N at a time using N Vivado
instances. This greatly reduces the IP generation time. Similarly,
parallel jobs can be used to easily build different FPGA variants
simultaneously.

Because FPGA builds can consume a lot of memory, care must be taken to
ensure that the number of jobs is not too high for the amount of memory
available.

New IP make targets were added for each USRP so that IP can be built
separately from the FPGA. The IP targets are now a dependency on each
FPGA target.

For example, you can generate the IP for X310 using 4 parallel jobs
using the following command:

  make -j4 X310_IP

Or, build two X310 bitstreams simultaneously:

  make -j2 X310_XG X310_HG
2022-08-16 10:16:22 -05:00
Yuki Kikuchi
bb0bda49d9 examples: rx_samples_c: Use error_code instead of return_code 2022-07-21 13:30:10 -05:00
Martin Anderseck
dd561fa124 spi: Replace old signal names with up to date ones
It's no use talking about racism and then continue using
terms like master and slave. The X400 SPI interface is still
pretty new, so without interfering with too much legacy we
should still be able to jump onto a new, better naming scheme
for the SPI signals. Following the Open Source Hardware
Association's Resolution to Redefine SPI Signal Names
<https://www.oshwa.org/a-resolution-to-redefine-spi-signal-names/>
we will use Controller and Peripheral, Serial Data Out
(SDO) and Serial Data In (SDI) and Chip Select (CS).
Leftovers like MISO and MOSI are legacy from long existing
APIs which cannot be changed easily without breaking user
applications.
2022-07-14 16:24:35 -05:00
Martin Braun
b7ed05f196 examples: Fix rfnoc_replay_samples_from_file
It was creating a TX streamer with zero channels.

Without this fix, you might see an error like this:

```
Error: AssertionError: channel < _mtu_out.size()
in connect_channel at
/path/to/uhd/host/lib/rfnoc/rfnoc_tx_streamer.cpp:127
```
2022-06-30 11:06:52 -07:00
mattprost
500b522390 examples: gpio: output before end of stream
The gpio values should be output before the stream ends. This matches
the behavior of other tests in this file and prevents strange logs for
passing tests.

Signed-off-by: mattprost <matt.prost@ni.com>
2022-06-13 12:03:43 -07:00
Martin Braun
c2c45fb17e fixup! examples: gpio: Refactor example
The example refactoring required usage of the get/set source API, which
isn't available on B2xx series. This patch tests for the existence of
said API, and disables its usage if appropriate.
2022-06-01 13:28:31 -07:00
Martin Braun
8286b1f094 fixup! examples: gpio: Refactor example
The refactoring changed the behaviour of --bitbang: before, it would
terminate after one readback unless --repeat was specified, in which
case it would require a Ctrl-C (SIGINT). After the refactoring, it
always required a SIGINT. This changes the behaviour back to prior to
727141d, and will now only read back once, unless --repeat is provided.

This also fixes the bitbang devtest, which would go on indefinitely.
2022-05-27 13:02:55 -07:00
Martin Braun
727141d851 examples: gpio: Refactor example
The example had organically grown and was getting hard to read, and also
had some known issues. Summary of fixes:

- Default GPIO bank and connector are now derived from the device. This
  allows this example to pass without throwing an exception on E3xx and
  X4xx series when using default arguments.
- The bitbang test is moved into its own code section, to make the rest
  more readable.
- We move all the streamer-related code into a helper struct
- Some repetitive parts of the code are moved into their own functions
- The argument --require-loopback is added, which will fail tests if
  GPIO pins are not correctly looped back externally
- --list-banks is renamed to --list_banks for consistency
2022-05-25 07:56:27 -07:00
Wade Fife
92016a585a fpga: rfnoc: Remove rfnoc_version from target YAML
This causes the latest RFNoC protocol version to be used by default
and avoids the need to update YAML files every time the RFNoC
protocol version gets bumped.
2022-05-11 12:29:35 -07:00
Wade Fife
483b10fe54 examples: Fix gain testbench name 2022-04-06 06:38:17 -07:00
Martin Anderseck
bc8713e7af host: SPI: Read number of supported SPI slaves from device
Add support for reading the number of supported SPI slaves from
the device. This has become necessary because we may have bitfiles
with different capabilities and we want to report this back correctly.
2022-04-04 12:27:18 -07:00
Wade Fife
6318eaeff5 rfnoc: Update device port names in image core YAML
Update USRP RFNoC iamge core YAML files to use the more consistent
device port names. Clean up the formatting and make the files more
consistent.
2022-03-31 13:51:23 -07:00
Martin Braun
f43511e913 examples: Add replay_capture.py
This is an example that allows capturing RF data into DRAM, and then
stream it back to host, using the Python API.
2022-03-31 08:10:45 -07:00
Martin Braun
708f1c2b35 rfnoc: Remove UHD3-API usages
- rfnoc_replay_samples_from_file still had UHD3-vestiges for selecting
  block port and ID
- The documentation for stream_args_t also included block port and ID
  examples
2022-03-11 08:59:39 -06:00
Aaron Rossetto
7e8c52d807 tests: Atomicize counters in benchmark_rate
The counters that keep track of overruns, underruns, number of samples
transferred, etc., were not atomic. Thus, running benchmark_rate with
multiple threads would result in inaccurate statistics being reported at
the end of the run. This commit makes those counters atomic variables so
that they are updated properly.
2022-03-07 09:21:49 -06:00
Wade Fife
6ff8bd326b fpga: rfnoc: Regenerate noc_shells 2022-03-04 09:42:39 -06:00
michael-west
ad054cd3ef examples: benchmark_rate improvements
- Added support for tx_spb and rx_spb arguments
- Fixed TX thread timestamp for single channel

Signed-off-by: michael-west <michael.west@ettus.com>
2022-03-03 14:11:42 -06:00
Martin Braun
c9944cb7ee examples: replay: Improve rfnoc_replay_samples_from_file
- Use connect_through_blocks() to create connections
- Remove check for spp being an integer multiple of the word size, the
  atomic item size feature will do that for us now
- When using --nsamps, automatically terminate application after samples
  have been tx'd.
- Added sleep statements to throttle empty while loops
- Minor formatting changes
2022-03-02 10:14:28 -06:00
Rick Farina (Zero_Chaos)
b170ec5d75 cmake: ncurses: fix building with split tinfo
This fixes an issue where tinfo and ncurses are split into separate
libraries.
2022-02-24 13:33:39 -06:00
Martin Braun
1c726f5667 rfnoc: Remove references to nocscript from YAML files
The sw_iface entry in the `control` section is yet underdefined, so we
can remove it from the block descriptors.
2022-02-23 08:57:48 -06:00
Martin Anderseck
09689f9805 SPI: Add SPI example
Add example to demonstrate and test SPI functionality.
2022-01-14 14:35:36 -06:00
Andrew Lynch
5d80e28752 examples: support multiple streamers in benchmark_rate 2022-01-10 14:57:30 -06:00
Martin Braun
8972efb734 examples: Fix tx_bursts bandwidth/freq/gain reporting
This example would not specify a channel when querying the actual
frequency/bandwidth/gain after setting it. When using the --channels
options like this:

    tx_bursts --channels 1 --freq 1e9 [...]

...it would request the frequency of 1 GHz on channel 1, then query the
frequency on channel 0 when reporting the "actual" frequency.

Also removes some boost::format().
2021-12-16 09:18:47 -06:00
Wade Fife
270a7e13c3 rfnoc: Fix noc_shell direction comments
Some comments describing data flow direction were wrong. This commit
updates the Mako files and updates the noc_shell modules with newly
generated versions.
2021-12-08 08:36:46 -06:00
Martin Braun
746c896eaf examples: Improve rfnoc_rx_to_file
This example had some major issues since UHD 4, which are now fixed.
Mainly, the option to include a custom RFNoC block was not working.

The example was rehauled severely:
- Custom blocks are now usable again.
- UHD/RFNoC code is used for the connections, rather than a custom
  kludge.
- Sample rate is set via property propagation
- boost::format() was not helpful in this example, and was removed.
- A list of active connections is now printed
- The --block-args argument is dropped in favour of --block-props. The
  former never did anything useful, and "block args" are a UHD 3 thing.
2021-12-01 13:34:35 -08:00
Wade Fife
d3424e8b66 examples: Use cmul for gain block in-tree IP example 2021-11-15 12:32:06 -06:00
Wade Fife
ec814ff0c3 examples: Test all variants in gain testbench 2021-11-04 15:50:54 -05:00