aboutsummaryrefslogtreecommitdiffstats
path: root/Transceiver52M
diff options
context:
space:
mode:
authorThomas Tsou <tom@tsou.cc>2014-03-27 13:44:09 -0400
committerThomas Tsou <tom@tsou.cc>2014-03-27 13:49:51 -0400
commitcecfb2e8f97af26fe307bee8f70682dbc3208fc3 (patch)
treee0a1dbadef51c426dfe3de792bddd20b3cc26240 /Transceiver52M
parent8e17df7374367d57693b1d016239348640f930aa (diff)
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<boost::exception_detail::error_info_injector<boost::math::rounding_error> >' what(): Error in function boost::math::round<d>(d): Value -nan can not be represented in the target integer type. Signed-off-by: Thomas Tsou <tom@tsou.cc>
Diffstat (limited to 'Transceiver52M')
-rw-r--r--Transceiver52M/UHDDevice.cpp24
1 files 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++)