From cecfb2e8f97af26fe307bee8f70682dbc3208fc3 Mon Sep 17 00:00:00 2001 From: Thomas Tsou Date: Thu, 27 Mar 2014 13:44:09 -0400 Subject: Transceiver52M: Set UHD rates before creating streamers Recent versions of UHD require setting the sample rate before creating streamers otherwise the following exception occurs. Boost_105300; UHD_003.007.000-0-g7fef199d terminate called after throwing an instance of 'boost::exception_detail::clone_impl >' what(): Error in function boost::math::round(d): Value -nan can not be represented in the target integer type. Signed-off-by: Thomas Tsou --- Transceiver52M/UHDDevice.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Transceiver52M/UHDDevice.cpp b/Transceiver52M/UHDDevice.cpp index 3e1f0de..875fe47 100644 --- a/Transceiver52M/UHDDevice.cpp +++ b/Transceiver52M/UHDDevice.cpp @@ -642,18 +642,6 @@ int uhd_device::open(const std::string &args, bool extref) if (extref) usrp_dev->set_clock_source("external"); - // Create TX and RX streamers - uhd::stream_args_t stream_args("sc16"); - for (size_t i = 0; i < chans; i++) - stream_args.channels.push_back(i); - - tx_stream = usrp_dev->get_tx_stream(stream_args); - rx_stream = usrp_dev->get_rx_stream(stream_args); - - // Number of samples per over-the-wire packet - tx_spp = tx_stream->get_max_num_samps(); - rx_spp = rx_stream->get_max_num_samps(); - // Set rates double _rx_rate; double _tx_rate = select_rate(dev_type, sps); @@ -667,6 +655,18 @@ int uhd_device::open(const std::string &args, bool extref) if (set_rates(_tx_rate, _rx_rate) < 0) return -1; + /* Create TX and RX streamers */ + uhd::stream_args_t stream_args("sc16"); + for (size_t i = 0; i < chans; i++) + stream_args.channels.push_back(i); + + tx_stream = usrp_dev->get_tx_stream(stream_args); + rx_stream = usrp_dev->get_rx_stream(stream_args); + + /* Number of samples per over-the-wire packet */ + tx_spp = tx_stream->get_max_num_samps(); + rx_spp = rx_stream->get_max_num_samps(); + // Create receive buffer size_t buf_len = SAMPLE_BUF_SZ / sizeof(uint32_t); for (size_t i = 0; i < rx_buffers.size(); i++) -- cgit v1.2.3