diff options
author | Martin Braun <martin.braun@ettus.com> | 2021-08-24 11:45:31 +0200 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2021-08-30 12:31:23 -0500 |
commit | 7c794c4bd384bbcae051e024086f2293457ddd65 (patch) | |
tree | d9ce770a5375144e7f149f712666b0f56aa0e556 /host/include | |
parent | 67e6234a0546a61661799873d8651f6e4e791536 (diff) | |
download | uhd-7c794c4bd384bbcae051e024086f2293457ddd65.tar.gz uhd-7c794c4bd384bbcae051e024086f2293457ddd65.tar.bz2 uhd-7c794c4bd384bbcae051e024086f2293457ddd65.zip |
rfnoc: duc: Fix frequency range for DUC block
The tuning range of the DUC depends on the output sample rate (which is
larger), but it was using the input sample rate. This was causing a bug
where for Tx, the DSP tuning range was limited when using multi_usrp API,
and thus would not allow to DSP-tune beyond the current sampling rate.
In this patch, we also re-use the existing calculation of the sampling
rate, and harmonize that code between duc_block_control and
ddc_block_control.
Consider the following Python REPL code:
>>> import uhd
>>> U = uhd.usrp.MultiUSRP('type=x300')
>>> U.set_rx_rate(10e6)
>>> U.set_tx_rate(10e6)
>>> # Creating a streaming is required, or the input rate will not be
>>> # set:
>>> S = U.get_tx_stream(uhd.usrp.StreamArgs("fc32", "sc16"))
>>> treq = uhd.types.TuneRequest(1e9)
>>> treq.rf_freq = 1e9
>>> treq.dsp_freq = 50e6
>>> treq.dsp_freq_policy = uhd.types.TuneRequestPolicy.manual
>>> treq.rf_freq_policy = uhd.types.TuneRequestPolicy.manual
>>> tres = U.set_rx_freq(treq, 0)
>>> print(str(tres))
Tune Result:
Target RF Freq: 1000.000000 (MHz)
Actual RF Freq: 1000.000000 (MHz)
Target DSP Freq: 50.000000 (MHz)
Actual DSP Freq: 5.000000 (MHz)
>>> # Note the last two lines: The *target* DSP freq was already clipped
>>> # to 5 MHz. These lines show 50.0 MHz when this patch is applied.
This bugfix is accompanied some related changes:
- The unit test is amended to verify the behaviour
- The API documentation is amended with details on its behaviour
Diffstat (limited to 'host/include')
-rw-r--r-- | host/include/uhd/rfnoc/duc_block_control.hpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/host/include/uhd/rfnoc/duc_block_control.hpp b/host/include/uhd/rfnoc/duc_block_control.hpp index cf9d3a5d7..7e398454d 100644 --- a/host/include/uhd/rfnoc/duc_block_control.hpp +++ b/host/include/uhd/rfnoc/duc_block_control.hpp @@ -78,6 +78,13 @@ public: /*! Return the range of frequencies that \p chan can be set to. * + * The frequency shifter is the last component in the DUC, and thus can + * shift frequencies (digitally) between -get_output_rate()/2 + * and +get_output_rate()/2. + * + * The returned values are in Hz (not normalized frequencies) and are valid + * inputs for set_freq(). + * * \return The range of frequencies that the DUC can shift the input by */ virtual uhd::freq_range_t get_frequency_range(const size_t chan) const = 0; |