From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

USRP Software Radio

cancel
Showing results for 
Search instead for 
Did you mean: 

USRP-2900 Transmit - Receive Sample Alignment

Solved!
Go to solution

I'm using GNU Radio and an NI USRP-2900 with an external PPS to the input.  A waveform file is played in loop and passed to the transmit channel.  The signal is looped back to the receive side, with an attenuator.  Simultaneously, the receive channel reads and saves the samples to a file.  

 

My issue is that whenever the program is stopped and restarted the relative alignment between transmit and receive streams has changed.  The offset must be consistent for my application.

 

I've tried syncing to the PPS.  I've tried time commands.  I feel as though I've tried everything.  Any help would be greatly appreciated.  Thanks all.

0 Kudos
Message 1 of 3
(3,091 Views)
Solution
Accepted by topic author MicrowaveGuy

I solved the issue.  Here is the solution for everyone's reference.   The trick was to use the .set_time_next_pps() and .set_start_time() functions.  More details on these functions are available here.   The following hand code must be added to the python file generated by the GNU Radio companion, or to another hand coded python/gnuradio program.

 

Take note of the lines which are added immediately after creation of the source/sink blocks, but before .set_center_freq() is sent for each which would otherwise start the streaming immediately.

 

# create a zero time and a start time
zero_time = uhd.time_spec_t(0.0) # hand coded
start_time = uhd.time_spec_t(2.0) # hand coded

# Add following lines following creation of source block
self.uhd_usrp_source_1.set_time_next_pps( zero_time ) # hand coded
self.uhd_usrp_source_1.set_start_time( start_time ) # hand coded

# Add following lines following creation of sink block
 self.uhd_usrp_sink_0.set_time_next_pps(zero_time ) # hand coded
 self.uhd_usrp_sink_0.set_start_time( start_time ) # hand coded
Message 2 of 3
(3,072 Views)

Thanks for following up and posting your solution.

 

Cheers,

Michael B.

Michael Bilyk
Former NI Software Engineer (IT)
0 Kudos
Message 3 of 3
(3,040 Views)