aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mpm/include/mpm/ad937x/ad937x_ctrl.hpp4
-rw-r--r--mpm/lib/mykonos/ad937x_ctrl.cpp13
-rw-r--r--mpm/lib/mykonos/ad937x_device.cpp88
-rw-r--r--mpm/lib/mykonos/ad937x_device.hpp6
-rw-r--r--mpm/lib/mykonos/config/ad937x_config_t.cpp22
-rw-r--r--mpm/lib/mykonos/config/ad937x_config_t.hpp4
-rw-r--r--mpm/lib/mykonos/config/ad937x_default_config.hpp2
-rw-r--r--mpm/python/usrp_mpm/dboard_manager/magnesium.py6
8 files changed, 135 insertions, 10 deletions
diff --git a/mpm/include/mpm/ad937x/ad937x_ctrl.hpp b/mpm/include/mpm/ad937x/ad937x_ctrl.hpp
index 21a6b2892..198e4e2d8 100644
--- a/mpm/include/mpm/ad937x/ad937x_ctrl.hpp
+++ b/mpm/include/mpm/ad937x/ad937x_ctrl.hpp
@@ -247,6 +247,9 @@ public:
*/
virtual bool get_lo_locked(const std::string &which) = 0;
+ //! set master clock rate
+ virtual void set_master_clock_rate(const double rate) = 0;
+
//! set the FIR filter for the frontend which
virtual void set_fir(const std::string &which, int8_t gain, const std::vector<int16_t> & fir) = 0;
@@ -277,6 +280,7 @@ void export_mykonos(){
LIBMPM_BOOST_PREAMBLE("ad937x")
using namespace mpm::chips;
bp::class_<ad937x_ctrl, boost::noncopyable, std::shared_ptr<ad937x_ctrl>>("ad937x_ctrl", bp::no_init)
+ .def("set_master_clock_rate", &ad937x_ctrl::set_master_clock_rate)
.def("begin_initialization", &ad937x_ctrl::begin_initialization)
.def("finish_initialization", &ad937x_ctrl::finish_initialization)
.def("update_rx_lo_source", &ad937x_ctrl::update_rx_lo_source)
diff --git a/mpm/lib/mykonos/ad937x_ctrl.cpp b/mpm/lib/mykonos/ad937x_ctrl.cpp
index 8aeb5b599..d6062c228 100644
--- a/mpm/lib/mykonos/ad937x_ctrl.cpp
+++ b/mpm/lib/mykonos/ad937x_ctrl.cpp
@@ -431,7 +431,6 @@ public:
virtual void set_fir(const std::string &which, int8_t gain, const std::vector<int16_t> & fir)
{
auto dir = _get_direction_from_antenna(which);
- auto chain = _get_chain_from_antenna(which);
auto lengths = _get_valid_fir_lengths(which);
if (std::find(lengths.begin(), lengths.end(), fir.size()) == lengths.end())
@@ -440,16 +439,15 @@ public:
}
std::lock_guard<std::mutex> lock(*spi_mutex);
- device.set_fir(dir, chain, gain, fir);
+ device.set_fir(dir, gain, fir);
}
virtual std::vector<int16_t> get_fir(const std::string &which, int8_t &gain)
{
auto dir = _get_direction_from_antenna(which);
- auto chain = _get_chain_from_antenna(which);
std::lock_guard<std::mutex> lock(*spi_mutex);
- return device.get_fir(dir, chain, gain);
+ return device.get_fir(dir, gain);
}
virtual int16_t get_temperature()
@@ -458,6 +456,13 @@ public:
return device.get_temperature();
}
+ virtual void set_master_clock_rate(const double rate)
+ {
+ std::lock_guard<std::mutex> lock(*spi_mutex);
+ // FIXME: Add check for valid rates
+ device.set_master_clock_rate(rate);
+ }
+
virtual void set_enable_gain_pins(const std::string &which, bool enable)
{
auto dir = _get_direction_from_antenna(which);
diff --git a/mpm/lib/mykonos/ad937x_device.cpp b/mpm/lib/mykonos/ad937x_device.cpp
index 4b7addc80..1d4a80c48 100644
--- a/mpm/lib/mykonos/ad937x_device.cpp
+++ b/mpm/lib/mykonos/ad937x_device.cpp
@@ -19,6 +19,8 @@
#include "adi/mykonos.h"
#include "adi/mykonos_gpio.h"
#include "adi/mykonos_debug/mykonos_dbgjesd.h"
+#include "config/ad937x_config_t.hpp"
+#include "config/ad937x_default_config.hpp"
#include <boost/format.hpp>
#include <functional>
@@ -643,7 +645,6 @@ void ad937x_device::set_agc_mode(const direction_t direction, const gain_mode_t
void ad937x_device::set_fir(
const direction_t direction,
- const chain_t chain,
int8_t gain,
const std::vector<int16_t> & fir)
{
@@ -778,7 +779,6 @@ double ad937x_device::get_gain(const direction_t direction, const chain_t chain)
std::vector<int16_t> ad937x_device::get_fir(
const direction_t direction,
- const chain_t chain,
int8_t &gain)
{
switch (direction)
@@ -800,3 +800,87 @@ int16_t ad937x_device::get_temperature()
return status.tempCode;
}
+
+void ad937x_device::set_master_clock_rate(const double rate)
+{
+ if (rate == 125000000)
+ {
+ mykonos_config.device->clocks->deviceClock_kHz = 125000;
+ mykonos_config.device->clocks->clkPllVcoFreq_kHz = 10000000;
+ mykonos_config.device->clocks->clkPllVcoDiv = ::VCODIV_2;
+ set_fir(TX_DIRECTION,
+ mykonos_config.device->tx->txProfile->txFir->gain_dB,
+ std::vector<int16_t>(ad937x_config_t::DEFAULT_TX_FIR,
+ ad937x_config_t::DEFAULT_TX_FIR + ad937x_config_t::DEFAULT_TX_FIR_SIZE)
+ );
+ mykonos_config.device->tx->txProfile->iqRate_kHz = 125000;
+ mykonos_config.device->tx->txProfile->primarySigBandwidth_Hz = 20000000;
+ mykonos_config.device->tx->txProfile->rfBandwidth_Hz = 102000000;
+ mykonos_config.device->tx->txProfile->txDac3dBCorner_kHz = 722000;
+ mykonos_config.device->tx->txProfile->txBbf3dBCorner_kHz = 51000;
+
+ set_fir(RX_DIRECTION,
+ mykonos_config.device->rx->rxProfile->rxFir->gain_dB,
+ std::vector<int16_t>(ad937x_config_t::DEFAULT_RX_FIR,
+ ad937x_config_t::DEFAULT_RX_FIR + ad937x_config_t::DEFAULT_RX_FIR_SIZE)
+ );
+
+ mykonos_config.device->rx->rxProfile->iqRate_kHz = 125000;
+ mykonos_config.device->rx->rxProfile->rxBbf3dBCorner_kHz = 102000;
+
+ mykonos_config.device->obsRx->orxProfile->iqRate_kHz = 125000;
+ mykonos_config.device->obsRx->orxProfile->rxBbf3dBCorner_kHz = 102000;
+ } else if (rate == 122880000){
+ mykonos_config.device->clocks->deviceClock_kHz = 122880;
+ mykonos_config.device->clocks->clkPllVcoFreq_kHz = 9830400;
+ mykonos_config.device->clocks->clkPllVcoDiv = ::VCODIV_2;
+ set_fir(TX_DIRECTION,
+ mykonos_config.device->tx->txProfile->txFir->gain_dB,
+ std::vector<int16_t>(ad937x_config_t::DEFAULT_TX_FIR,
+ ad937x_config_t::DEFAULT_TX_FIR + ad937x_config_t::DEFAULT_TX_FIR_SIZE)
+ );
+ mykonos_config.device->tx->txProfile->iqRate_kHz = 122880;
+ mykonos_config.device->tx->txProfile->primarySigBandwidth_Hz = 20000000;
+ mykonos_config.device->tx->txProfile->rfBandwidth_Hz = 100000000;
+ mykonos_config.device->tx->txProfile->txDac3dBCorner_kHz = 710539;
+ mykonos_config.device->tx->txProfile->txBbf3dBCorner_kHz = 50000;
+
+ set_fir(RX_DIRECTION,
+ mykonos_config.device->rx->rxProfile->rxFir->gain_dB,
+ std::vector<int16_t>(ad937x_config_t::DEFAULT_RX_FIR,
+ ad937x_config_t::DEFAULT_RX_FIR + ad937x_config_t::DEFAULT_RX_FIR_SIZE)
+ );
+ mykonos_config.device->rx->rxProfile->iqRate_kHz = 122880;
+ mykonos_config.device->rx->rxProfile->rxBbf3dBCorner_kHz = 100000;
+
+ mykonos_config.device->obsRx->orxProfile->iqRate_kHz = 122880;
+ mykonos_config.device->obsRx->orxProfile->rxBbf3dBCorner_kHz = 100000;
+ } else if (rate == 153660000){
+ mykonos_config.device->clocks->deviceClock_kHz = 153600;
+ mykonos_config.device->clocks->clkPllVcoFreq_kHz = 6144000;
+ mykonos_config.device->clocks->clkPllVcoDiv = ::VCODIV_1;
+ set_fir(TX_DIRECTION,
+ mykonos_config.device->tx->txProfile->txFir->gain_dB,
+ std::vector<int16_t>(ad937x_config_t::DEFAULT_TX_FIR_15366,
+ ad937x_config_t::DEFAULT_TX_FIR_15366 + ad937x_config_t::DEFAULT_TX_FIR_SIZE)
+ );
+ mykonos_config.device->tx->txProfile->iqRate_kHz = 153600;
+ mykonos_config.device->tx->txProfile->primarySigBandwidth_Hz = 10000000;
+ mykonos_config.device->tx->txProfile->rfBandwidth_Hz = 100000000;
+ mykonos_config.device->tx->txProfile->txDac3dBCorner_kHz = 100000;
+ mykonos_config.device->tx->txProfile->txBbf3dBCorner_kHz = 100000;
+
+ set_fir(RX_DIRECTION,
+ mykonos_config.device->rx->rxProfile->rxFir->gain_dB,
+ std::vector<int16_t>(ad937x_config_t::DEFAULT_RX_FIR_15366,
+ ad937x_config_t::DEFAULT_RX_FIR_15366 + ad937x_config_t::DEFAULT_RX_FIR_SIZE)
+ );
+ mykonos_config.device->rx->rxProfile->iqRate_kHz = 153600;
+ mykonos_config.device->rx->rxProfile->rxBbf3dBCorner_kHz = 100000;
+
+ mykonos_config.device->obsRx->orxProfile->iqRate_kHz = 153600;
+ mykonos_config.device->obsRx->orxProfile->rxBbf3dBCorner_kHz = 225000;
+ } else {
+ MPM_THROW_INVALID_CODE_PATH();
+ }
+}
diff --git a/mpm/lib/mykonos/ad937x_device.hpp b/mpm/lib/mykonos/ad937x_device.hpp
index c816680c4..60f78d2e5 100644
--- a/mpm/lib/mykonos/ad937x_device.hpp
+++ b/mpm/lib/mykonos/ad937x_device.hpp
@@ -51,6 +51,7 @@ public:
mpm::types::regs_iface* iface,
mpm::ad937x::gpio::gain_pins_t gain_pins
);
+
void begin_initialization();
void finish_initialization();
void setup_cal(uint32_t init_cals_mask, uint32_t tracking_cals_mask, uint32_t timeout);
@@ -83,8 +84,8 @@ public:
bool get_pll_lock_status(uint8_t pll, bool wait_for_lock = false);
- void set_fir(uhd::direction_t direction, mpm::ad937x::device::chain_t chain, int8_t gain, const std::vector<int16_t> & fir);
- std::vector<int16_t> get_fir(uhd::direction_t direction, mpm::ad937x::device::chain_t chain, int8_t &gain);
+ void set_fir(uhd::direction_t direction, int8_t gain, const std::vector<int16_t> & fir);
+ std::vector<int16_t> get_fir(uhd::direction_t direction, int8_t &gain);
int16_t get_temperature();
@@ -94,6 +95,7 @@ public:
void update_tx_lo_source(uint8_t rxPllUseExternalLo);
uint8_t get_rx_lo_source();
uint8_t get_tx_lo_source();
+ void set_master_clock_rate(const double rate);
const static double MIN_FREQ;
const static double MAX_FREQ;
const static double MIN_RX_GAIN;
diff --git a/mpm/lib/mykonos/config/ad937x_config_t.cpp b/mpm/lib/mykonos/config/ad937x_config_t.cpp
index 68d1f27bf..a9455502c 100644
--- a/mpm/lib/mykonos/config/ad937x_config_t.cpp
+++ b/mpm/lib/mykonos/config/ad937x_config_t.cpp
@@ -21,19 +21,41 @@
const int16_t ad937x_config_t::DEFAULT_TX_FIR[DEFAULT_TX_FIR_SIZE] =
{ -94, -26, 282, 177, -438, -368, 756, 732,-1170,-1337, 1758, 2479,-2648,-5088, 4064,16760,
16759, 4110,-4881,-2247, 2888, 1917,-1440,-1296, 745, 828, -358, -474, 164, 298, -16, -94 };
+
+const int16_t ad937x_config_t::DEFAULT_TX_FIR_15366[DEFAULT_TX_FIR_SIZE] =
+ { 4, -16, -5, 75, -13, -229, 85, 547, -293,-1158, 738, 2290,-1640,-4805, 3687,17108,
+ 17108, 3687,-4805,-1640, 2290, 738,-1158, -293, 547, 85, -229, -13, 75, -5, -16, 4 };
+
const int16_t ad937x_config_t::DEFAULT_RX_FIR[DEFAULT_RX_FIR_SIZE] =
{ -20, 6, 66, 22, -128, -54, 240, 126, -402, -248, 634, 444, -956, -756, 1400, 1244,
-2028,-2050, 2978, 3538,-4646,-7046, 9536,30880,30880, 9536,-7046,-4646, 3538, 2978,-2050,-2028,
1244, 1400, -756, -956, 444, 634, -248, -402, 126, 240, -54, -128, 22, 66, 6, -20 };
+
+const int16_t ad937x_config_t::DEFAULT_RX_FIR_15366[DEFAULT_RX_FIR_SIZE] =
+ { -16, -22, 18, 74, 24, -132, -152, 132, 372, 38, -598, -474, 638, 1178, -206,-1952,
+ -984, 2362, 3152,-1612,-6544,-2164,12806,26836,26836,12806,-2164,-6544,-1612, 3152, 2362, -984,
+ -1952, -206, 1178, 638, -474, -598, 38, 372, 132, -152, -132, 24, 74, 18, -22, -16 };
+
const int16_t ad937x_config_t::DEFAULT_OBSRX_FIR[DEFAULT_RX_FIR_SIZE] =
{ -14, -19, 44, 41, -89, -95, 175, 178, -303, -317, 499, 527, -779, -843, 1184, 1317,
-1781,-2059, 2760, 3350,-4962,-7433, 9822,32154,32154, 9822,-7433,-4962, 3350, 2760,-2059,-1781,
1317, 1184, -843, -779, 527, 499, -317, -303, 178, 175, -95, -89, 41, 44, -19, -14 };
+
+const int16_t ad937x_config_t::DEFAULT_OBSRX_FIR_15366[DEFAULT_RX_FIR_SIZE] =
+ { -2, 3, 12, -19, -28, 44, 74, -92, -169, 150, 353, -203, -671, 203, 1179, -66,
+ -1952, -347, 3153, 1307,-5595,-4820,11323,29525,29525,11323,-4820,-5595, 1307, 3153, -347,-1952,
+ -66, 1179, 203, -671, -203, 353, 150, -169, -92, 74, 44, -28, -19, 12, 3, -2 };
+
const int16_t ad937x_config_t::DEFAULT_SNIFFER_FIR[DEFAULT_RX_FIR_SIZE] =
{ -1, -5, -14, -23, -16, 24, 92, 137, 80, -120, -378, -471, -174, 507, 1174, 1183,
98,-1771,-3216,-2641, 942, 7027,13533,17738,17738,13533, 7027, 942,-2641,-3216,-1771, 98,
1183, 1174, 507, -174, -471, -378, -120, 80, 137, 92, 24, -16, -23, -14, -5, -1 };
+const int16_t ad937x_config_t::DEFAULT_SNIFFER_FIR_15366[DEFAULT_RX_FIR_SIZE] =
+ { 10, 31, 59, 71, 30, -92, -283, -456, -466, -175, 440, 1192, 1683, 1444, 198,-1871,
+ -3988, -4942,-3512, 958, 8118,16519,23993,28395,28395,23993,16519, 8118, 958,-3512,-4942,-3988,
+ -1871, 198, 1444, 1683, 1192, 440, -175, -466, -456, -283, -92, 30, 71, 59, 31, 10 };
+
ad937x_config_t::ad937x_config_t(spiSettings_t* sps) :
_rx(DEFAULT_RX_SETTINGS),
_rxProfile(DEFAULT_RX_PROFILE),
diff --git a/mpm/lib/mykonos/config/ad937x_config_t.hpp b/mpm/lib/mykonos/config/ad937x_config_t.hpp
index e44039ebe..41d9e9b61 100644
--- a/mpm/lib/mykonos/config/ad937x_config_t.hpp
+++ b/mpm/lib/mykonos/config/ad937x_config_t.hpp
@@ -37,9 +37,13 @@ public:
static const int32_t DEFAULT_RX_FIR_GAIN = -6;
static const int16_t DEFAULT_TX_FIR[DEFAULT_TX_FIR_SIZE];
+ static const int16_t DEFAULT_TX_FIR_15366[DEFAULT_TX_FIR_SIZE];
static const int16_t DEFAULT_RX_FIR[DEFAULT_RX_FIR_SIZE];
+ static const int16_t DEFAULT_RX_FIR_15366[DEFAULT_RX_FIR_SIZE];
static const int16_t DEFAULT_OBSRX_FIR[DEFAULT_RX_FIR_SIZE];
+ static const int16_t DEFAULT_OBSRX_FIR_15366[DEFAULT_RX_FIR_SIZE];
static const int16_t DEFAULT_SNIFFER_FIR[DEFAULT_RX_FIR_SIZE];
+ static const int16_t DEFAULT_SNIFFER_FIR_15366[DEFAULT_RX_FIR_SIZE];
void set_rx_pll_use_external_lo(uint8_t val);
uint8_t get_rx_pll_use_external_lo();
void set_tx_pll_use_external_lo(uint8_t val);
diff --git a/mpm/lib/mykonos/config/ad937x_default_config.hpp b/mpm/lib/mykonos/config/ad937x_default_config.hpp
index ccf750a30..d756a5cb2 100644
--- a/mpm/lib/mykonos/config/ad937x_default_config.hpp
+++ b/mpm/lib/mykonos/config/ad937x_default_config.hpp
@@ -35,7 +35,7 @@ static const mykonosRxSettings_t DEFAULT_RX_SETTINGS =
};
static const mykonosRxProfile_t DEFAULT_RX_PROFILE =
-{ // Rx 100MHz, IQrate 122.88MHz, Dec5
+{ // Rx 100MHz, IQrate 125MSPS, Dec5
1, // The divider used to generate the ADC clock
nullptr, // Pointer to Rx FIR filter structure
2, // Rx FIR decimation (1,2,4)
diff --git a/mpm/python/usrp_mpm/dboard_manager/magnesium.py b/mpm/python/usrp_mpm/dboard_manager/magnesium.py
index 6c100e992..3841a4466 100644
--- a/mpm/python/usrp_mpm/dboard_manager/magnesium.py
+++ b/mpm/python/usrp_mpm/dboard_manager/magnesium.py
@@ -398,6 +398,10 @@ class Magnesium(DboardManagerBase):
}
self.cpld = MgCPLD(self._spi_ifaces['cpld'], self.log)
self.dboard_clk_control = DboardClockControl(self.dboard_ctrl_regs, self.log)
+ # Declare some attributes to make linter happy:
+ self.lmk = None
+ self.clock_synchronizer = None
+ self.jesdcore = None
def _power_on(self):
" Turn on power to daughterboard "
@@ -548,7 +552,7 @@ class Magnesium(DboardManagerBase):
)
_sync_db_clock(self.clock_synchronizer)
# Clocks and PPS are now fully active!
-
+ self.mykonos.set_master_clock_rate(self.master_clock_rate)
self.init_jesd(args)
self.mykonos.start_radio()
return True