summaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
Diffstat (limited to 'host')
-rw-r--r--host/docs/usrp2.rst46
-rw-r--r--host/include/uhd/transport/bounded_buffer.ipp13
-rw-r--r--host/lib/transport/udp_zero_copy_asio.cpp4
-rw-r--r--host/lib/usrp/gps_ctrl.cpp16
-rw-r--r--host/lib/usrp/subdev_spec.cpp2
-rw-r--r--host/lib/usrp/usrp2/mboard_impl.cpp6
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.cpp7
-rw-r--r--host/lib/utils/paths.cpp1
8 files changed, 55 insertions, 40 deletions
diff --git a/host/docs/usrp2.rst b/host/docs/usrp2.rst
index 2ee49646f..70101bd87 100644
--- a/host/docs/usrp2.rst
+++ b/host/docs/usrp2.rst
@@ -81,7 +81,7 @@ The safe-mode button is a pushbutton switch (S2) located inside the enclosure.
To boot into the safe image, hold-down the safe-mode button while power-cycling the device.
Continue to hold-down the button until the front-panel LEDs blink and remain solid.
-When in safe-mode, the USRP-N Series will always have the IP address 192.168.10.2
+When in safe-mode, the USRP-N device will always have the IP address 192.168.10.2
------------------------------------------------------------------------
Setup networking
@@ -154,31 +154,53 @@ Run the following commands:
cd <prefix>/share/uhd/utils
sudo ./usrp2_recovery.py --ifc=eth0 --new-ip=192.168.10.3
+------------------------------------------------------------------------
+Communication problems
+------------------------------------------------------------------------
+When setting up a development machine for the first time,
+you may have various difficulties communicating with the USRP device.
+The following tips are designed to help narrow-down and diagnose the problem.
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-Debugging networking problems
+Firewall issues
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-**Disable the firewall:**
-If uhd_find_devices gives you nothing
-but uhd_find_devices --args addr=192.168.10.2 yeilds a discovered device,
+When the IP address is not specified,
+the device discovery sends broadcast UDP packets from each ethernet interface.
+Many firewalls will block the replies to these broadcast packets.
+If disabling your system's firewall,
+or specifying the IP address yeilds a discovered device,
then your firewall may be blocking replies to UDP broadcast packets.
+If this is the case, we recommend that you disable the firewall,
+or create a rule to allow all incoming packets with UDP source port 49152.
+
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Ping the device
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+The USRP will reply to icmp echo requests.
+A successful ping response means that the device has booted properly,
+and that it is using the expected IP address.
-**Ping the USRP2:**
-The USRP2 will reply to icmp echo requests.
::
ping 192.168.10.2
-**Monitor the serial output:**
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Monitor the serial output
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Read the serial port to get debug verbose from the embedded microcontroller.
-Use a standard USB to 3.3v-level serial converter at 230400 baud.
The microcontroller prints useful information about IP addresses,
-MAC addresses, control packets, and fast-path settings.
+MAC addresses, control packets, fast-path settings, and bootloading.
+Use a standard USB to 3.3v-level serial converter at 230400 baud.
+Connect GND to the converter ground, and connect TXD to the converter receive.
+The RXD pin can be left unconnected as this is only a one-way communication.
* **USRP2:** Serial port located on the rear edge
* **N210:** Serial port located on the left side
-**Monitor the host network traffic:**
-Use wireshark to monitor packets sent to and received from the USRP2.
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Monitor the host network traffic
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Use wireshark to monitor packets sent to and received from the device.
------------------------------------------------------------------------
Addressing the device
diff --git a/host/include/uhd/transport/bounded_buffer.ipp b/host/include/uhd/transport/bounded_buffer.ipp
index f7915d866..4fbe3f085 100644
--- a/host/include/uhd/transport/bounded_buffer.ipp
+++ b/host/include/uhd/transport/bounded_buffer.ipp
@@ -22,6 +22,7 @@
#include <boost/function.hpp>
#include <boost/circular_buffer.hpp>
#include <boost/thread/condition.hpp>
+#include <boost/thread/locks.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
namespace uhd{ namespace transport{ namespace{ /*anon*/
@@ -36,7 +37,7 @@ namespace uhd{ namespace transport{ namespace{ /*anon*/
}
UHD_INLINE bool push_with_pop_on_full(const elem_type &elem){
- boost::unique_lock<boost::mutex> lock(_mutex);
+ boost::mutex::scoped_lock lock(_mutex);
if(_buffer.full()){
_buffer.pop_back();
_buffer.push_front(elem);
@@ -53,7 +54,7 @@ namespace uhd{ namespace transport{ namespace{ /*anon*/
}
UHD_INLINE void push_with_wait(const elem_type &elem){
- boost::unique_lock<boost::mutex> lock(_mutex);
+ boost::mutex::scoped_lock lock(_mutex);
_full_cond.wait(lock, _not_full_fcn);
_buffer.push_front(elem);
lock.unlock();
@@ -61,7 +62,7 @@ namespace uhd{ namespace transport{ namespace{ /*anon*/
}
UHD_INLINE bool push_with_timed_wait(const elem_type &elem, double timeout){
- boost::unique_lock<boost::mutex> lock(_mutex);
+ boost::mutex::scoped_lock lock(_mutex);
if (not _full_cond.timed_wait(
lock, to_time_dur(timeout), _not_full_fcn
)) return false;
@@ -72,7 +73,7 @@ namespace uhd{ namespace transport{ namespace{ /*anon*/
}
UHD_INLINE void pop_with_wait(elem_type &elem){
- boost::unique_lock<boost::mutex> lock(_mutex);
+ boost::mutex::scoped_lock lock(_mutex);
_empty_cond.wait(lock, _not_empty_fcn);
elem = this->pop_back();
lock.unlock();
@@ -80,7 +81,7 @@ namespace uhd{ namespace transport{ namespace{ /*anon*/
}
UHD_INLINE bool pop_with_timed_wait(elem_type &elem, double timeout){
- boost::unique_lock<boost::mutex> lock(_mutex);
+ boost::mutex::scoped_lock lock(_mutex);
if (not _empty_cond.timed_wait(
lock, to_time_dur(timeout), _not_empty_fcn
)) return false;
@@ -91,7 +92,7 @@ namespace uhd{ namespace transport{ namespace{ /*anon*/
}
UHD_INLINE void clear(void){
- boost::unique_lock<boost::mutex> lock(_mutex);
+ boost::mutex::scoped_lock lock(_mutex);
while (not_empty()) this->pop_back();
lock.unlock();
_full_cond.notify_one();
diff --git a/host/lib/transport/udp_zero_copy_asio.cpp b/host/lib/transport/udp_zero_copy_asio.cpp
index 5c049cfad..3826dcd79 100644
--- a/host/lib/transport/udp_zero_copy_asio.cpp
+++ b/host/lib/transport/udp_zero_copy_asio.cpp
@@ -353,14 +353,10 @@ template<typename Opt> static void resize_buff_helper(
"See the transport application notes on buffer resizing.\n%s"
) % name % min_sock_buff_size % help_message));
}
-
- //only enable on platforms that are happy with the large buffer resize
- #if defined(UHD_PLATFORM_LINUX) || defined(UHD_PLATFORM_WIN32)
//otherwise, ensure that the buffer is at least the minimum size
else if (udp_trans->get_buff_size<Opt>() < min_sock_buff_size){
resize_buff_helper<Opt>(udp_trans, min_sock_buff_size, name);
}
- #endif /*defined(UHD_PLATFORM_LINUX) || defined(UHD_PLATFORM_WIN32)*/
}
udp_zero_copy::sptr udp_zero_copy::make(
diff --git a/host/lib/usrp/gps_ctrl.cpp b/host/lib/usrp/gps_ctrl.cpp
index 3c7c00134..b1062fa39 100644
--- a/host/lib/usrp/gps_ctrl.cpp
+++ b/host/lib/usrp/gps_ctrl.cpp
@@ -58,7 +58,7 @@ public:
if(trim_right_copy(reply) == "Command Error") {
gps_type = GPS_TYPE_JACKSON_LABS;
break;
- }
+ }
else if(reply.substr(0, 3) == "$GP") i_heard_some_nmea = true; //but keep looking for that "Command Error" response
else if(reply.length() != 0) i_heard_something_weird = true; //probably wrong baud rate
boost::this_thread::sleep(boost::posix_time::milliseconds(200));
@@ -104,6 +104,7 @@ public:
found_gprmc = true;
break;
}
+ boost::this_thread::sleep(boost::posix_time::milliseconds(200));
}
if(!found_gprmc) {
if(gps_type == GPS_TYPE_JACKSON_LABS) std::cout << "Firefly GPS not locked or warming up." << std::endl;
@@ -127,16 +128,7 @@ public:
//TODO: this isn't generalizeable to non-USRP2 USRPs.
std::string safe_gps_read() {
- std::string reply;
- try {
- reply = _recv();
- } catch (std::runtime_error err) {
- if(err.what() != std::string("usrp2 no control response")) throw; //sorry can't cope with that
- else { //we don't actually have a GPS installed
- reply = std::string();
- }
- }
- return reply;
+ return _recv();
}
ptime get_time(void) {
@@ -196,7 +188,7 @@ private:
GPS_TYPE_NONE
} gps_type;
- static const int GPS_TIMEOUT_TRIES = 5;
+ static const int GPS_TIMEOUT_TRIES = 10;
static const int GPS_TIMEOUT_DELAY_MS = 200;
static const int FIREFLY_STUPID_DELAY_MS = 200;
diff --git a/host/lib/usrp/subdev_spec.cpp b/host/lib/usrp/subdev_spec.cpp
index 51c88bda3..d5d950f1f 100644
--- a/host/lib/usrp/subdev_spec.cpp
+++ b/host/lib/usrp/subdev_spec.cpp
@@ -46,7 +46,7 @@ bool usrp::operator==(const subdev_spec_pair_t &lhs, const subdev_spec_pair_t &r
subdev_spec_t::subdev_spec_t(const std::string &markup){
BOOST_FOREACH(const std::string &pair, pair_tokenizer(markup)){
- if (pair == "") continue;
+ if (pair.empty()) continue;
std::vector<std::string> db_sd; boost::split(db_sd, pair, boost::is_any_of(":"));
switch(db_sd.size()){
case 1: this->push_back(subdev_spec_pair_t("", db_sd.front())); break;
diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp
index 95f7013e7..ee7ad99c5 100644
--- a/host/lib/usrp/usrp2/mboard_impl.cpp
+++ b/host/lib/usrp/usrp2/mboard_impl.cpp
@@ -66,9 +66,9 @@ 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());
+// _gps_ctrl = gps_ctrl::make(
+// _iface->get_gps_write_fn(),
+// _iface->get_gps_read_fn());
//if(_gps_ctrl->gps_detected()) std::cout << "GPS time: " << _gps_ctrl->get_time() << std::endl;
diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp
index 059ddf65f..9ce0f7359 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.cpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.cpp
@@ -202,8 +202,11 @@ static device::sptr usrp2_make(const device_addr_t &device_addr){
//setup the dsp transport hints (default to a large recv buff)
device_addr_t dsp_xport_hints = device_addr;
if (not dsp_xport_hints.has_key("recv_buff_size")){
- //set to half-a-second of buffering at max rate
- dsp_xport_hints["recv_buff_size"] = "50e6";
+ //only enable on platforms that are happy with the large buffer resize
+ #if defined(UHD_PLATFORM_LINUX) || defined(UHD_PLATFORM_WIN32)
+ //set to half-a-second of buffering at max rate
+ dsp_xport_hints["recv_buff_size"] = "50e6";
+ #endif /*defined(UHD_PLATFORM_LINUX) || defined(UHD_PLATFORM_WIN32)*/
}
//create a ctrl and data transport for each address
diff --git a/host/lib/utils/paths.cpp b/host/lib/utils/paths.cpp
index 93d15d290..8d604d849 100644
--- a/host/lib/utils/paths.cpp
+++ b/host/lib/utils/paths.cpp
@@ -64,6 +64,7 @@ static std::vector<fs::path> get_env_paths(const std::string &var_name){
//convert to filesystem path, filter blank paths
std::vector<fs::path> paths;
+ if (var_value.empty()) return paths; //FIXME boost tokenizer throws w/ blank strings on some platforms
BOOST_FOREACH(const std::string &path_string, path_tokenizer(var_value)){
if (path_string.empty()) continue;
paths.push_back(fs::system_complete(path_string));