aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2015-07-13 16:53:35 -0700
committerMartin Braun <martin.braun@ettus.com>2015-07-14 12:19:41 -0700
commit1c185f8478955c170ba6cf429826dfb286c3c045 (patch)
tree61bd1103d6086fa44aca5d8eae38cf1fbd631296 /host
parent5f11aee12dc90baac56a803ce462255bc8026f71 (diff)
downloaduhd-1c185f8478955c170ba6cf429826dfb286c3c045.tar.gz
uhd-1c185f8478955c170ba6cf429826dfb286c3c045.tar.bz2
uhd-1c185f8478955c170ba6cf429826dfb286c3c045.zip
examples: Improved tx_waveform multi-channel sync
Diffstat (limited to 'host')
-rw-r--r--host/examples/tx_waveforms.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/host/examples/tx_waveforms.cpp b/host/examples/tx_waveforms.cpp
index 7e633262c..d648d2309 100644
--- a/host/examples/tx_waveforms.cpp
+++ b/host/examples/tx_waveforms.cpp
@@ -225,15 +225,17 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
std::vector<std::complex<float> > buff(spb);
std::vector<std::complex<float> *> buffs(channel_nums.size(), &buff.front());
- //setup the metadata flags
- uhd::tx_metadata_t md;
- md.start_of_burst = true;
- md.end_of_burst = false;
- md.has_time_spec = true;
- md.time_spec = uhd::time_spec_t(0.1);
-
std::cout << boost::format("Setting device timestamp to 0...") << std::endl;
- usrp->set_time_now(uhd::time_spec_t(0.0));
+ if (channel_nums.size() > 1) {
+ // This is the worst-case setup scenario, because this example has to
+ // work for all configurations. set_time_now() and set_time_next_pps()
+ // might also work, depending on what USRPs are being used, and can
+ // accelerate the setup. To keep this example generic, we use
+ // set_time_unknown_pps() to guarantee synchronization.
+ usrp->set_time_unknown_pps(uhd::time_spec_t(0.0));
+ } else {
+ usrp->set_time_now(uhd::time_spec_t(0.0));
+ }
//Check Ref and LO Lock detect
std::vector<std::string> sensor_names;
@@ -258,6 +260,14 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
std::signal(SIGINT, &sig_int_handler);
std::cout << "Press Ctrl + C to stop streaming..." << std::endl;
+ // Set up metadata. We start streaming a bit in the future
+ // to allow MIMO operation:
+ uhd::tx_metadata_t md;
+ md.start_of_burst = true;
+ md.end_of_burst = false;
+ md.has_time_spec = true;
+ md.time_spec = usrp->get_time_now() + uhd::time_spec_t(0.1);
+
//send data until the signal handler gets called
while(not stop_signal_called){
//fill the buffer with the waveform