# Synchronizing N210 TX and RX channels

**URL:** <https://www.ruby-forum.com/t/synchronizing-n210-tx-and-rx-channels/231127>\
**Category:** GNU Radio\
**Created:** [July 22, 2014, 5:15pm UTC](https://www.ruby-forum.com/t/synchronizing-n210-tx-and-rx-channels/231127 "2014-07-22T17:15:27Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [July 22, 2014, 5:15pm UTC](https://www.ruby-forum.com/t/synchronizing-n210-tx-and-rx-channels/231127/1 "2014-07-22T17:15:27Z")

</div>

Hello,

I would like to synchronize the RX and TX channels on an N210 so that  
the acquisition and transmission of data are triggered simultaneously.  
I haven’t found documentation on how to do that. Can someone, please,  
point me in the right direction?

Thanks! Cheers,  
Daniele

---

<div class="post-metadata">

**Author:** ![Daniele\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/74df32/32.png) [@Daniele\_N](https://www.ruby-forum.com/u/Daniele_N)\
**Post date:** [July 22, 2014, 5:20pm UTC](https://www.ruby-forum.com/t/synchronizing-n210-tx-and-rx-channels/231127/2 "2014-07-22T17:20:30Z")

</div>

On 07/22/2014 11:14 AM, Daniele N. wrote:

> * * *
> 
> Discuss-gnuradio mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [Discuss-gnuradio Info Page](https://lists.gnu.org/mailman/listinfo/discuss-gnuradio)

You should probably look at the UHD examples: rx\_timed\_samples and  
tx\_timed\_samples

–  
Marcus L.  
Principal Investigator  
Shirleys Bay Radio Astronomy Consortium

> **[Live Draw HK Tercepat | Result HK | HK Pools | Live HK | HK Prize Hari Ini](https://www.sbrac.org)**
>
> Temukan live draw hk tercepat melalui halaman hk pools yang resmi dan dapatkan result hk prize melalui live hk secara langsung di situs kami.

---

<div class="post-metadata">

**Author:** ![Daniele\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/74df32/32.png) [@Daniele\_N](https://www.ruby-forum.com/u/Daniele_N)\
**Post date:** [July 22, 2014, 5:31pm UTC](https://www.ruby-forum.com/t/synchronizing-n210-tx-and-rx-channels/231127/3 "2014-07-22T17:31:26Z")

</div>

On 22/07/2014 17:18, Marcus D. Leech wrote:

> > 
> 
> You should probably look at the UHD examples: rx\_timed\_samples and  
> tx\_timed\_samples

Thanks Marcus,

but those examples use directly the UHD driver and I have an hard time  
understanding how to translate them to use the GNURadio UHD source and  
sink blocks.

Are you implying that what I want to do cannot be done with the standard  
source and sync blocks and I would have to extend them for my purposes?

Thanks. Cheers,  
Daniele

---

<div class="post-metadata">

**Author:** ![Daniele\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/74df32/32.png) [@Daniele\_N](https://www.ruby-forum.com/u/Daniele_N)\
**Post date:** [July 22, 2014, 5:55pm UTC](https://www.ruby-forum.com/t/synchronizing-n210-tx-and-rx-channels/231127/4 "2014-07-22T17:55:24Z")

</div>

On 07/22/2014 11:29 AM, Daniele N. wrote:

> Thanks. Cheers,  
> Daniele

The sink blocks do accept tags, including ‘tx\_time’, which gives you  
functionally equivalent capabilities.

I’ve never used those capabilities myself.

There’s a small demo app:

…/gr-uhd/examples/c++/tags\_demo.cc

That shows how tags are used.

–  
Marcus L.  
Principal Investigator  
Shirleys Bay Radio Astronomy Consortium

> **[Live Draw HK Tercepat | Result HK | HK Pools | Live HK | HK Prize Hari Ini](https://www.sbrac.org)**
>
> Temukan live draw hk tercepat melalui halaman hk pools yang resmi dan dapatkan result hk prize melalui live hk secara langsung di situs kami.

---

<div class="post-metadata">

**Author:** ![Daniele\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/74df32/32.png) [@Daniele\_N](https://www.ruby-forum.com/u/Daniele_N)\
**Post date:** [July 22, 2014, 6:41pm UTC](https://www.ruby-forum.com/t/synchronizing-n210-tx-and-rx-channels/231127/5 "2014-07-22T18:41:52Z")

</div>

On 22/07/2014 18:18, Martin B. wrote:

> On top of what Marcus’ has said,
> 
> the gr-radar toolbox might be helpful. It has a block that takes a  
> tagged stream, and outputs a signal it acquired synchronously to the  
> transmitted one.

Thanks Martin. This seems to imply that there is no way to actually  
synchronize the hardware, and that the synchronization can only be done  
in software aligning the timestamps of the two streams. Is that the  
case?

Thanks. Cheers,  
Daniele

---

<div class="post-metadata">

**Author:** ![Daniele\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/74df32/32.png) [@Daniele\_N](https://www.ruby-forum.com/u/Daniele_N)\
**Post date:** [July 22, 2014, 7:15pm UTC](https://www.ruby-forum.com/t/synchronizing-n210-tx-and-rx-channels/231127/6 "2014-07-22T19:15:17Z")

</div>

Hey Daniele,

I have done the radar toolbox and implemented a synced USRP interface  
(USRP Echotimer).

You are right, the USRP Echotimer does align the timestamps of the TX/RX  
commands on both USRPs. But if you connect them by MIMO, the time and  
clock are pretty good in sync. Therefore I think the Echotimer can  
provide a sync with an accuracy of at least ± 1 sample. Check out [0]  
for a video of the sync. There is also a sync setup for testing  
(gr-radar/examples/usrp). Unfortunately the documentation is not  
finished yet.

But care: The Echotimer bursts only a packet in sync, it does not stream  
the whole time! The packet is defined by a tagged stream.

Greetings,  
Stefan

[0]

> **[Synchronisation Echotimer (USRP interface)](https://grradar.wordpress.com/2014/06/17/synchronisation-echotimer-usrp-interface/)**
>
> Now the radar toolbox provides a synchronized USRP interface! The new interface is called echotimer. Input and output are tagged streams and the setup are two USRPs connected with a MIMO cable with…

Am 22.07.2014 18:40, schrieb Daniele N.:

---

<div class="post-metadata">

**Author:** ![Daniele\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/74df32/32.png) [@Daniele\_N](https://www.ruby-forum.com/u/Daniele_N)\
**Post date:** [July 22, 2014, 6:20pm UTC](https://www.ruby-forum.com/t/synchronizing-n210-tx-and-rx-channels/231127/7 "2014-07-22T18:20:06Z")

</div>

On top of what Marcus’ has said,

the gr-radar toolbox might be helpful. It has a block that takes a  
tagged stream, and outputs a signal it acquired synchronously to the  
transmitted one.

removed\_email\_address@domain.invalid:kit-cel/gr-radar.git

M

---

<div class="post-metadata">

**Author:** ![Daniele\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/74df32/32.png) [@Daniele\_N](https://www.ruby-forum.com/u/Daniele_N)\
**Post date:** [July 22, 2014, 10:16pm UTC](https://www.ruby-forum.com/t/synchronizing-n210-tx-and-rx-channels/231127/8 "2014-07-22T22:16:06Z")

</div>

Hi Daniele,

your problem is actually harder: The latency of digital signal  
processing depends on your desired decimation, and analog signal latency  
depends on a ton of factors like target RF frequency, adjustable filters  
(if your daughterboard has something like this), antenna and cabling  
delay, and so on.  
The only real way to know is to _measure_ the roundtrip for each  
configuration, and that’s exactly what echotimer is for.

With best regards,  
Marcus

---

<div class="post-metadata">

**Author:** ![Daniele\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/74df32/32.png) [@Daniele\_N](https://www.ruby-forum.com/u/Daniele_N)\
**Post date:** [July 22, 2014, 7:27pm UTC](https://www.ruby-forum.com/t/synchronizing-n210-tx-and-rx-channels/231127/9 "2014-07-22T19:27:32Z")

</div>

Hello Stephan,

thank for your reply. What I would like to do is more simple than that:  
I need to synchronize tx and rx of the same USRP, not of two different  
devices. But I need continuous streaming and not burst.

Any help in this direction is much appreciated.

Thanks. Best,  
Daniele

---

<div class="post-metadata">

**Author:** ![Daniele\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/74df32/32.png) [@Daniele\_N](https://www.ruby-forum.com/u/Daniele_N)\
**Post date:** [July 23, 2014, 9:46am UTC](https://www.ruby-forum.com/t/synchronizing-n210-tx-and-rx-channels/231127/10 "2014-07-23T09:46:40Z")

</div>

Hello Marcus,

I’m aware of that, what I want to achieve at the moment is simply to  
have a predictable phase delay between the tx and rx channels. This is  
prerequisite to measure the round-trip time and account for it.

Cheers,  
Daniele

---

<div class="post-metadata">

**Author:** ![Daniele\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/74df32/32.png) [@Daniele\_N](https://www.ruby-forum.com/u/Daniele_N)\
**Post date:** [July 23, 2014, 11:13am UTC](https://www.ruby-forum.com/t/synchronizing-n210-tx-and-rx-channels/231127/11 "2014-07-23T11:13:37Z")

</div>

On 07/23/2014 10:43 AM, Stefan Wunsch wrote:

> My approach: Read the system time on the USRP, set the stream command on  
> actual\_time+some\_offset and spawn two threads with a tx\_streamer and a  
> rx\_streamer. You can use both of them on the sampe USRP without any  
> problems (just dont use two of the same type on one USRP). This should  
> also work with streaming if you can push your data in the work function  
> continuously.

You could also do this inside your app, without having to write new  
sources and sinks. If your N210s are connected via MIMO cable,  
synchronizing them in time and frequency is pretty straightforward.

M

---

<div class="post-metadata">

**Author:** ![Daniele\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/74df32/32.png) [@Daniele\_N](https://www.ruby-forum.com/u/Daniele_N)\
**Post date:** [July 23, 2014, 10:45am UTC](https://www.ruby-forum.com/t/synchronizing-n210-tx-and-rx-channels/231127/12 "2014-07-23T10:45:34Z")

</div>

Hey,

If you use the Echotimer you can use the same IP vor TX and RX, this  
should work.

Probably you can do your own USRP Sink/Source with UHD. You dont need  
much code to implement this (Echotimer ~300 lines in the \*impl.cc). Main  
change should be an other stream command (most likely  
STREAM\_MODE\_START\_CONTINUOUS [0]). Good code examples are UHD  
Sink/Source in gr-uhd and especially the examples from UHD itself (/host/examples). And the Echotimer of course!

My approach: Read the system time on the USRP, set the stream command on  
actual\_time+some\_offset and spawn two threads with a tx\_streamer and a  
rx\_streamer. You can use both of them on the sampe USRP without any  
problems (just dont use two of the same type on one USRP). This should  
also work with streaming if you can push your data in the work function  
continuously.

Greetings,  
Stefan

[0]  
[http://files.ettus.com/uhd\_docs/doxygen/html/structuhd\_1\_1stream\_\_cmd\_\_t.html#a4df1f2e22148b7e09ace0eca0dfbf904](http://files.ettus.com/uhd_docs/doxygen/html/structuhd_1_1stream __cmd__ t.html#a4df1f2e22148b7e09ace0eca0dfbf904)

Am 22.07.2014 19:25, schrieb Daniele N.:
