diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-11-10 17:23:45 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:05:05 -0800 |
commit | d5ba6965e53e579a29d24ef5a86dc954e38ecf99 (patch) | |
tree | ffe25ffc18355a2998332d78ee6b99d2a6e66feb | |
parent | db73d59969185bc3c261b39e3a6e9e2462b14a3a (diff) | |
download | uhd-d5ba6965e53e579a29d24ef5a86dc954e38ecf99.tar.gz uhd-d5ba6965e53e579a29d24ef5a86dc954e38ecf99.tar.bz2 uhd-d5ba6965e53e579a29d24ef5a86dc954e38ecf99.zip |
mg: Force updating of CPLD/ATR bits at init
3 files changed, 36 insertions, 34 deletions
diff --git a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_cpld.cpp b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_cpld.cpp index 562fecc30..c7163052b 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_cpld.cpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_cpld.cpp @@ -45,9 +45,7 @@ void magnesium_radio_ctrl_impl::_update_atr_switches( const direction_t dir, const std::string &ant ){ - UHD_ASSERT_THROW(dir == RX_DIRECTION or dir == TX_DIRECTION); - - if (dir == RX_DIRECTION) { + if (dir == RX_DIRECTION or dir == DX_DIRECTION) { // These default values work for RX2 bool trx_led = false; bool rx2_led = true; @@ -107,9 +105,8 @@ void magnesium_radio_ctrl_impl::_update_atr_switches( false /* don't defer commit */ ); } - if (dir == TX_DIRECTION) { - UHD_LOG_TRACE(unique_id(), - "Updating all TX-ATR related switches for antenna==" << ant); + if (dir == TX_DIRECTION or dir == DX_DIRECTION) { + UHD_LOG_TRACE(unique_id(), "Updating all TX-ATR related switches..."); _cpld->set_tx_atr_bits( chan, magnesium_cpld_ctrl::ON, diff --git a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp index 93f9a25b9..0e3768499 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp @@ -101,8 +101,8 @@ UHD_RFNOC_RADIO_BLOCK_CONSTRUCTOR(magnesium_radio_ctrl) UHD_LOG_DEBUG(unique_id(), "Radio type: " << (_master ? "master" : "slave")); - _init_peripherals(); _init_defaults(); + _init_peripherals(); _init_prop_tree(); } diff --git a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp index dfa4482b4..b7029d04d 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp @@ -24,6 +24,33 @@ namespace { }; } +void magnesium_radio_ctrl_impl::_init_defaults() +{ + UHD_LOG_TRACE(unique_id(), "Initializing defaults..."); + const size_t num_rx_chans = get_output_ports().size(); + const size_t num_tx_chans = get_input_ports().size(); + + UHD_LOG_TRACE(unique_id(), + "Num TX chans: " << num_tx_chans + << " Num RX chans: " << num_rx_chans); + UHD_LOG_TRACE(unique_id(), + "Setting tick rate to " << MAGNESIUM_TICK_RATE / 1e6 << " MHz"); + radio_ctrl_impl::set_rate(MAGNESIUM_TICK_RATE); + + for (size_t chan = 0; chan < num_rx_chans; chan++) { + radio_ctrl_impl::set_rx_frequency(MAGNESIUM_CENTER_FREQ, chan); + radio_ctrl_impl::set_rx_gain(0, chan); + radio_ctrl_impl::set_rx_antenna(MAGNESIUM_DEFAULT_RX_ANTENNA, chan); + radio_ctrl_impl::set_rx_bandwidth(MAGNESIUM_DEFAULT_BANDWIDTH, chan); + } + + for (size_t chan = 0; chan < num_tx_chans; chan++) { + radio_ctrl_impl::set_tx_frequency(MAGNESIUM_CENTER_FREQ, chan); + radio_ctrl_impl::set_tx_gain(0, chan); + radio_ctrl_impl::set_tx_antenna(MAGNESIUM_DEFAULT_TX_ANTENNA, chan); + } +} + void magnesium_radio_ctrl_impl::_init_peripherals() { UHD_LOG_TRACE(unique_id(), "Initializing peripherals..."); @@ -75,6 +102,11 @@ void magnesium_radio_ctrl_impl::_init_peripherals() ); } ); + _update_atr_switches( + magnesium_cpld_ctrl::BOTH, + DX_DIRECTION, + radio_ctrl_impl::get_rx_antenna(0) + ); _tree->create<magnesium_cpld_ctrl::sptr>(cpld_path).set(_cpld); } else { UHD_LOG_TRACE(unique_id(), "Reusing someone else's CPLD object..."); @@ -156,33 +188,6 @@ void magnesium_radio_ctrl_impl::_init_peripherals() } } -void magnesium_radio_ctrl_impl::_init_defaults() -{ - UHD_LOG_TRACE(unique_id(), "Initializing defaults..."); - const size_t num_rx_chans = get_output_ports().size(); - const size_t num_tx_chans = get_input_ports().size(); - - UHD_LOG_TRACE(unique_id(), - "Num TX chans: " << num_tx_chans - << " Num RX chans: " << num_rx_chans); - UHD_LOG_TRACE(unique_id(), - "Setting tick rate to " << MAGNESIUM_TICK_RATE / 1e6 << " MHz"); - radio_ctrl_impl::set_rate(MAGNESIUM_TICK_RATE); - - for (size_t chan = 0; chan < num_rx_chans; chan++) { - radio_ctrl_impl::set_rx_frequency(MAGNESIUM_CENTER_FREQ, chan); - radio_ctrl_impl::set_rx_gain(0, chan); - radio_ctrl_impl::set_rx_antenna(MAGNESIUM_DEFAULT_RX_ANTENNA, chan); - radio_ctrl_impl::set_rx_bandwidth(MAGNESIUM_DEFAULT_BANDWIDTH, chan); - } - - for (size_t chan = 0; chan < num_tx_chans; chan++) { - radio_ctrl_impl::set_tx_frequency(MAGNESIUM_CENTER_FREQ, chan); - radio_ctrl_impl::set_tx_gain(0, chan); - radio_ctrl_impl::set_tx_antenna(MAGNESIUM_DEFAULT_TX_ANTENNA, chan); - } -} - void magnesium_radio_ctrl_impl::_init_frontend_subtree( uhd::property_tree::sptr subtree, const size_t chan_idx |