From c283916e418a46ad60dfa3eb40eff1654df90043 Mon Sep 17 00:00:00 2001 From: Thomas Tsou Date: Thu, 27 Mar 2014 13:52:58 -0400 Subject: Transceiver52M: Allow startup delay for stream alignment UHD requires a small amount of time to align multiple streams at startup. Delay the startup by 100 ms relative to the queried device time (actual delay inclusive of control latencies will be less). The following error is only relevant to dual-channel UHD devices (e.g. Fairwaves UmTRX and Ettus B210). UHD Error: The receive packet handler failed to time-align packets. 1002 received packets were processed by the handler. However, a timestamp match could not be determined. Signed-off-by: Thomas Tsou --- Transceiver52M/UHDDevice.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Transceiver52M/UHDDevice.cpp b/Transceiver52M/UHDDevice.cpp index 875fe47..a15e5f1 100644 --- a/Transceiver52M/UHDDevice.cpp +++ b/Transceiver52M/UHDDevice.cpp @@ -263,7 +263,7 @@ public: int open(const std::string &args, bool extref); bool start(); bool stop(); - void restart(uhd::time_spec_t ts); + void restart(); void setPriority(float prio); enum TxWindowType getWindowType() { return tx_window; } @@ -737,12 +737,18 @@ bool uhd_device::flush_recv(size_t num_pkts) return true; } -void uhd_device::restart(uhd::time_spec_t) +void uhd_device::restart() { + /* Allow 100 ms delay to align multi-channel streams */ + double delay = 0.1; + aligned = false; + uhd::time_spec_t current = usrp_dev->get_time_now(); + uhd::stream_cmd_t cmd = uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS; - cmd.stream_now = true; + cmd.stream_now = false; + cmd.time_spec = uhd::time_spec_t(current.get_real_secs() + delay); usrp_dev->issue_stream_cmd(cmd); @@ -765,7 +771,7 @@ bool uhd_device::start() async_event_thrd.start((void * (*)(void*))async_event_loop, (void*)this); // Start streaming - restart(uhd::time_spec_t(0.0)); + restart(); // Display usrp time double time_now = usrp_dev->get_time_now().get_real_secs(); @@ -886,7 +892,7 @@ int uhd_device::readSamples(std::vector &bufs, int len, bool *overrun, LOG(ALERT) << "UHD: Unrecoverable error, exiting..."; exit(-1); case ERROR_TIMING: - restart(prev_ts); + restart(); case ERROR_UNHANDLED: continue; } -- cgit v1.2.3