aboutsummaryrefslogtreecommitdiffstats
path: root/host/examples
Commit message (Collapse)AuthorAgeFilesLines
* SPI: Add SPI exampleMartin Anderseck2022-01-142-0/+136
| | | | Add example to demonstrate and test SPI functionality.
* examples: support multiple streamers in benchmark_rateAndrew Lynch2022-01-101-43/+103
|
* examples: Fix tx_bursts bandwidth/freq/gain reportingMartin Braun2021-12-161-11/+9
| | | | | | | | | | | | | 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().
* rfnoc: Fix noc_shell direction commentsWade Fife2021-12-081-2/+2
| | | | | | Some comments describing data flow direction were wrong. This commit updates the Mako files and updates the noc_shell modules with newly generated versions.
* examples: Improve rfnoc_rx_to_fileMartin Braun2021-12-011-112/+143
| | | | | | | | | | | | | | | 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.
* examples: Use cmul for gain block in-tree IP exampleWade Fife2021-11-151-21/+18
|
* examples: Test all variants in gain testbenchWade Fife2021-11-043-15/+61
|
* examples: Make IQ order clear in gain RFNoC blockWade Fife2021-11-041-16/+25
|
* example: gpio: Separate bank and port argumentsLane Kolbly2021-11-031-10/+18
| | | | | | | "bank" refers to what the radio control sees, and "port" refers to what the user looking at the physical device sees. For example, on X410 each radio control only has a single (24-bit) output, which can be routed to either of two ports.
* rfnoc: Remove cruft from UHD 3 (constants)Martin Braun2021-11-021-31/+0
| | | | | | | | | | | | | This removes some constants from UHD that were left over from RFNoC/UHD 3.x. They are unused. rfnoc_rx_to_file had a commented-out section that was also UHD-3 only. Note that rfnoc/constants.hpp is pretty bare now, and could be removed. However, it is in the public header section, so we shall leave the used constants where they are. This requires fixing includes in mgmt_portal.cpp.
* uhd: Replace Boost mutexes and locks with standard optionsMartin Braun2021-10-191-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a very mechanical task that could almost have been done with sed. Boost versions of mutexes and locks were removed, and replaced with std:: versions. The replacement tables are as follows: == Mutexes == - boost::mutex -> std::mutex - boost::recursive_mutex -> std::recursive_mutex Mutexes behave identically between Boost and std:: and have the same API. == Locks == C++11 has only two types of lock that we use/need in UHD: - std::lock_guard: Identical to boost::lock_guard - std::unique_lock: Identical to boost::unique_lock Boost also has boost::mutex::scoped_lock, which is a typedef for boost::unique_lock<>. However, we often have used scoped_lock where we meant to use lock_guard<>. The name is a bit misleading, "scoped lock" sounding a bit like an RAII mechanism. Therefore, some previous boost::mutex::scoped_lock are now std::lock_guard<>. std::unique_lock is required when doing more than RAII locking (i.e., unlocking, relocking, usage with condition variables, etc.). == Condition Variables == Condition variables were out of the scope of this lock/mutex change, but in UHD, we inconsistently use boost::condition vs. boost::condition_variable. The former is a templated version of the latter, and thus works fine with std::mutex'es. Therefore, some boost::condition_variable where changed to boost::condition. All locks and mutexes use `#include <mutex>`. The corresponding Boost includes were removed. In some cases, this exposed issues with implicit Boost includes elsewhere. The missing explicit includes were added.
* bug: fix channel indexing when reading USRP powerLars Amsel2021-10-111-1/+1
| | | | | | | the USRP power meter will only receive from a single channel which is configured by the argument parameter. The streamer receive data will therefor alwalys have a single channel. So do not index with chan when passing the streamer to uhd.dsp.signals.get_usrp_power.
* python: multi_usrp: Fix issues in send_waveform()Martin Braun2021-10-061-7/+7
| | | | | | | - 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
* python: Fix dropped-sample calculation in benchmark_rate.pyMartin Braun2021-09-281-5/+7
| | | | | | | | | | This fixes a subtle bug, where a variable to cache the timestamp of an error gets bound to the metadata instead of creating a copy thereof. Without this fix, the calculation of dropped samples would always be 0, because the difference in timestamps would incorrectly be always zero. This fix will now make a copy of the timestamp. Shoutout to GitHub user bhorsfield for finding this issue.
* examples: Improve txrx_loopback_to_file (late recv, Boost, timing)Martin Braun2021-09-171-18/+22
| | | | | | | | | | | | - Fixes a bug where the RX stream command set set independent of the device time. Now, we read back get_time_now() to calculate the command time. - When using multiple RX USRPs, sync their times. Before, they were left untouched, causing possible timing mismatches. - Increase the initial timeout value. The previous value had only been tested with N2x0. - Replace the boost::thread_group with a std::thread. - Remove some boost::format where it didn't add value.
* cmake: Fix rfnoc-example (CMake paths)Martin Braun2021-09-173-11/+11
| | | | | This reverts part of 09d94529e, which should not have touched these particular CMake files.
* cmake: Replace CMAKE_{SOURCE,BINARY}_DIR with UHD_*_DIRMartin Braun2021-09-103-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* examples: Show how to use in-tree Verilog headerWade Fife2021-09-081-0/+17
| | | | | Adds example showing how to `include an in-tree Verilog header file in the rfnoc_block_gain example.
* examples: Add x400/x410 target to RFNoC exampleWade Fife2021-08-301-0/+3
|
* examples: Fix icores example to match current RFNoC specsMartin Braun2021-06-281-2/+2
| | | | The YAML file was using float-versions, not string versions.
* examples: Update example CMakeLists.txt for minimum version bumpsAaron Rossetto2021-06-282-3/+3
|
* examples: Fix tx frequency tuning in radio loopbackmattprost2021-06-251-2/+2
|
* uhd: Remove includes of list_of.hpp where appropriateMartin Braun2021-06-241-1/+0
| | | | This Boost header is included in some places, despite not being used.
* uhd: Remove all occurences of boost::math::*round()Martin Braun2021-06-242-5/+4
| | | | | | | Its behaviour is almost identical to std::lround, which we use instead. The only downside of std::lround is that it always returns a long, which we don't always need. We thus add some casts for those cases to make the compiler happy.
* fpga: Change RFNoC YAML version numbers to stringsWade Fife2021-06-081-2/+2
| | | | | Change version from a numeric to a string, in order to differentiate between versions like "1.1" and "1.10".
* examples: Fix underrun/seq error reporting in benchmark_rate.pyMartin Braun2021-05-201-10/+10
| | | | The numbers for these were swapped.
* examples: Add min dynamic range limit to ascii art DFT exampleLane Kolbly2021-04-152-3/+9
| | | | | | The DFT plotting routine hangs when the dynamic range equals zero, so this change adds a limit so that the dynamic range never goes below 10.
* examples: Add IP to OOT RFNoC gain exampleWade Fife2021-03-175-39/+335
| | | | | This updates the gain example to show how to use RFNoC IP, in-tree Xilinx IP, and out-of-tree Xilinx IP in a custom RFNoC block.
* examples: Remove unused arguments for rfnoc_radio_loopbackLane Kolbly2021-03-111-3/+14
|
* host: Update code base using clang-tidyMartin Braun2021-03-042-5/+5
| | | | | | | | | The checks from the new clang-tidy file are applied to the source tree using: $ find . -name "*.cpp" | sort -u | xargs \ --max-procs 8 --max-args 1 clang-tidy --format-style=file \ --fix -p /path/to/compile_commands.json
* examples: Fix PPS option in rfnoc_radio_loopbackLane Kolbly2020-11-171-1/+1
|
* examples: Fix --random option in benchmark_ratemichael-west2020-10-121-5/+11
| | | | | | | | The implementation was not properly configuring the stream command if the --random flag was used. It was especially bad when multiple channels were specified. Signed-off-by: michael-west <michael.west@ettus.com>
* Examples: Fix install paths in OOT RFNoC examplemichael-west2020-09-133-10/+14
| | | | | | | | - Add missing "uhd/" subdirectory. - Update install path for YAML file. - Fix include directories and link libraries for init_gain_block. Signed-off-by: michael-west <michael.west@ettus.com>
* examples: replay samples from filemattprost2020-08-113-414/+424
| | | | | | | This example exercises the Replay Block RFNoC API. The Replay records IQ data from a file and plays it back into a Radio for transmitting. Signed-off-by: mattprost <matt.prost@ni.com>
* example: Check for failure in tx_samples_from_fileSamuel O'Brien2020-07-311-3/+9
| | | | | | | | | | | I was using this example for testing with the simulator. If there is a flow control failure, the original example would just silently finish, outputing the message "Done!" (Not even printing a timeout message). This commit asserts that the number of samples sent is equal to the number of samples provided. Signed-off-by: Samuel O'Brien <sam.obrien@ni.com>
* examples: Fix usrp_power_meter exampleLars Amsel2020-06-111-16/+23
| | | | | | This PR applies antenna channel settings before available calibration data, and moves initialization code to setup_device, returning necessary settings in a tuple.
* host/examples/ascii_art_dft.hpp: fix and modernize example mainEtienne Wodey2020-05-261-1/+6
| | | | | | | Refresh screen after printing the DFT data. Use C++14 std::this_thread::sleep_for to control the refresh rate. Signed-off-by: Etienne Wodey <wodey@iqo.uni-hannover.de>
* examples: Add usrp_power_meter exampleMartin Braun2020-05-192-1/+135
| | | | | | | | | | | This is a utility that can be used to measure received power, assuming a calibrated device. For example, it can be called like this: usrp_power_meter.py -a type=x300 -f 1e9 --mode continuous To continuously measure input power at 1 GHz.
* Remove remaining Python 2 referencesMartin Braun2020-05-074-4/+4
| | | | | | | This changes two things in all applicable files: - Remove imports from __future__ - Change default shebangs from /usr/bin/env python to /usr/bin/env python3
* rfnoc-example: Removed DRAM from image coreMartin Braun2020-05-051-24/+11
| | | | | The DRAM was incorrectly connected, but it's also not necessary for this example and is hence removed.
* examples: Update test_messages exampleMichael West2020-04-301-12/+23
| | | | | | | | The example assumed that there was always at least one TX and on RX channel. Since that is not always true, this change checks for TX and RX channels and only exucutes tests for what exists on the device. Signed-off-by: Michael West <michael.west@ettus.com>
* examples: Update gpio exampleMichael West2020-04-301-92/+117
| | | | | | | | | | The example assumed that there was always at least one TX and on RX channel. Since that is not always true, this change checks for TX and RX channels and only exucutes tests for what exists on the device. Applied clang format. Signed-off-by: Michael West <michael.west@ettus.com>
* examples: Add --power command line option to tx_waveformsMartin Braun2020-04-172-18/+54
| | | | | | | | | | | | | | If you run tx_waveforms --power -20 [other args] it will try to set the out power to -20 dBm. The signal amplitude is factored in, so changing --ampl will not change the actual TX power unless it causes clipping, or becomes too low. If the USRP does not support setting a power, the program will terminate early. If it does support setting a power, but can't reach the requested power, it will coerce, and print the actual, available power.
* examples: wavetable: Modify wave tables to ease power calculationsMartin Braun2020-04-151-19/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The existing implementation would create a real signal for any type of signal (CONST, RAMP, SQUARE, and SINE), and then create the complex signal by simply delaying the Q value by a 90 degree phase. This had surprising results for all waveforms: - CONST waveforms would have a baseband value of ampl + j ampl, thus increasing the output power by 3 dB vs. what one would expect when setting an amplitude. It is now ampl + j * 0, and the power is ampl**2. This now makes the power consistent with SINE, which it was not, even though a const signal is a sine signal with a frequency of zero. - SQUARE waveforms would phase-delay the Q part, thus resulting in three power output levels (when both phases are zero, when both phases are ampl, and when one of them is zero and other is ampl). However, the square signal is useful for watching it in the scope, and there, it helps if the power is predictably either high or low within the selected frequency. The Q value is now always zero. - RAMP waveforms had the same issue and were also resolved by setting Q to zero. - SINE signals were fine, although the implementation used sin + j cos to calculate a complex sine, not cos + j sin according to Euler's formula. To make this wavetable more useful with absolute power settings, the changes mentioned above were implemented. The dBFs power of CONST and SINE can now be calculated by using ampl**2, SQUARE by using (ampl**2)/2, and RAMP by solving the integral over a ramp from -1 to 1.
* examples: Change benchmark_rate default thread priorityAaron Rossetto2020-03-271-1/+1
| | | | | | | | | | | | | | | | | | This commit modifies the benchmark_rate example to use the operating system's default thread priority, instead of real-time thread priority, by default. UHD 4.0 includes a number of significant improvements to the streaming architecture that allow for best performance to be achieved without having to resort to elevating the process thread priority to real-time. Internal testing shows degraded streaming performance in common use cases (i.e. non-DPDK) when the process thread priority is set to real-time. It should be noted that applications which use DPDK may still experience better performance when the process thread priority is set to real-time. Users may continue to manually override the process thread priority in benchmark_rate using the --priority=high command-line option. The need to elevate the process thread priority will be application- and deployment-dependent.
* examples: Update gain block testbench to use samplesWade Fife2020-03-091-25/+24
|
* sim: Parameterize chdr_word_t data typeWade Fife2020-03-091-1/+6
| | | | | | | | | | | | | | | | | | This replaces chdr_word_t, which was a statically defined 64-bit data type, with a paramaterizable data type that matches the defined CHDR_W. Code that formerly referenced the chdr_word_t data type can now define the data type for their desired CHDR_W and ITEM_W as follows: // Define the CHDR word and item/sample data types typedef ChdrData #(CHDR_W, ITEM_W)::chdr_word_t chdr_word_t; typedef ChdrData #(CHDR_W, ITEM_W)::item_t item_t; ITEM_W is optional when defining chdr_word_t if items are not needed. Static methods in the ChdrData class also provide the ability to convert between CHDR words and data items. For example: // Convert CHDR data buffer to a buffer of samples samples = ChdrData#(CHDR_W, ITEM_W)::chdr_to_item(data);
* uhd: Apply clang-format against all .cpp and .hpp files in host/Martin Braun2020-03-038-17/+17
| | | | | Note: template_lvbitx.{cpp,hpp} need to be excluded from the list of files that clang-format gets applied against.
* examples: Wrap get_gpio_src() with try/catch blocksteviez2020-02-191-7/+14
| | | | | Non-RFNoC devices do not support get_gpio_src() entrypoing so wrap call with a try/catch block
* x300: add front-panel GPIO source controleklai2020-02-181-4/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds a ZPU register to control the FP GPIO source. These are 2bits per GPIO pin, totalling 24 bits. 0 corresponds to RF-A, 1 corresponds to RF-B. The following Python code will control the upper 6 bits of the front-panel GPIO from the B-side radio on an X300: >>> import uhd >>> U = uhd.usrp.MultiUSRP("type=x300") >>> U.get_gpio_src_banks() ['FP0'] >>> U.get_gpio_src("FP0") ['RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFA'] >>> U.set_gpio_src("FP0", ['RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFB', 'RFB', 'RFB', 'RFB', 'RFB', 'RFB']) >>> U.get_gpio_src("FP0") ['RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFB', 'RFB', 'RFB', 'RFB', 'RFB', 'RFB'] >>> # Make all GPIOs outputs: >>> U.set_gpio_attr("FP0A", "DDR", 0xFFF) >>> U.set_gpio_attr("FP0B", "DDR", 0xFFF) >>> # Control all GPIOs from software (not ATR): >>> U.set_gpio_attr("FP0A", "CTRL", 0x000) >>> U.set_gpio_attr("FP0B", "CTRL", 0x000) >>> # Bottom 3 pins go high from radio A >>> U.set_gpio_attr("FP0A", "OUT", 0x007) >>> # Top 3 pins go high from radio B >>> U.set_gpio_attr("FP0B", "OUT", 0xE00) Amends the gpio.cpp example to allow switching the source. Co-authored-by: Brent Stapleton <brent.stapleton@ettus.com>