diff options
author | Sugandha Gupta <sugandha.gupta@ettus.com> | 2018-08-03 18:59:24 -0700 |
---|---|---|
committer | Brent Stapleton <bstapleton@g.hmc.edu> | 2018-08-09 17:39:14 -0700 |
commit | 885d5a8acc86162d4c728814d6b4f96686404684 (patch) | |
tree | 6bbf6d5024e1d3c765d36266b4e3feb61168aecc /host/lib | |
parent | 4683f0fa1886e3d53749965471ce419d42f04fd2 (diff) | |
download | uhd-885d5a8acc86162d4c728814d6b4f96686404684.tar.gz uhd-885d5a8acc86162d4c728814d6b4f96686404684.tar.bz2 uhd-885d5a8acc86162d4c728814d6b4f96686404684.zip |
e320: Fix tx/rx atr - antenna and frequency settings
- Change RX/TX min/max frequency according to AD9361 datasheet
- Fix set_atr_bits to change with rx/tx frequency and antenna independently
- Make AMP switching active high
Diffstat (limited to 'host/lib')
-rw-r--r-- | host/lib/usrp/dboard/neon/neon_bands.cpp | 8 | ||||
-rw-r--r-- | host/lib/usrp/dboard/neon/neon_constants.hpp | 9 | ||||
-rw-r--r-- | host/lib/usrp/dboard/neon/neon_radio_ctrl_impl.cpp | 33 | ||||
-rw-r--r-- | host/lib/usrp/dboard/neon/neon_radio_ctrl_impl.hpp | 8 | ||||
-rw-r--r-- | host/lib/usrp/dboard/neon/neon_radio_ctrl_init.cpp | 4 |
5 files changed, 32 insertions, 30 deletions
diff --git a/host/lib/usrp/dboard/neon/neon_bands.cpp b/host/lib/usrp/dboard/neon/neon_bands.cpp index 3b0ab2ca1..25aa0a181 100644 --- a/host/lib/usrp/dboard/neon/neon_bands.cpp +++ b/host/lib/usrp/dboard/neon/neon_bands.cpp @@ -101,7 +101,7 @@ neon_radio_ctrl_impl::rx_band neon_radio_ctrl_impl::_map_freq_to_rx_band(const double freq) { neon_radio_ctrl_impl::rx_band band; - if (fp_compare_epsilon<double>(freq) < AD9361_MIN_FREQ) { + if (fp_compare_epsilon<double>(freq) < AD9361_RX_MIN_FREQ) { band = rx_band::INVALID_BAND; } else if (fp_compare_epsilon<double>(freq) < NEON_RX_LB_BAND3_MIN_FREQ) { band = rx_band::LB_B2; @@ -115,7 +115,7 @@ neon_radio_ctrl_impl::_map_freq_to_rx_band(const double freq) { band = rx_band::LB_B6; } else if (fp_compare_epsilon<double>(freq) < NEON_RX_HB_MIN_FREQ) { band = rx_band::LB_B7; - } else if (fp_compare_epsilon<double>(freq) <= AD9361_MAX_FREQ) { + } else if (fp_compare_epsilon<double>(freq) <= AD9361_RX_MAX_FREQ) { band = rx_band::HB; } else { band = rx_band::INVALID_BAND; @@ -128,7 +128,7 @@ neon_radio_ctrl_impl::tx_band neon_radio_ctrl_impl::_map_freq_to_tx_band(const double freq) { neon_radio_ctrl_impl::tx_band band; - if (fp_compare_epsilon<double>(freq) < AD9361_MIN_FREQ) { + if (fp_compare_epsilon<double>(freq) < AD9361_TX_MIN_FREQ) { band = tx_band::INVALID_BAND; } else if (fp_compare_epsilon<double>(freq) < NEON_TX_LB_160_MIN_FREQ) { band = tx_band::LB_80; @@ -146,7 +146,7 @@ neon_radio_ctrl_impl::_map_freq_to_tx_band(const double freq) { band = tx_band::LB_1700; } else if (fp_compare_epsilon<double>(freq) < NEON_TX_HB_MIN_FREQ) { band = tx_band::LB_2750; - } else if (fp_compare_epsilon<double>(freq) <= AD9361_MAX_FREQ) { + } else if (fp_compare_epsilon<double>(freq) <= AD9361_TX_MAX_FREQ) { band = tx_band::HB; } else { band = tx_band::INVALID_BAND; diff --git a/host/lib/usrp/dboard/neon/neon_constants.hpp b/host/lib/usrp/dboard/neon/neon_constants.hpp index dc560ca93..58e5244fc 100644 --- a/host/lib/usrp/dboard/neon/neon_constants.hpp +++ b/host/lib/usrp/dboard/neon/neon_constants.hpp @@ -19,8 +19,11 @@ static constexpr double AD9361_RX_MAX_BANDWIDTH = 40.0e6; // HZ static constexpr double AD9361_TX_MIN_BANDWIDTH = 20.0e6; // HZ static constexpr double AD9361_TX_MAX_BANDWIDTH = 40.0e6; // HZ -static constexpr double AD9361_MIN_FREQ = 70.0e6; // Hz -static constexpr double AD9361_MAX_FREQ = 6.0e9; // Hz +static constexpr double AD9361_TX_MIN_FREQ = 47.0e6; // Hz +static constexpr double AD9361_TX_MAX_FREQ = 6.0e9; // Hz + +static constexpr double AD9361_RX_MIN_FREQ = 70.0e6; // Hz +static constexpr double AD9361_RX_MAX_FREQ = 6.0e9; // Hz static constexpr double NEON_RADIO_RATE = 16e6; // Hz @@ -43,7 +46,7 @@ static constexpr char NEON_DEFAULT_RX_ANTENNA[] = "RX2"; static constexpr char NEON_DEFAULT_TX_ANTENNA[] = "TX/RX"; static const std::vector<std::string> NEON_RX_ANTENNAS = { - "TX/RX", "RX2" + "RX2", "TX/RX" }; static constexpr size_t NEON_NUM_CHANS = 2; diff --git a/host/lib/usrp/dboard/neon/neon_radio_ctrl_impl.cpp b/host/lib/usrp/dboard/neon/neon_radio_ctrl_impl.cpp index a753a447c..4bf9b7573 100644 --- a/host/lib/usrp/dboard/neon/neon_radio_ctrl_impl.cpp +++ b/host/lib/usrp/dboard/neon/neon_radio_ctrl_impl.cpp @@ -204,6 +204,7 @@ void neon_radio_ctrl_impl::set_tx_antenna( % ant )); } + radio_ctrl_impl::set_tx_antenna(ant, chan); // We can't actually set the TX antenna, so let's stop here. } @@ -224,8 +225,8 @@ void neon_radio_ctrl_impl::set_rx_antenna( UHD_LOG_TRACE(unique_id(), "Setting RX antenna to " << ant << " for chan " << chan); - _set_atr_bits(chan, radio_ctrl_impl::get_rx_frequency(chan), ant); radio_ctrl_impl::set_rx_antenna(ant, chan); + _set_atr_bits(chan); } double neon_radio_ctrl_impl::set_tx_frequency( @@ -236,14 +237,14 @@ double neon_radio_ctrl_impl::set_tx_frequency( "set_tx_frequency(f=" << freq << ", chan=" << chan << ")"); std::lock_guard<std::mutex> l(_set_lock); + double clipped_freq = uhd::clip(freq, AD9361_TX_MIN_FREQ, AD9361_TX_MAX_FREQ); + double coerced_freq = _ad9361->tune( get_which_ad9361_chain(TX_DIRECTION, chan), - freq); + clipped_freq); radio_ctrl_impl::set_tx_frequency(coerced_freq, chan); - // Antenna settings - auto ant = get_tx_antenna(chan); // Front-end switching - _set_atr_bits(chan, freq, ant); + _set_atr_bits(chan); return coerced_freq; } @@ -256,14 +257,14 @@ double neon_radio_ctrl_impl::set_rx_frequency( "set_rx_frequency(f=" << freq << ", chan=" << chan << ")"); std::lock_guard<std::mutex> l(_set_lock); + double clipped_freq = uhd::clip(freq, AD9361_RX_MIN_FREQ, AD9361_RX_MAX_FREQ); + double coerced_freq = _ad9361->tune( get_which_ad9361_chain(RX_DIRECTION, chan), - freq); + clipped_freq); radio_ctrl_impl::set_rx_frequency(coerced_freq, chan); - // Antenna settings - auto ant = get_rx_antenna(chan); // Front-end switching - _set_atr_bits(chan, coerced_freq, ant); + _set_atr_bits(chan); return coerced_freq; } @@ -434,13 +435,13 @@ bool neon_radio_ctrl_impl::get_lo_lock_status( } void neon_radio_ctrl_impl::_set_atr_bits( - const size_t chan, - const double freq, - const std::string &ant + const size_t chan ) { - - const uint32_t rx_regs = _get_rx_switches(chan, freq, ant); - const uint32_t tx_regs = _get_tx_switches(chan, freq); + const auto rx_freq = radio_ctrl_impl::get_rx_frequency(chan); + const auto tx_freq = radio_ctrl_impl::get_tx_frequency(chan); + const auto rx_ant = radio_ctrl_impl::get_rx_antenna(chan); + const uint32_t rx_regs = _get_rx_switches(chan, rx_freq, rx_ant); + const uint32_t tx_regs = _get_tx_switches(chan, tx_freq); const uint32_t idle_regs = TX_AMP_OFF << TX_AMP_SHIFT | TRX1_SW_TX_HB << TRX_SW_SHIFT | TX_SW2_LB_80 << TX_SW2_SHIFT | @@ -456,7 +457,7 @@ void neon_radio_ctrl_impl::_set_atr_bits( // The LED signal names are reversed, but are consistent with the schematic const int idle_led = 0; - const bool is_txrx = ant == "TX/RX"; + const bool is_txrx = rx_ant == "TX/RX"; const int rx_led = 1 << TRX_LED_GRN_SHIFT; const int tx_led = 1 << TX_LED_RED_SHIFT; const int txrx_led = 1 << RX_LED_GRN_SHIFT; diff --git a/host/lib/usrp/dboard/neon/neon_radio_ctrl_impl.hpp b/host/lib/usrp/dboard/neon/neon_radio_ctrl_impl.hpp index 64b970d54..7f1debdb1 100644 --- a/host/lib/usrp/dboard/neon/neon_radio_ctrl_impl.hpp +++ b/host/lib/usrp/dboard/neon/neon_radio_ctrl_impl.hpp @@ -129,8 +129,8 @@ public: }; enum tx_amp_t { - TX_AMP_HF_ON = 1, - TX_AMP_LF_ON = 2, + TX_AMP_HF_ON = 2, + TX_AMP_LF_ON = 1, TX_AMP_OFF = 3 }; @@ -258,9 +258,7 @@ private: ); void _set_atr_bits( - const size_t chan, - const double freq, - const std::string &ant + const size_t chan ); /************************************************************************** diff --git a/host/lib/usrp/dboard/neon/neon_radio_ctrl_init.cpp b/host/lib/usrp/dboard/neon/neon_radio_ctrl_init.cpp index 9c2396f2d..ff22ff13f 100644 --- a/host/lib/usrp/dboard/neon/neon_radio_ctrl_init.cpp +++ b/host/lib/usrp/dboard/neon/neon_radio_ctrl_init.cpp @@ -186,7 +186,7 @@ void neon_radio_ctrl_impl::_init_frontend_subtree( }) ; subtree->create<meta_range_t>(tx_fe_path / "freq" / "range") - .set(meta_range_t(AD9361_MIN_FREQ, AD9361_MAX_FREQ, 1.0)) + .set(meta_range_t(AD9361_TX_MIN_FREQ, AD9361_TX_MAX_FREQ, 1.0)) .add_coerced_subscriber([](const meta_range_t &){ throw uhd::runtime_error( "Attempting to update freq range!"); @@ -202,7 +202,7 @@ void neon_radio_ctrl_impl::_init_frontend_subtree( }) ; subtree->create<meta_range_t>(rx_fe_path / "freq" / "range") - .set(meta_range_t(AD9361_MIN_FREQ, AD9361_MAX_FREQ, 1.0)) + .set(meta_range_t(AD9361_RX_MIN_FREQ, AD9361_RX_MAX_FREQ, 1.0)) .add_coerced_subscriber([](const meta_range_t &){ throw uhd::runtime_error( "Attempting to update freq range!"); |