diff options
Diffstat (limited to 'host')
| -rw-r--r-- | host/docs/usrp2.rst | 25 | ||||
| -rw-r--r-- | host/lib/transport/udp_zero_copy_asio.cpp | 12 | ||||
| -rw-r--r-- | host/lib/usrp/usrp2/usrp2_impl.cpp | 15 | 
3 files changed, 41 insertions, 11 deletions
| diff --git a/host/docs/usrp2.rst b/host/docs/usrp2.rst index d3ae1dec7..76b27fd31 100644 --- a/host/docs/usrp2.rst +++ b/host/docs/usrp2.rst @@ -88,7 +88,7 @@ Setup the host interface  The USRP2 communicates at the IP/UDP layer over the gigabit ethernet.  The default IP address of the USRP2 is **192.168.10.2**  You will need to configure the host's ethernet interface with a static IP address to enable communication. -An address of **192.168.10.1** is recommended. +An address of **192.168.10.1** and a subnet mask of **255.255.255.0** is recommended.  **Note:**  When using the UHD, if an IP address for the USRP2 is not specified, @@ -97,6 +97,26 @@ On some systems, the firewall will block UDP broadcast packets.  It is recommended that you change or disable your firewall settings.   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Multiple device configuration +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +As described above, you will need one ethernet interface per USRP2. +Each ethernet interface should have its own subnet, +and the corresponding USRP2 device should be assigned an address in that subnet. +Example: + +**Configuration for USRP2 device 0:** + +* Ethernet interface IPv4 address: 192.168.10.1 +* Ethernet interface subnet mask: 255.255.255.0 +* USRP2 device IPv4 address: 192.168.10.2 + +**Configuration for USRP2 device 1:** + +* Ethernet interface IPv4 address: 192.168.20.1 +* Ethernet interface subnet mask: 255.255.255.0 +* USRP2 device IPv4 address: 192.168.20.2 + +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  Change the USRP2's IP address  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  You may need to change the USRP2's IP address for several reasons: @@ -122,7 +142,7 @@ Run the following commands:  ::      cd <prefix>/share/uhd/utils -    ./usrp2_recovery.py --ifc=eth0 --new-ip=192.168.10.3 +    sudo ./usrp2_recovery.py --ifc=eth0 --new-ip=192.168.10.3  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  Debugging networking problems @@ -181,7 +201,6 @@ The device address string representation for 2 USRP2s with IPv4 addresses 192.16      addr=192.168.10.2 192.168.20.2 -  ------------------------------------------------------------------------  Resize the send and receive buffers  ------------------------------------------------------------------------ diff --git a/host/lib/transport/udp_zero_copy_asio.cpp b/host/lib/transport/udp_zero_copy_asio.cpp index 86ea275c1..e3f3ef5bf 100644 --- a/host/lib/transport/udp_zero_copy_asio.cpp +++ b/host/lib/transport/udp_zero_copy_asio.cpp @@ -155,17 +155,17 @@ template<typename Opt> static void resize_buff_helper(          else std::cout << boost::format(              "Current %s sock buff size: %d bytes"          ) % name % actual_size << std::endl; +        if (actual_size < target_size) std::cerr << boost::format( +            "Warning:\n" +            "    The %s buffer is smaller than the requested size.\n" +            "    The minimum recommended buffer size is %d bytes.\n" +            "    See the USRP2 application notes on buffer resizing.\n" +        ) % name % MIN_SOCK_BUFF_SIZE << std::endl;      }      //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); -        if (udp_trans->get_buff_size<Opt>() < MIN_SOCK_BUFF_SIZE){ -            std::cerr << boost::format( -                "Warning: the %s buffer size is smaller than the recommended size of %d bytes.\n" -                "    See the USRP2 application notes on buffer resizing." -            ) % name % MIN_SOCK_BUFF_SIZE << std::endl; -        }      }  } diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp index 9d1ac991f..02f53bc69 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.cpp +++ b/host/lib/usrp/usrp2/usrp2_impl.cpp @@ -127,14 +127,25 @@ static uhd::device_addrs_t usrp2_find(const device_addr_t &hint){  /***********************************************************************   * Make   **********************************************************************/ +template <typename out_type, typename in_type> +out_type lexical_cast(const in_type &in){ +    try{ +        return boost::lexical_cast<out_type>(in); +    }catch(...){ +        throw std::runtime_error(str(boost::format( +            "failed to cast \"%s\" to type \"%s\"" +        ) % boost::lexical_cast<std::string>(in) % typeid(out_type).name())); +    } +} +  static device::sptr usrp2_make(const device_addr_t &device_addr){      //extract the receive and send buffer sizes      size_t recv_buff_size = 0, send_buff_size= 0 ;      if (device_addr.has_key("recv_buff_size")){ -        recv_buff_size = size_t(boost::lexical_cast<double>(device_addr["recv_buff_size"])); +        recv_buff_size = size_t(lexical_cast<double>(device_addr["recv_buff_size"]));      }      if (device_addr.has_key("send_buff_size")){ -        send_buff_size = size_t(boost::lexical_cast<double>(device_addr["send_buff_size"])); +        send_buff_size = size_t(lexical_cast<double>(device_addr["send_buff_size"]));      }      //create a ctrl and data transport for each address | 
