Fix b200mini external clock

master
Xavier Arteaga 4 years ago committed by Xavier Arteaga
parent bf4d0121dd
commit c82f609085

@ -48,7 +48,6 @@ private:
uhd_error test_ad936x_device(uint32_t nof_channels)
{
uhd_error err = set_rx_rate(1.92e6);
if (err != UHD_ERROR_NONE) {
return err;
@ -209,7 +208,6 @@ public:
Info("The device is based on AD9361, get RX stream for checking LIBUSB_TRANSFER_ERROR");
uint32_t ntrials = 10;
do {
// If no error getting RX stream, return
err = test_ad936x_device(nof_channels);
if (err == UHD_ERROR_NONE) {
@ -268,13 +266,13 @@ public:
{
UHD_SAFE_C_SAVE_ERROR(this, timespec = usrp->get_time_now();)
}
uhd_error set_sync_source(const std::string& source) override
uhd_error set_sync_source(const std::string& sync_source, const std::string& clock_source) override
{
Debug("Setting PPS source to '" << source << "'");
Debug("Setting PPS source to '" << sync_source << "' and clock source to '" << clock_source << "'");
#if UHD_VERSION < 3140099
UHD_SAFE_C_SAVE_ERROR(this, usrp->set_clock_source(source); usrp->set_time_source(source);)
UHD_SAFE_C_SAVE_ERROR(this, usrp->set_clock_source(clock_source); usrp->set_time_source(sync_source);)
#else
UHD_SAFE_C_SAVE_ERROR(this, usrp->set_sync_source(source, source);)
UHD_SAFE_C_SAVE_ERROR(this, usrp->set_sync_source(clock_source, sync_source);)
#endif
}
uhd_error get_gain_range(uhd::gain_range_t& tx_gain_range, uhd::gain_range_t& rx_gain_range) override

@ -603,6 +603,12 @@ static int uhd_init(rf_uhd_handler_t* handler, char* args, uint32_t nof_channels
clock_src = device_addr.pop("clock");
}
// Select same synchronization source only if more than one channel is opened
std::string sync_src = "internal";
if (nof_channels > 1) {
sync_src = clock_src;
}
// Logging level
#ifdef UHD_LOG_INFO
uhd::log::severity_level severity_level = uhd::log::severity_level::info;
@ -779,7 +785,7 @@ static int uhd_init(rf_uhd_handler_t* handler, char* args, uint32_t nof_channels
std::string sensor_name;
// Set sync source
if (handler->uhd->set_sync_source(clock_src) != UHD_ERROR_NONE) {
if (handler->uhd->set_sync_source(sync_src, clock_src) != UHD_ERROR_NONE) {
print_usrp_error(handler);
return SRSRAN_ERROR;
}

@ -143,7 +143,7 @@ public:
stream_cmd.stream_now = true;
rx_stream->issue_stream_cmd(stream_cmd);)
}
virtual uhd_error set_sync_source(const std::string& source) = 0;
virtual uhd_error set_sync_source(const std::string& sync_source, const std::string& clock_source) = 0;
virtual uhd_error get_gain_range(uhd::gain_range_t& tx_gain_range, uhd::gain_range_t& rx_gain_range) = 0;
virtual uhd_error set_master_clock_rate(double rate) = 0;
virtual uhd_error set_rx_rate(double rate) = 0;

Loading…
Cancel
Save