diff options
author | natetemple <nate.temple@ettus.com> | 2019-11-22 16:05:14 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2019-11-24 16:55:27 -0800 |
commit | 0e184f7185bd8645051535f23b5cc50a80bda296 (patch) | |
tree | 1f95f67c945a0cae1b826b5a8d94330cffae2931 | |
parent | 9b203bf95bf47ea20ce54b8c1dd90ac90e1a8f25 (diff) | |
download | uhd-0e184f7185bd8645051535f23b5cc50a80bda296.tar.gz uhd-0e184f7185bd8645051535f23b5cc50a80bda296.tar.bz2 uhd-0e184f7185bd8645051535f23b5cc50a80bda296.zip |
Examples: Set refs in RFNoC examples
-rw-r--r-- | host/examples/rfnoc_radio_loopback.cpp | 21 | ||||
-rw-r--r-- | host/examples/rfnoc_rx_to_file.cpp | 7 |
2 files changed, 24 insertions, 4 deletions
diff --git a/host/examples/rfnoc_radio_loopback.cpp b/host/examples/rfnoc_radio_loopback.cpp index 848f9c4da..92046eebc 100644 --- a/host/examples/rfnoc_radio_loopback.cpp +++ b/host/examples/rfnoc_radio_loopback.cpp @@ -111,47 +111,68 @@ int UHD_SAFE_MAIN(int argc, char* argv[]) // Configure Rx radio std::cout << "Configuring Rx radio..." << std::endl; rx_radio_ctrl->set_args(rx_args); + + // Lock mboard clocks + if (vm.count("ref")) { + rx_radio_ctrl->set_clock_source(ref); + } + if (spp) { rx_radio_ctrl->set_arg<int>("spp", spp, rx_chan); } + std::cout << "Setting Rx rate: " << (rate / 1e6) << " Msps" << std::endl; double actual_rx_rate = rx_radio_ctrl->set_rate(rate); std::cout << "Actual Rx rate: " << (actual_rx_rate / 1e6) << " Msps" << std::endl; + std::cout << "Setting Rx frequency: " << (rx_freq / 1e6) << " MHz." << std::endl; std::cout << "Actual Rx frequency: " << (rx_radio_ctrl->set_rx_frequency(rx_freq, rx_chan) / 1e6) << " MHz." << std::endl; + if (rx_gain) { std::cout << "Setting Rx gain: " << (rx_gain) << " dB." << std::endl; std::cout << "Actual Rx gain: " << (rx_radio_ctrl->set_rx_gain(rx_gain, rx_chan)) << " dB." << std::endl; } + if (not rx_ant.empty()) { std::cout << "Setting Rx antenna: " << (rx_ant) << "." << std::endl; rx_radio_ctrl->set_rx_antenna(rx_ant, rx_chan); std::cout << "Actual Rx antenna: " << rx_radio_ctrl->get_rx_antenna(rx_chan) << "." << std::endl; } + if (!rx_timestamps) { std::cout << "Disabling timestamps on RX... (direct loopback, may underrun)" << std::endl; } rx_radio_ctrl->enable_rx_timestamps(rx_timestamps, 0); + // Configure Tx radio std::cout << "Configuring Tx radio..." << std::endl; tx_radio_ctrl->set_args(tx_args); + + // Lock mboard clocks + if (vm.count("ref")) { + tx_radio_ctrl->set_clock_source(ref); + } + std::cout << "Setting Tx rate: " << (rate / 1e6) << " Msps" << std::endl; double actual_tx_rate = tx_radio_ctrl->set_rate(rate); std::cout << "Actual Tx rate: " << (actual_tx_rate / 1e6) << " Msps" << std::endl; + std::cout << "Setting Tx frequency: " << (tx_freq / 1e6) << " MHz." << std::endl; std::cout << "Actual Tx frequency: " << (tx_radio_ctrl->set_tx_frequency(tx_freq, tx_chan) / 1e6) << " MHz." << std::endl; + if (tx_gain) { std::cout << "Setting Tx gain: " << (tx_gain) << " dB." << std::endl; std::cout << "Actual Tx gain: " << (tx_radio_ctrl->set_tx_gain(tx_gain, tx_chan)) << " dB." << std::endl; } + if (not tx_ant.empty()) { std::cout << "Setting Tx antenna: " << (tx_ant) << "." << std::endl; tx_radio_ctrl->set_tx_antenna(tx_ant, tx_chan); diff --git a/host/examples/rfnoc_rx_to_file.cpp b/host/examples/rfnoc_rx_to_file.cpp index 12e774d88..5bb9985ae 100644 --- a/host/examples/rfnoc_rx_to_file.cpp +++ b/host/examples/rfnoc_rx_to_file.cpp @@ -323,11 +323,10 @@ int UHD_SAFE_MAIN(int argc, char* argv[]) * Set up radio ***********************************************************************/ radio_ctrl->set_args(radio_args); + + // Lock mboard clocks if (vm.count("ref")) { - std::cout << "TODO -- Need to implement API call to set clock source." - << std::endl; - // Lock mboard clocks TODO - // usrp->set_clock_source(ref); + radio_ctrl->set_clock_source(ref); } // set the sample rate |