summaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2012-06-17 18:05:14 -0700
committerJosh Blum <josh@joshknows.com>2012-06-18 15:53:28 -0700
commit76930c0358a32ca7f9e82ccd82543a55eeddade3 (patch)
treed604321303b17a1734d30f5fdb1490d2fb8bddc8 /host
parent3dd244bb9f17c7641f4a60b4e10f5978382432df (diff)
downloaduhd-76930c0358a32ca7f9e82ccd82543a55eeddade3.tar.gz
uhd-76930c0358a32ca7f9e82ccd82543a55eeddade3.tar.bz2
uhd-76930c0358a32ca7f9e82ccd82543a55eeddade3.zip
n2x0: only check for the GPSDO once after power up
We used to only check if the EEPROM was setup properly. But now we always check, but check only once after first power up, and disable the check if not found.
Diffstat (limited to 'host')
-rw-r--r--host/docs/gpsdo.rst3
-rw-r--r--host/lib/usrp/usrp2/fw_common.h1
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.cpp47
3 files changed, 42 insertions, 9 deletions
diff --git a/host/docs/gpsdo.rst b/host/docs/gpsdo.rst
index 3745900e6..a41e23df6 100644
--- a/host/docs/gpsdo.rst
+++ b/host/docs/gpsdo.rst
@@ -36,6 +36,9 @@ Installation instructions can be found here:
********************************************
Post-installation Task (N-Series only)
********************************************
+
+**Note:** The following instructions are only necessary for UHD 3.4.* and below.
+
This is necessary if you require absolute GPS time in your application
or need to communicate with the GPSDO to obtain location, satellite info, etc.
If you only require 10MHz and PPS signals for reference or MIMO use
diff --git a/host/lib/usrp/usrp2/fw_common.h b/host/lib/usrp/usrp2/fw_common.h
index 8fb8a0865..7e3de1497 100644
--- a/host/lib/usrp/usrp2/fw_common.h
+++ b/host/lib/usrp/usrp2/fw_common.h
@@ -58,6 +58,7 @@ typedef struct{
// Map for virtual firmware regs (not very big so we can keep it here for now)
#define U2_FW_REG_LOCK_TIME 0
#define U2_FW_REG_LOCK_GPID 1
+#define U2_FW_REG_HAS_GPSDO 3
#define U2_FW_REG_VER_MINOR 7
////////////////////////////////////////////////////////////////////////
diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp
index 3214975d1..42b1acc4c 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.cpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.cpp
@@ -463,19 +463,48 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr){
}
_tree->create<std::string>(tx_codec_path / "name").set("ad9777");
- ////////////////////////////////////////////////////////////////
- // create gpsdo control objects
- ////////////////////////////////////////////////////////////////
- if (_mbc[mb].iface->mb_eeprom["gpsdo"] == "internal"){
- _mbc[mb].gps = gps_ctrl::make(udp_simple::make_uart(udp_simple::make_connected(
- addr, BOOST_STRINGIZE(USRP2_UDP_UART_GPS_PORT)
- )));
- if(_mbc[mb].gps->gps_detected()) {
- BOOST_FOREACH(const std::string &name, _mbc[mb].gps->get_sensors()){
+ ////////////////////////////////////////////////////////////////////
+ // Create the GPSDO control
+ ////////////////////////////////////////////////////////////////////
+ static const boost::uint32_t dont_look_for_gpsdo = 0x1234abcdul;
+
+ //disable check for internal GPSDO when not the following:
+ switch(_mbc[mb].iface->get_rev()){
+ case usrp2_iface::USRP_N200:
+ case usrp2_iface::USRP_N210:
+ case usrp2_iface::USRP_N200_R4:
+ case usrp2_iface::USRP_N210_R4:
+ break;
+ default:
+ _mbc[mb].iface->pokefw(U2_FW_REG_HAS_GPSDO, dont_look_for_gpsdo);
+ }
+
+ //otherwise if not disabled, look for the internal GPSDO
+ if (_mbc[mb].iface->peekfw(U2_FW_REG_HAS_GPSDO) != dont_look_for_gpsdo)
+ {
+ UHD_MSG(status) << "Detecting internal GPSDO.... " << std::flush;
+ try{
+ _mbc[mb].gps = gps_ctrl::make(udp_simple::make_uart(udp_simple::make_connected(
+ addr, BOOST_STRINGIZE(USRP2_UDP_UART_GPS_PORT)
+ )));
+ }
+ catch(std::exception &e){
+ UHD_MSG(error) << "An error occurred making GPSDO control: " << e.what() << std::endl;
+ }
+ if (_mbc[mb].gps and _mbc[mb].gps->gps_detected())
+ {
+ UHD_MSG(status) << "found" << std::endl;
+ BOOST_FOREACH(const std::string &name, _mbc[mb].gps->get_sensors())
+ {
_tree->create<sensor_value_t>(mb_path / "sensors" / name)
.publish(boost::bind(&gps_ctrl::get_sensor, _mbc[mb].gps, name));
}
}
+ else
+ {
+ UHD_MSG(status) << "not found" << std::endl;
+ _mbc[mb].iface->pokefw(U2_FW_REG_HAS_GPSDO, dont_look_for_gpsdo);
+ }
}
////////////////////////////////////////////////////////////////