05-25-2015 12:33 PM
Hi all,
I'm trying to do a two-way-ranging using the USRP n210. To be able to do that, I will need to know the exact time that the samples were sent and the time that I received it back.
Trying to implement that I want to use 2 USRPs connected together.
(USRP A) (USRP B)
tx <----------------- rx
rx -----------------> tx
For testing porpuses firstly I used a single USRP connecting the RX and TX together. Using a simple flow graph in the GRC I output an impulse (using the vector source) and at the same time I stored everything from the USRP input in a file (using the File Sink block). To compare the results I also used a File Sink block in the output.
Testing again and again the difference between the moment where I start the code and the moment where the impulse arrives at the RX looks like there is some kind of random delay. The difference between sending and receiving back the impulse fluctuates around 8000 ~ 10000 samples. Because I'm using just one USRP with RX and TX connected together I though that this delay should be almost zero.
There is any better way to implement this in which I can get a better accuracy in the time-stamping?
Solved! Go to Solution.
05-26-2015 04:04 PM
Hi Rafael,
Can you post some of the code you are using to perform this action. Maybe including some results as well. It would greatly help in troubleshooting.
05-26-2015 05:10 PM
Here are my results.
One of the files is my flow graph using GNU Radio Companion.
The other one is the plot of the files that I stored using "File Sink" (The blue line is the data that I'm sending, the red line is the data that I'm receiving).
The difference between the first 2 impulses are 19662 samples.
I'm using a sampling rate of 10M.
USRP connection:
|------------------|
| rx |<--,
| USRP | |
| tx |----'
|------------------|
05-27-2015 02:08 PM
Hey Rafael,
Since you are using an Ettus USRP with GNU Radio Companion, it might be easier for you to reach out to Ettus support here:
There are members of this forum that have experience with this kind of thing, but I am not one of them. Maybe one of them will chime in.
06-03-2015 03:49 PM
One solution that helped me to solve my problem was using the following code in the python code generated by the GNU companion:
now = self.uhd_usrp_sink_0.get_time_now() #Store the actual time of the FPGA
self.uhd_usrp_source_0.set_start_time(uhd.time_spec_t(1) + now) #Set the source to start 1 second after the actual time of the FPGA
self.uhd_usrp_sink_0.set_start_time(uhd.time_spec_t(1) + now) #Set the sink to start 1 second after the actual time of the FPGA
That way both, tx and rx, will start at the same moment.
04-05-2020 05:06 PM
Hey, Thanks for posting your code. I am trying to utilize SDRs to implement two-way ranging as well. How much progress has you been able to make? Specifically, are you able to transmit a signal at a specific time after you receive the signal?
07-02-2024 09:10 AM
You are the man!!!