# UHD: Sink and source synchronization

**URL:** <https://www.ruby-forum.com/t/uhd-sink-and-source-synchronization/242035>\
**Category:** GNU Radio\
**Created:** [May 21, 2015, 4:15pm UTC](https://www.ruby-forum.com/t/uhd-sink-and-source-synchronization/242035 "2015-05-21T16:15:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [May 21, 2015, 4:15pm UTC](https://www.ruby-forum.com/t/uhd-sink-and-source-synchronization/242035/1 "2015-05-21T16:15:55Z")

</div>

Hi all,

Right now I’m implementing tx and rx on the same device (USRP b210), and  
I’m trying to synchronize the two in order to determine the exact moment  
when a message is sent by the Tx. The purpose of this synchronization is  
to  
add an idle state for tx right after the “sending state”, so the Rx part  
can “hear” the channel and determine if there are no active  
communications  
at the same time, that could lead to interference.

I used first the gettimeofday function along with the uhd::time\_spec\_t,  
but  
I have been told that this is a kind of “system timer”, and that could  
not  
be 100% reliable as a counter for the USRP’s. The idea now is use the  
rx\_time tag that comes at the start of every reception, but so far I  
havent  
been able to generate the idle state just before the sensing state, and  
I  
believe that I’m, so to say, interfering myself.

Now I was thinking on trying to extract a so-called tx\_time tag not  
created  
beforehand but within the UHD block (as near to the usrp antenna as  
possible), that would tell me the time when the signal is going to be  
send.  
For that I would go into modifying the uhd blocks. Before doing that, I  
would like to hear some ideas of synchronization or some feedback from  
the  
mailing list. It would be really helpful if someone could lead into a  
more  
decent way than modifying the main blocks.

Thank you in advance.

Best Regards,

Nicolas C.

---

<div class="post-metadata">

**Author:** ![budu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/b5e925/32.png) [@budu](https://www.ruby-forum.com/u/budu)\
**Post date:** [May 21, 2015, 6:16pm UTC](https://www.ruby-forum.com/t/uhd-sink-and-source-synchronization/242035/2 "2015-05-21T18:16:17Z")

</div>

Nicolas,

the tx\_time tag is generated by the device, not by gr-uhd. So as a time  
base, this should serve your purpose – unless I misunderstood what  
you’re trying to do.

M
