From 0f24d510acfabd3c288f9a92ab63b01fb3e4481f Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Fri, 12 Jun 2020 12:24:28 +0200 Subject: [PATCH] UHD: Fix RFNOC DDC frequency calculator --- lib/src/phy/rf/rf_uhd_rfnoc.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/src/phy/rf/rf_uhd_rfnoc.h b/lib/src/phy/rf/rf_uhd_rfnoc.h index 277e3df92..1be3bb889 100644 --- a/lib/src/phy/rf/rf_uhd_rfnoc.h +++ b/lib/src/phy/rf/rf_uhd_rfnoc.h @@ -366,12 +366,11 @@ public: } uhd_error set_sync_source(const std::string& source) override { - Debug("Setting sync source to " << source); - for (size_t radio_idx = 0; radio_idx < nof_radios; radio_idx++) { + UHD_SAFE_C_SAVE_ERROR(this, for (size_t radio_idx = 0; radio_idx < nof_radios; radio_idx++) { + UHD_LOG_DEBUG(radio_id[radio_idx], "Setting sync source to " << source); radio_ctrl[radio_idx]->set_clock_source(source); radio_ctrl[radio_idx]->set_time_source(source); - } - return UHD_ERROR_NONE; + }) } uhd_error get_gain_range(uhd::gain_range_t& tx_gain_range, uhd::gain_range_t& rx_gain_range) override { @@ -584,9 +583,9 @@ public: // Setup DDC for (size_t j = 0; j < nof_channels; j++) { - double freq_hz = rx_freq_hz[nof_channels * i + j] - center_freq_hz; + double freq_hz = center_freq_hz - rx_freq_hz[nof_channels * i + j]; UHD_LOG_DEBUG(ddc_id[i], "Setting " << j << " freq: " << freq_hz / 1e6 << " MHz ..."); - ddc_ctrl[i]->set_arg("freq", std::to_string(freq_hz), j); + ddc_ctrl[i]->set_arg("freq", freq_hz, j); } }) }