diff options
Diffstat (limited to 'host')
-rw-r--r-- | host/docs/usrp2.rst | 48 | ||||
-rw-r--r-- | host/lib/usrp/mboard_eeprom.cpp | 23 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/mboard_impl.cpp | 20 |
3 files changed, 86 insertions, 5 deletions
diff --git a/host/docs/usrp2.rst b/host/docs/usrp2.rst index 161170f2c..2eb3ee796 100644 --- a/host/docs/usrp2.rst +++ b/host/docs/usrp2.rst @@ -345,3 +345,51 @@ Test the PPS input with the following app: cd <install-path>/share/uhd/examples ./test_pps_input --args=<args> + +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Internal GPSDO +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +USRP-N2XX models can have an optional internal GPSDO. +To use the GPSDO with UHD, you must burn an EEPROM setting +so that UHD knows that the internal GPSDO was installed. + +**Installation instructions:** + +1. Remove the daughterboard. +2. Move J510 jumper on the motherboard from 1-2 to 2-3 in order to switch from external 10 MHz Ref Clock to GPSDO’s 10 MHz Ref Clock +3. Screw the GPSDO module in place with the screws provided. The screws are treated to avoid loosening with vibration. +4. Connect the GPSDO power cable to J509 on the motherboard, and then to connector D on the GPSDO module +5. Connect an SMB to SMA cable between connectors B and J506 (PPS2) +6. Connect an SMB to SMA cable between connectors C and J507 (CLK REF2) +7. Connect the serial cable between connectors A and J312 (RS232-3) on the motherboard. If J312 on your USRP isn’t a keyed connector, please ensure to connect pin1 (TX) of connector A to pin3 (RX) on J312. +8. Remove the washer and nut from the MMCX to SMA-Bulkhead cable. Connect it to connector E and then insert SMA-Bulkhead connector through the hole in the rear panel. Tighten nut to fasten in place. +9. Replace the daughterboard pushing all the cables underneath. + +Then run the following commands: +:: + + cd <install-path>/share/uhd/utils + ./usrp_burn_mb_eeprom --args=<optional device args> --key=gpsdo --val=internal + +**Removal instructions:** + +Restore the jumper setting, disconnect the cables, and unscrew the GPSDO unit. +Then run the following commands: +:: + + cd <install-path>/share/uhd/utils + ./usrp_burn_mb_eeprom --args=<optional device args> --key=gpsdo --val=none + +------------------------------------------------------------------------ +Miscellaneous +------------------------------------------------------------------------ + +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Available Sensors +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +The following sensors are available for the USRP2/N-Series motherboards; +they can be queried through the API. + +* mimo_locked - clock reference locked over the MIMO cable +* ref_locked - clock reference locked (internal/external) +* gps_time - GPS seconds (available when GPSDO installed) diff --git a/host/lib/usrp/mboard_eeprom.cpp b/host/lib/usrp/mboard_eeprom.cpp index c90f4a2db..869a38478 100644 --- a/host/lib/usrp/mboard_eeprom.cpp +++ b/host/lib/usrp/mboard_eeprom.cpp @@ -74,10 +74,17 @@ static const uhd::dict<std::string, boost::uint8_t> USRP_N100_OFFSETS = boost::a ("mac-addr", 0x02) ("ip-addr", 0x0C) //leave space here for other addresses (perhaps) + ("gpsdo", 0x17) ("serial", 0x18) ("name", 0x18 + SERIAL_LEN) ; +enum n200_gpsdo_type{ + N200_GPSDO_NONE = 0, + N200_GPSDO_INTERNAL = 1, + N200_GPSDO_ONBOARD = 2 +}; + static void load_n100(mboard_eeprom_t &mb_eeprom, i2c_iface &iface){ //extract the revision number byte_vector_t rev_lsb_msb = iface.read_eeprom(N100_EEPROM_ADDR, USRP_N100_OFFSETS["rev-lsb-msb"], 2); @@ -93,6 +100,14 @@ static void load_n100(mboard_eeprom_t &mb_eeprom, i2c_iface &iface){ byte_copy(iface.read_eeprom(N100_EEPROM_ADDR, USRP_N100_OFFSETS["ip-addr"], 4), ip_addr_bytes); mb_eeprom["ip-addr"] = boost::asio::ip::address_v4(ip_addr_bytes).to_string(); + //gpsdo capabilities + boost::uint8_t gpsdo_byte = iface.read_eeprom(N100_EEPROM_ADDR, USRP_N100_OFFSETS["gpsdo"], 1).at(0); + switch(n200_gpsdo_type(gpsdo_byte)){ + case N200_GPSDO_INTERNAL: mb_eeprom["gpsdo"] = "internal"; break; + case N200_GPSDO_ONBOARD: mb_eeprom["gpsdo"] = "onboard"; break; + default: mb_eeprom["gpsdo"] = "none"; + } + //extract the serial mb_eeprom["serial"] = bytes_to_string(iface.read_eeprom( N100_EEPROM_ADDR, USRP_N100_OFFSETS["serial"], SERIAL_LEN @@ -136,6 +151,14 @@ static void store_n100(const mboard_eeprom_t &mb_eeprom, i2c_iface &iface){ iface.write_eeprom(N100_EEPROM_ADDR, USRP_N100_OFFSETS["ip-addr"], ip_addr_bytes); } + //gpsdo capabilities + if (mb_eeprom.has_key("gpsdo")){ + boost::uint8_t gpsdo_byte = N200_GPSDO_NONE; + if (mb_eeprom["gpsdo"] == "internal") gpsdo_byte = N200_GPSDO_INTERNAL; + if (mb_eeprom["gpsdo"] == "onboard") gpsdo_byte = N200_GPSDO_ONBOARD; + iface.write_eeprom(N100_EEPROM_ADDR, USRP_N100_OFFSETS["gpsdo"], byte_vector_t(1, gpsdo_byte)); + } + //store the serial if (mb_eeprom.has_key("serial")) iface.write_eeprom( N100_EEPROM_ADDR, USRP_N100_OFFSETS["serial"], diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp index 62cc3c403..ae098dba6 100644 --- a/host/lib/usrp/usrp2/mboard_impl.cpp +++ b/host/lib/usrp/usrp2/mboard_impl.cpp @@ -27,6 +27,7 @@ #include <uhd/utils/byteswap.hpp> #include <uhd/utils/algorithm.hpp> #include <uhd/types/sensors.hpp> +#include <boost/assign/list_of.hpp> #include <boost/bind.hpp> #include <iostream> @@ -101,9 +102,11 @@ usrp2_mboard_impl::usrp2_mboard_impl( //contruct the interfaces to mboard perifs _clock_ctrl = usrp2_clock_ctrl::make(_iface); _codec_ctrl = usrp2_codec_ctrl::make(_iface); - _gps_ctrl = gps_ctrl::make( - _iface->get_gps_write_fn(), - _iface->get_gps_read_fn()); + if (_iface->mb_eeprom["gpsdo"] == "internal"){ + _gps_ctrl = gps_ctrl::make( + _iface->get_gps_write_fn(), + _iface->get_gps_read_fn()); + } //init the dsp stuff (before setting update packets) dsp_init(); @@ -361,7 +364,14 @@ void usrp2_mboard_impl::get(const wax::obj &key_, wax::obj &val){ case MBOARD_PROP_CLOCK_RATE: val = this->get_master_clock_freq(); return; - + + case SUBDEV_PROP_SENSOR_NAMES:{ + prop_names_t names = boost::assign::list_of("mimo_locked")("ref_locked"); + if (_gps_ctrl.get()) names.push_back("gps_time"); + val = names; + } + return; + case MBOARD_PROP_SENSOR: if(key.name == "mimo_locked") { val = sensor_value_t("MIMO", this->get_mimo_locked(), "locked", "unlocked"); @@ -371,7 +381,7 @@ void usrp2_mboard_impl::get(const wax::obj &key_, wax::obj &val){ val = sensor_value_t("Ref", this->get_ref_locked(), "locked", "unlocked"); return; } - else if(key.name == "gps_time") { + else if(key.name == "gps_time" and _gps_ctrl.get()) { val = sensor_value_t("GPS time", int(_gps_ctrl->get_epoch_time()), "seconds"); } else { |