aboutsummaryrefslogtreecommitdiffstats
path: root/host/examples
diff options
context:
space:
mode:
Diffstat (limited to 'host/examples')
-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