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>
This commit is contained in:
Thomas Tsou 2014-03-27 13:44:09 -04:00
parent 8e17df7374
commit cecfb2e8f9
1 changed files with 12 additions and 12 deletions

View File

@ -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++)