aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Chemeris <Alexander.Chemeris@gmail.com>2014-04-19 17:25:00 +0400
committerTom Tsou <tom.tsou@ettus.com>2015-05-18 16:48:17 -0700
commit4d029d8965022ac0de8488380a62e487a894b9f7 (patch)
treed453e0eb721b5a755c41ec80d9a16ba23449e993
parent6613331459351489436d9f91129a47750a46020f (diff)
UmTRX: Manually set Tx gain stages for the best signal quality.
New UHD versions support split configuration of Tx gain stages. We utilize this to set the gain configuration, optimal for the Tx signal quality. From our measurements, VGA1 must be 18dB plus-minus one and VGA2 is the best when 23dB or lower. Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
-rw-r--r--Transceiver52M/UHDDevice.cpp45
1 files changed, 41 insertions, 4 deletions
diff --git a/Transceiver52M/UHDDevice.cpp b/Transceiver52M/UHDDevice.cpp
index c9b71e1..0bb994e 100644
--- a/Transceiver52M/UHDDevice.cpp
+++ b/Transceiver52M/UHDDevice.cpp
@@ -48,6 +48,11 @@
*/
#define UHD_RESTART_TIMEOUT 1.0
+/*
+ * UmTRX specific settings
+ */
+#define UMTRX_VGA1_DEF -18
+
enum uhd_dev_type {
USRP1,
USRP2,
@@ -449,9 +454,25 @@ void uhd_device::init_gains()
{
uhd::gain_range_t range;
- range = usrp_dev->get_tx_gain_range();
- tx_gain_min = range.start();
- tx_gain_max = range.stop();
+ if (dev_type == UMTRX) {
+ std::vector<std::string> gain_stages = usrp_dev->get_tx_gain_names(0);
+ if (gain_stages[0] == "VGA") {
+ LOG(WARNING) << "Update your UHD version for a proper Tx gain support";
+ }
+ if (gain_stages[0] == "VGA" || gain_stages[0] == "PA") {
+ range = usrp_dev->get_tx_gain_range();
+ tx_gain_min = range.start();
+ tx_gain_max = range.stop();
+ } else {
+ range = usrp_dev->get_tx_gain_range("VGA2");
+ tx_gain_min = UMTRX_VGA1_DEF + range.start();
+ tx_gain_max = UMTRX_VGA1_DEF + range.stop();
+ }
+ } else {
+ range = usrp_dev->get_tx_gain_range();
+ tx_gain_min = range.start();
+ tx_gain_max = range.stop();
+ }
range = usrp_dev->get_rx_gain_range();
rx_gain_min = range.start();
@@ -542,7 +563,23 @@ double uhd_device::setTxGain(double db, size_t chan)
return 0.0f;
}
- usrp_dev->set_tx_gain(db, chan);
+ if (dev_type == UMTRX) {
+ std::vector<std::string> gain_stages = usrp_dev->get_tx_gain_names(0);
+ if (gain_stages[0] == "VGA" || gain_stages[0] == "PA") {
+ usrp_dev->set_tx_gain(db, chan);
+ } else {
+ // New UHD versions support split configuration of
+ // Tx gain stages. We utilize this to set the gain
+ // configuration, optimal for the Tx signal quality.
+ // From our measurements, VGA1 must be 18dB plus-minus
+ // one and VGA2 is the best when 23dB or lower.
+ usrp_dev->set_tx_gain(UMTRX_VGA1_DEF, "VGA1", chan);
+ usrp_dev->set_tx_gain(db-UMTRX_VGA1_DEF, "VGA2", chan);
+ }
+ } else {
+ usrp_dev->set_tx_gain(db, chan);
+ }
+
tx_gains[chan] = usrp_dev->get_tx_gain(chan);
LOG(INFO) << "Set TX gain to " << tx_gains[chan] << "dB";