From d4e62f0d9d26107c0b6677308ea83b2f2dfe7da4 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Thu, 28 May 2020 15:41:21 -0700 Subject: multi_usrp: Fix get_tx_freq() for RFNoC devices get_tx_freq(), unlike get_rx_freq(), would not factor in the DSP frequency. Before, this would happen: >>> U = uhd.usrp.MultiUSRP("type=x300") >>> tr = uhd.types.TuneRequest(1e9, 10e6) >>> res = U.set_tx_freq(tr) >>> res.clipped_rf_freq 1000000000.0 >>> U.get_tx_freq() 1010000000.0 In other words, the TuneResult object was correct, but the return value of get_tx_freq() was not. This fixes the issue. --- host/lib/usrp/multi_usrp_rfnoc.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'host/lib') diff --git a/host/lib/usrp/multi_usrp_rfnoc.cpp b/host/lib/usrp/multi_usrp_rfnoc.cpp index 8b85e84ec..823f3547a 100644 --- a/host/lib/usrp/multi_usrp_rfnoc.cpp +++ b/host/lib/usrp/multi_usrp_rfnoc.cpp @@ -1780,8 +1780,14 @@ public: double get_tx_freq(size_t chan) { - auto tx_chain = _get_tx_chan(chan); - return tx_chain.radio->get_tx_frequency(tx_chain.block_chan); + auto& tx_chain = _get_tx_chan(chan); + // extract actual dsp and IF frequencies + const double actual_rf_freq = + tx_chain.radio->get_tx_frequency(tx_chain.block_chan); + const double actual_dsp_freq = + (tx_chain.duc) ? tx_chain.duc->get_freq(tx_chain.block_chan) : 0.0; + // invert the sign on the dsp freq for transmit + return actual_rf_freq - actual_dsp_freq * TX_SIGN; } freq_range_t get_tx_freq_range(size_t chan) -- cgit v1.2.3