From a29b30fdf17b5703c9b5c5dd015f11ecd44fbdfe Mon Sep 17 00:00:00 2001
From: Josh Blum <josh@joshknows.com>
Date: Fri, 23 Apr 2010 15:59:22 -0700
Subject: XCVR seems to be working, fixed the spi reset routine.

---
 host/lib/ic_reg_maps/gen_max2829_regs.py |  2 +-
 host/lib/usrp/dboard/db_xcvr2450.cpp     | 22 +++++++++++++++-------
 2 files changed, 16 insertions(+), 8 deletions(-)

(limited to 'host')

diff --git a/host/lib/ic_reg_maps/gen_max2829_regs.py b/host/lib/ic_reg_maps/gen_max2829_regs.py
index 33dc3e641..7fef302a8 100755
--- a/host/lib/ic_reg_maps/gen_max2829_regs.py
+++ b/host/lib/ic_reg_maps/gen_max2829_regs.py
@@ -68,7 +68,7 @@ tx_cal_mode           6[1]          0                 dis, enb
 _set_to_1_6_10        6[10]         1
 iq_cal_gain           6[11:12]      3                 8db, 18db, 24db, 34db
 ########################################################################
-## Lopass Filter (7)
+## Lowpass Filter (7)
 ########################################################################
 rx_lpf_fine_adj       7[0:2]        2                 90, 95, 100, 105, 110
 rx_lpf_coarse_adj     7[3:4]        1                 7_5mhz, 9_5mhz, 14mhz, 18mhz
diff --git a/host/lib/usrp/dboard/db_xcvr2450.cpp b/host/lib/usrp/dboard/db_xcvr2450.cpp
index 4df40e980..2c2843d3a 100644
--- a/host/lib/usrp/dboard/db_xcvr2450.cpp
+++ b/host/lib/usrp/dboard/db_xcvr2450.cpp
@@ -58,6 +58,7 @@
 #include <uhd/usrp/dboard_manager.hpp>
 #include <boost/assign/list_of.hpp>
 #include <boost/format.hpp>
+#include <boost/thread.hpp>
 #include <boost/math/special_functions/round.hpp>
 #include <utility>
 
@@ -68,7 +69,7 @@ using namespace boost::assign;
 /***********************************************************************
  * The XCVR 2450 constants
  **********************************************************************/
-static const bool xcvr2450_debug = true;
+static const bool xcvr2450_debug = false;
 
 static const freq_range_t xcvr_freq_range(2.4e9, 6.0e9);
 
@@ -178,12 +179,14 @@ xcvr2450::xcvr2450(ctor_args_t const& args) : xcvr_dboard_base(args){
 
     //set defaults for LO, gains, antennas
     set_lo_freq(2.45e9);
-    set_rx_ant("J1");
-    set_tx_ant("J2");
-    set_rx_gain(0, "LNA");
-    set_rx_gain(0, "VGA");
-    set_tx_gain(0, "VGA");
-    set_tx_gain(0, "BB");
+    set_rx_ant(xcvr_antennas.at(0));
+    set_tx_ant(xcvr_antennas.at(1));
+    BOOST_FOREACH(const std::string &name, xcvr_tx_gain_ranges.keys()){
+        set_tx_gain(xcvr_tx_gain_ranges[name].min, name);
+    }
+    BOOST_FOREACH(const std::string &name, xcvr_rx_gain_ranges.keys()){
+        set_rx_gain(xcvr_rx_gain_ranges[name].min, name);
+    }
 }
 
 xcvr2450::~xcvr2450(void){
@@ -194,6 +197,11 @@ void xcvr2450::spi_reset(void){
     //spi reset mode: global enable = off, tx and rx enable = on
     this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_IDLE, TX_ENB_TXIO);
     this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, dboard_iface::ATR_REG_IDLE, RX_ENB_RXIO | POWER_DOWN_RXIO);
+    boost::this_thread::sleep(boost::posix_time::milliseconds(10));
+
+    //take it back out of spi reset mode and wait a bit
+    this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, dboard_iface::ATR_REG_IDLE, RX_DIS_RXIO | POWER_UP_RXIO);
+    boost::this_thread::sleep(boost::posix_time::milliseconds(10));
 }
 
 void xcvr2450::update_atr(void){
-- 
cgit v1.2.3