From ddb35a65ddcca7aa7a8c03d4185357fea2bf47c0 Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Wed, 9 Apr 2014 15:15:38 -0700 Subject: x3x0 docs: the word 'firmware' is misleading --- host/docs/usrp_x3x0.rst | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/host/docs/usrp_x3x0.rst b/host/docs/usrp_x3x0.rst index ee6960298..7dd322dbf 100644 --- a/host/docs/usrp_x3x0.rst +++ b/host/docs/usrp_x3x0.rst @@ -65,15 +65,18 @@ in order not to damage sensitive electronics through static discharge! Network Connectivity ^^^^^^^^^^^^^^^^^^^^ -The next step is to make sure your computer can talk to the USRP. An otherwise unconfigured -USRP device will have the IP address 192.168.10.2 when using 1GigE. -It is recommended to directly connect your USRP to the computer at first, -and to set the IP address on your machine to 192.168.10.1. -See the `system configuration manual <./usrp_x3x0_config.html>`_ on details how to change your machine's IP address. +The next step is to make sure your computer can talk to the USRP. An otherwise +unconfigured USRP device will have the IP address 192.168.10.2 when using +1GigE. It is recommended to directly connect your USRP to the computer at +first, and to set the IP address on your machine to 192.168.10.1. -**Note**: If you are running an automatic IP configuration service such as Network Manager, make -sure it is either deactivated or configured to not change the network device! This can, in extreme cases, -lead to you bricking the USRP! +See the `system configuration manual <./usrp_x3x0_config.html>`_ on details how +to change your machine's IP address. + +**Note**: If you are running an automatic IP configuration service such as +Network Manager, make sure it is either deactivated or configured to not manage +the network interface! This can, in extreme cases, lead to you bricking the +USRP! If your network configuration is correct, running ``uhd_find_devices`` will find your USRP and print some information about it. You will also be able to ping the USRP by running:: @@ -86,31 +89,32 @@ on the command line. At this point, you should also run:: to make sure all of your components (daughterboards, GPSDO) are correctly detected and usable. -^^^^^^^^^^^^^^^^^^^^^ -Updating the firmware -^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^ +Updating the FPGA Image +^^^^^^^^^^^^^^^^^^^^^^^^^ -If the output from ``uhd_find_devices`` and ``uhd_usrp_probe`` didn't show any warnings, you -can skip this step. However, if there were warnings regarding version incompatibility, you will -have to upate the FPGA image before you can start using your USRP. +If the output from ``uhd_find_devices`` and ``uhd_usrp_probe`` didn't show any +warnings, you can skip this step. However, if there were errors regarding the +FPGA version compatibility number (compat number), you will have to upate the +FPGA image before you can start using your USRP. 1. Download the current UHD images. You can use the ``uhd_images_downloader`` script provided with UHD (see also `FPGA Image Flavors`_). 2. Use the ``usrp_x3xx_fpga_burner`` utility to update the FPGA image. On the command line, run:: - usrp_x3xx_fpga_burner --addr=192.168.10.2 --type=HGS # Since we are using 1GigE, type is HGS + usrp_x3xx_fpga_burner --addr=192.168.10.2 --type=HGS If you have installed the images to a non-standard location, you might need to run (change the filename according to your device):: usrp_x3xx_fpga_burner --addr=192.168.10.2 --fpga-path /usrp_x310_fpga_HGS.bit - The process of updating the firmware will take several minutes. Make sure the process of flashing the image does not get interrupted. + The process of updating the FPGA image will take several minutes. Make sure the process of flashing the image does not get interrupted. See `Load the Images onto the On-board Flash`_ for more details. -When your firmware is up to date, power-cycle the device and re-run ``uhd_usrp_probe``. There should -be no more warnings at this point, and all components should be correctly detected. Your USRP is now -ready for development! +When your FPGA image is up to date, power-cycle the device and re-run +``uhd_usrp_probe``. There should be no errors at this point, and all components +should be correctly detected. Your USRP is now ready for development! -------------- Hardware Setup -- cgit v1.2.3 From 1f61316536057c4326964c599c90b6d1281c6e2b Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Tue, 1 Apr 2014 13:11:23 +0200 Subject: uhd: Added pp routines for error codes and rx metadata --- host/include/uhd/types/metadata.hpp | 16 ++++++- host/lib/types/CMakeLists.txt | 1 + host/lib/types/metadata.cpp | 92 +++++++++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 host/lib/types/metadata.cpp diff --git a/host/include/uhd/types/metadata.hpp b/host/include/uhd/types/metadata.hpp index 6a79720d0..51a2b7c43 100644 --- a/host/include/uhd/types/metadata.hpp +++ b/host/include/uhd/types/metadata.hpp @@ -1,5 +1,5 @@ // -// Copyright 2010-2012 Ettus Research LLC +// Copyright 2010-2012,2014 Ettus Research LLC // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -117,6 +117,20 @@ namespace uhd{ //! Out of sequence. The transport has either dropped a packet or received data out of order. bool out_of_sequence; + + /*! + * Convert a rx_metadata_t into a pretty print string. + * + * \param compact Set to false for a more verbose output. + * \return a printable string representing the metadata. + */ + std::string to_pp_string(bool compact=true) const; + + /*! + * Similar to C's strerror() function, creates a std::string describing the error code. + * \return a printable string representing the error. + */ + std::string strerror(void) const; }; /*! diff --git a/host/lib/types/CMakeLists.txt b/host/lib/types/CMakeLists.txt index b69c8e487..7fc6bdd94 100644 --- a/host/lib/types/CMakeLists.txt +++ b/host/lib/types/CMakeLists.txt @@ -82,6 +82,7 @@ SET_SOURCE_FILES_PROPERTIES( LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/device_addr.cpp ${CMAKE_CURRENT_SOURCE_DIR}/mac_addr.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/metadata.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ranges.cpp ${CMAKE_CURRENT_SOURCE_DIR}/sensors.cpp ${CMAKE_CURRENT_SOURCE_DIR}/serial.cpp diff --git a/host/lib/types/metadata.cpp b/host/lib/types/metadata.cpp new file mode 100644 index 000000000..fec2ac564 --- /dev/null +++ b/host/lib/types/metadata.cpp @@ -0,0 +1,92 @@ +// +// Copyright 2014 Ettus Research LLC +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#include +#include +#include +#include +#include +#include + +using namespace uhd; + +std::string rx_metadata_t::to_pp_string(bool compact) const +{ + std::stringstream ss; + + if (compact) { + if (has_time_spec) { + ss << "Time: " << time_spec.get_real_secs() << " s\n"; + } + if (more_fragments) { + ss << "Fragmentation offset: " << fragment_offset << "\n"; + } + if (start_of_burst) { + ss << "Start of burst.\n" << fragment_offset; + } + if (end_of_burst) { + ss << "End of burst.\n" << fragment_offset; + } + if (error_code != ERROR_CODE_NONE) { + ss << strerror() << "\n"; + } + } else { + ss << "Has timespec: " << (has_time_spec ? "Yes" : "No") + << "\tTime of first sample: " << time_spec.get_real_secs() + << "\nFragmented: " << (more_fragments ? "Yes" : "No") + << " Fragmentation offset: " << fragment_offset + << "\nStart of burst: " << (start_of_burst ? "Yes" : "No") + << "\tEnd of burst: " << (end_of_burst ? "Yes" : "No") + << "\nError Code: " << strerror() + << "\tOut of sequence: " << (out_of_sequence ? "Yes" : "No"); + } + + return ss.str(); +} + +std::string rx_metadata_t::strerror() const +{ + std::string errstr = ""; + switch(this->error_code) { + case ERROR_CODE_NONE: + errstr = "ERROR_CODE_NONE"; + break; + case ERROR_CODE_TIMEOUT: + errstr = "ERROR_CODE_TIMEOUT"; + break; + case ERROR_CODE_LATE_COMMAND: + errstr = "ERROR_CODE_LATE_COMMAND"; + break; + case ERROR_CODE_BROKEN_CHAIN: + errstr = "ERROR_CODE_BROKEN_CHAIN (Expected another stream command)"; + break; + case ERROR_CODE_OVERFLOW: + errstr = "ERROR_CODE_OVERFLOW "; + errstr += (this->out_of_sequence ? "(Out of sequence error)" : "(Overflow)"); + break; + case ERROR_CODE_ALIGNMENT: + errstr = "ERROR_CODE_ALIGNMENT (Multi-channel alignment failed)"; + break; + case ERROR_CODE_BAD_PACKET: + errstr = "ERROR_CODE_BAD_PACKET"; + break; + default: + errstr = std::string(str(boost::format("Unknown error code: 0x%x") % error_code)); + } + + return errstr; +} -- cgit v1.2.3 From 0fcd0282f86de158f25e30f7e14be820e6f3623a Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Tue, 1 Apr 2014 13:35:25 +0200 Subject: uhd: Added nicer error reporting to cal tools --- host/utils/usrp_cal_utils.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/host/utils/usrp_cal_utils.hpp b/host/utils/usrp_cal_utils.hpp index 5aff5e22f..e8749fba7 100644 --- a/host/utils/usrp_cal_utils.hpp +++ b/host/utils/usrp_cal_utils.hpp @@ -257,8 +257,8 @@ static void capture_samples( //validate the received data if (md.error_code != uhd::rx_metadata_t::ERROR_CODE_NONE){ throw std::runtime_error(str(boost::format( - "Unexpected error code 0x%x" - ) % md.error_code)); + "Receiver error: %s" + ) % md.strerror())); } //we can live if all the data didnt come in if (num_rx_samps > buff.size()/2){ -- cgit v1.2.3 From 853901782f07b62bf774551c344a65606e545a4f Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Tue, 1 Apr 2014 14:10:30 +0200 Subject: uhd: Added nicer error reporting to rx examples --- host/examples/benchmark_rate.cpp | 2 +- host/examples/rx_multi_samples.cpp | 4 ++-- host/examples/rx_samples_to_file.cpp | 19 ++++++++----------- host/examples/rx_timed_samples.cpp | 4 ++-- host/examples/test_timed_commands.cpp | 4 ++-- host/examples/transport_hammer.cpp | 2 +- host/examples/txrx_loopback_to_file.cpp | 4 ++-- 7 files changed, 18 insertions(+), 21 deletions(-) diff --git a/host/examples/benchmark_rate.cpp b/host/examples/benchmark_rate.cpp index ea49d48d9..9e9aa67e9 100644 --- a/host/examples/benchmark_rate.cpp +++ b/host/examples/benchmark_rate.cpp @@ -98,7 +98,7 @@ void benchmark_rx_rate(uhd::usrp::multi_usrp::sptr usrp, const std::string &rx_c break; default: - std::cerr << "Error code: " << md.error_code << std::endl; + std::cerr << "Receiver error: " << md.strerror() << std::endl; std::cerr << "Unexpected error on recv, continuing..." << std::endl; break; } diff --git a/host/examples/rx_multi_samples.cpp b/host/examples/rx_multi_samples.cpp index 9e5970978..a50b5f0e0 100644 --- a/host/examples/rx_multi_samples.cpp +++ b/host/examples/rx_multi_samples.cpp @@ -172,8 +172,8 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ if (md.error_code == uhd::rx_metadata_t::ERROR_CODE_TIMEOUT) break; if (md.error_code != uhd::rx_metadata_t::ERROR_CODE_NONE){ throw std::runtime_error(str(boost::format( - "Unexpected error code 0x%x" - ) % md.error_code)); + "Receiver error %s" + ) % md.strerror())); } if(verbose) std::cout << boost::format( diff --git a/host/examples/rx_samples_to_file.cpp b/host/examples/rx_samples_to_file.cpp index 0d42404d3..de3640794 100644 --- a/host/examples/rx_samples_to_file.cpp +++ b/host/examples/rx_samples_to_file.cpp @@ -101,18 +101,15 @@ template void recv_to_file( continue; } if (md.error_code != uhd::rx_metadata_t::ERROR_CODE_NONE){ - std::string error = str(boost::format( - "Unexpected error code 0x%x" - ) % md.error_code); - - if (continue_on_bad_packet){ - std::cerr << error << std::endl; - continue; - } - else - throw std::runtime_error(error); + std::string error = str(boost::format("Receiver error: %s") % md.strerror()); + if (continue_on_bad_packet){ + std::cerr << error << std::endl; + continue; + } + else + throw std::runtime_error(error); } - + if (enable_size_map){ SizeMap::iterator it = mapSizes.find(num_rx_samps); if (it == mapSizes.end()) diff --git a/host/examples/rx_timed_samples.cpp b/host/examples/rx_timed_samples.cpp index cc9216cb7..30535907f 100644 --- a/host/examples/rx_timed_samples.cpp +++ b/host/examples/rx_timed_samples.cpp @@ -130,8 +130,8 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ if (md.error_code == uhd::rx_metadata_t::ERROR_CODE_TIMEOUT) break; if (md.error_code != uhd::rx_metadata_t::ERROR_CODE_NONE){ throw std::runtime_error(str(boost::format( - "Unexpected error code 0x%x" - ) % md.error_code)); + "Receiver error %s" + ) % md.strerror())); } if(verbose) std::cout << boost::format( diff --git a/host/examples/test_timed_commands.cpp b/host/examples/test_timed_commands.cpp index 8c6011c68..3da4bc707 100644 --- a/host/examples/test_timed_commands.cpp +++ b/host/examples/test_timed_commands.cpp @@ -139,8 +139,8 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ const size_t num_rx_samps = rx_stream->recv(&buff.front(), buff.size(), md, 1.0); if (md.error_code != uhd::rx_metadata_t::ERROR_CODE_NONE){ throw std::runtime_error(str(boost::format( - "Unexpected error code 0x%x" - ) % md.error_code)); + "Receiver error %s" + ) % md.strerror())); } std::cout << boost::format( " Received packet: %u samples, %u full secs, %f frac secs" diff --git a/host/examples/transport_hammer.cpp b/host/examples/transport_hammer.cpp index 4b949e5bd..3f233b2a5 100644 --- a/host/examples/transport_hammer.cpp +++ b/host/examples/transport_hammer.cpp @@ -88,7 +88,7 @@ void rx_hammer(uhd::usrp::multi_usrp::sptr usrp, const std::string &rx_cpu, uhd: break; default: - std::cerr << "Error code: " << md.error_code << std::endl; + std::cerr << "Receiver error: " << md.strerror() << std::endl; std::cerr << "Unexpected error on recv, continuing..." << std::endl; break; } diff --git a/host/examples/txrx_loopback_to_file.cpp b/host/examples/txrx_loopback_to_file.cpp index 3d3cf1dfc..a62ccd7b2 100644 --- a/host/examples/txrx_loopback_to_file.cpp +++ b/host/examples/txrx_loopback_to_file.cpp @@ -181,8 +181,8 @@ template void recv_to_file( } if (md.error_code != uhd::rx_metadata_t::ERROR_CODE_NONE){ throw std::runtime_error(str(boost::format( - "Unexpected error code 0x%x" - ) % md.error_code)); + "Receiver error %s" + ) % md.strerror())); } num_total_samps += num_rx_samps; -- cgit v1.2.3