diff options
author | Lane Kolbly <lane.kolbly@ni.com> | 2021-09-14 14:30:30 -0500 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2021-09-16 11:30:28 -0700 |
commit | 0ee2a409c4796f87d2d311356b775d437a5cc102 (patch) | |
tree | 2aaa63dbb7bb9846eda30f8227d4e8a7c587145b /host | |
parent | 1be44df0fc351975a6779bbe3cf7b2f08bf57a8e (diff) | |
download | uhd-0ee2a409c4796f87d2d311356b775d437a5cc102.tar.gz uhd-0ee2a409c4796f87d2d311356b775d437a5cc102.tar.bz2 uhd-0ee2a409c4796f87d2d311356b775d437a5cc102.zip |
uhd: zbx: Prevent TX antenna config from disrupting RX
So, both the set_tx_antenna_switches and set_rx_antenna_switches functions
configure the TX0_ANT_11 register (which controls the final switch before
the TX/RX port, switching it between the three TX paths and the RX path).
The RX antenna configuration code will, if the RX antenna is set to TX/RX,
configure that switch to the TX/RX->RX path when the ATR is set to RX.
However, the TX antenna config code will always configure that switch to
the "bypass" path, for both the 0X and RX ATR modes, regardless of whether
the RX side actually needs that path.
Ergo, this change makes set_tx_antenna_switches only configure that
switch when it is configuring the XX or TX modes.
Diffstat (limited to 'host')
-rw-r--r-- | host/lib/usrp/dboard/zbx/zbx_cpld_ctrl.cpp | 10 | ||||
-rw-r--r-- | host/tests/zbx_cpld_test.cpp | 20 |
2 files changed, 28 insertions, 2 deletions
diff --git a/host/lib/usrp/dboard/zbx/zbx_cpld_ctrl.cpp b/host/lib/usrp/dboard/zbx/zbx_cpld_ctrl.cpp index 8899f2a18..352a7def9 100644 --- a/host/lib/usrp/dboard/zbx/zbx_cpld_ctrl.cpp +++ b/host/lib/usrp/dboard/zbx/zbx_cpld_ctrl.cpp @@ -273,7 +273,10 @@ void zbx_cpld_ctrl::set_tx_antenna_switches( {tx_amp::HIGHBAND, {zbx_cpld_regs_t::TX0_ANT_11_HIGHBAND_AMP, zbx_cpld_regs_t::TX0_ANT_10_HIGHBAND_AMP}} }; // clang-format on - std::tie(_regs.TX0_ANT_11[idx], _regs.TX0_ANT_10[idx]) = amp_map.at(amp); + if (idx == ATR_ADDR_TX || idx == ATR_ADDR_XX) { + _regs.TX0_ANT_11[idx] = std::get<0>(amp_map.at(amp)); + } + _regs.TX0_ANT_10[idx] = std::get<1>(amp_map.at(amp)); } else if (antenna == ANTENNA_CAL_LOOPBACK) { _regs.TX0_ANT_10[idx] = zbx_cpld_regs_t::TX0_ANT_10_CAL_LOOPBACK; _regs.RX0_ANT_1[idx] = zbx_cpld_regs_t::RX0_ANT_1_CAL_LOOPBACK; @@ -294,7 +297,10 @@ void zbx_cpld_ctrl::set_tx_antenna_switches( {tx_amp::HIGHBAND, {zbx_cpld_regs_t::TX1_ANT_11_HIGHBAND_AMP, zbx_cpld_regs_t::TX1_ANT_10_HIGHBAND_AMP}} }; // clang-format on - std::tie(_regs.TX1_ANT_11[idx], _regs.TX1_ANT_10[idx]) = amp_map.at(amp); + if (idx == ATR_ADDR_TX || idx == ATR_ADDR_XX) { + _regs.TX1_ANT_11[idx] = std::get<0>(amp_map.at(amp)); + } + _regs.TX1_ANT_10[idx] = std::get<1>(amp_map.at(amp)); } else if (antenna == ANTENNA_CAL_LOOPBACK) { _regs.TX1_ANT_10[idx] = zbx_cpld_regs_t::TX1_ANT_10_CAL_LOOPBACK; _regs.RX1_ANT_1[idx] = zbx_cpld_regs_t::RX1_ANT_1_CAL_LOOPBACK; diff --git a/host/tests/zbx_cpld_test.cpp b/host/tests/zbx_cpld_test.cpp index b125e8435..861f6ccdd 100644 --- a/host/tests/zbx_cpld_test.cpp +++ b/host/tests/zbx_cpld_test.cpp @@ -77,6 +77,26 @@ BOOST_FIXTURE_TEST_CASE(zbx_cpld_ctrl_test, zbx_cpld_fixture) BOOST_CHECK_EQUAL(mock_reg_iface.memory[0x1024], 0x100); } +BOOST_FIXTURE_TEST_CASE(zbx_tx_ant_override_rx_test, zbx_cpld_fixture) +{ + cpld.set_rx_antenna_switches( + 0, uhd::usrp::zbx::ATR_ADDR_RX, uhd::usrp::zbx::ANTENNA_TXRX); + + cpld.set_tx_antenna_switches( + 0, ATR_ADDR_0X, uhd::usrp::zbx::ANTENNA_TXRX, tx_amp::HIGHBAND); + cpld.set_tx_antenna_switches( + 0, ATR_ADDR_RX, uhd::usrp::zbx::ANTENNA_TXRX, tx_amp::HIGHBAND); + cpld.set_tx_antenna_switches( + 0, ATR_ADDR_TX, uhd::usrp::zbx::ANTENNA_TXRX, tx_amp::HIGHBAND); + cpld.set_tx_antenna_switches( + 0, ATR_ADDR_XX, uhd::usrp::zbx::ANTENNA_TXRX, tx_amp::HIGHBAND); + + // Make sure that configuring the TX antenna switches didn't disconnect the RX + // from the TX/RX port. + BOOST_CHECK_EQUAL( + (mock_reg_iface.memory[0x2000 + 4 * uhd::usrp::zbx::ATR_ADDR_RX] >> 20) & 0x3, 0); +} + BOOST_FIXTURE_TEST_CASE(zbx_tx_amp_test, zbx_cpld_fixture) { cpld.set_tx_antenna_switches( |