From eb4bedf3133ce1ed275d03b36839ec61d75f2e60 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Tue, 12 May 2020 13:52:38 -0700 Subject: twinrx: Provide power cal ID Note that the TwinRX has a different behaviour if two or one channel are enabled. For that reason, TwinRX requires 8 different sets of calibration data: - For one vs. two channels - For channel 0 and channel 1 - For RX1 and RX2 Since every combination of these settings is possible, that results in 2^3 == 8 combinations. The choice of RX1 vs. RX2 is encoded in the calibration key. The choice of one vs. two channels is also encoded in the calibration key, and is derived using an expert node. Channel 0 and 1 are assumed symmetric, thus, the encoding for those happens in the calibration serial. --- host/lib/usrp/dboard/db_twinrx.cpp | 3 +++ host/lib/usrp/dboard/twinrx/twinrx_experts.cpp | 9 +++++++++ host/lib/usrp/dboard/twinrx/twinrx_experts.hpp | 7 +++++++ 3 files changed, 19 insertions(+) (limited to 'host/lib') diff --git a/host/lib/usrp/dboard/db_twinrx.cpp b/host/lib/usrp/dboard/db_twinrx.cpp index 258dc95a4..a7c57979d 100644 --- a/host/lib/usrp/dboard/db_twinrx.cpp +++ b/host/lib/usrp/dboard/db_twinrx.cpp @@ -195,6 +195,9 @@ public: prepend_ch("enabled", _ch_name), false, AUTO_RESOLVE_ON_WRITE); + // ID for cal data lookup. This depends on how many channels are enabled + expert_factory::add_prop_node( + _expert, get_rx_subtree(), "id", prepend_ch("id", _ch_name), "twinrx"); // Readback get_rx_subtree() diff --git a/host/lib/usrp/dboard/twinrx/twinrx_experts.cpp b/host/lib/usrp/dboard/twinrx/twinrx_experts.cpp index 36bcc1863..d196d99e2 100644 --- a/host/lib/usrp/dboard/twinrx/twinrx_experts.cpp +++ b/host/lib/usrp/dboard/twinrx/twinrx_experts.cpp @@ -459,6 +459,15 @@ void twinrx_antenna_expert::resolve() throw uhd::value_error( "Cannot calibrate channel 1 and export the LO for channel 0."); } + + // Set ID for power cal + if (_enabled_ch0 and _enabled_ch1) { + _id_ch0 = "twinrx2"; + _id_ch1 = "twinrx2"; + } else { + _id_ch0 = "twinrx"; + _id_ch1 = "twinrx"; + } } /*!--------------------------------------------------------- diff --git a/host/lib/usrp/dboard/twinrx/twinrx_experts.hpp b/host/lib/usrp/dboard/twinrx/twinrx_experts.hpp index c7e021a90..9d2269916 100644 --- a/host/lib/usrp/dboard/twinrx/twinrx_experts.hpp +++ b/host/lib/usrp/dboard/twinrx/twinrx_experts.hpp @@ -374,6 +374,8 @@ public: , _lo_export_ch1(db, prepend_ch("los/all/export", "1")) , _ant_mapping(db, "com/ant_mapping") , _cal_mode(db, "com/cal_mode") + , _id_ch0(db, prepend_ch("id", "0")) + , _id_ch1(db, prepend_ch("id", "1")) { bind_accessor(_antenna_ch0); bind_accessor(_antenna_ch1); @@ -383,6 +385,8 @@ public: bind_accessor(_lo_export_ch1); bind_accessor(_ant_mapping); bind_accessor(_cal_mode); + bind_accessor(_id_ch0); + bind_accessor(_id_ch1); } private: @@ -398,6 +402,9 @@ private: // Outputs experts::data_writer_t _ant_mapping; experts::data_writer_t _cal_mode; + + experts::data_writer_t _id_ch0; + experts::data_writer_t _id_ch1; }; /*!--------------------------------------------------------- -- cgit v1.2.3