From b6ff5fd2837bed63b09798e4fa187b169b7dcdc2 Mon Sep 17 00:00:00 2001 From: steviez Date: Thu, 9 Apr 2020 11:20:35 -0500 Subject: multi_usrp_rfnoc: Manually pass sample rate to ddc/duc This adds (and calls) methods to manually pass radio block sample rate to the input/output properties of the ddc/duc during creation of the multi_usrp_rfnoc object. The ddc/duc require this information in order to return valid, possible output/input sample rates in get_rx_rates()/get_tx_rates(). Before, the ddc/duc wouldn't have this rate until the rfnoc_graph had been connected and committed, which happens in get_rx_stream()/get_tx_stream(). Thus, this fixes an issue where a user was unable to query possible sample rates prior to specifying a sample rate and creating a stream. --- host/lib/usrp/multi_usrp_rfnoc.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'host/lib/usrp/multi_usrp_rfnoc.cpp') diff --git a/host/lib/usrp/multi_usrp_rfnoc.cpp b/host/lib/usrp/multi_usrp_rfnoc.cpp index 0c716c0a3..f81253997 100644 --- a/host/lib/usrp/multi_usrp_rfnoc.cpp +++ b/host/lib/usrp/multi_usrp_rfnoc.cpp @@ -214,6 +214,20 @@ public: } } } + // Manually propagate radio block sample rates to DDC/DUC blocks in order to allow + // DDC/DUC blocks to have valid internal state before graph is (later) connected + for (size_t rx_chan = 0; rx_chan < get_rx_num_channels(); ++rx_chan) { + auto& rx_chain = _get_rx_chan(rx_chan); + if (rx_chain.ddc) { + rx_chain.ddc->set_input_rate(rx_chain.radio->get_rate(), rx_chain.block_chan); + } + } + for (size_t tx_chan = 0; tx_chan < get_tx_num_channels(); ++tx_chan) { + auto& tx_chain = _get_tx_chan(tx_chan); + if (tx_chain.duc) { + tx_chain.duc->set_output_rate(tx_chain.radio->get_rate(), tx_chain.block_chan); + } + } _graph->commit(); } -- cgit v1.2.3