# Get a pointer to UHD Sink from other block in flow graph

**URL:** <https://www.ruby-forum.com/t/get-a-pointer-to-uhd-sink-from-other-block-in-flow-graph/232573>\
**Category:** GNU Radio\
**Created:** [October 16, 2014, 12:42pm UTC](https://www.ruby-forum.com/t/get-a-pointer-to-uhd-sink-from-other-block-in-flow-graph/232573 "2014-10-16T12:42:41Z")\
**Posts on this page:** 5\
**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:** [October 16, 2014, 12:42pm UTC](https://www.ruby-forum.com/t/get-a-pointer-to-uhd-sink-from-other-block-in-flow-graph/232573/1 "2014-10-16T12:42:41Z")

</div>

Hi All,

Is there any way to get a pointer to a UHD sink block from another block  
in a flow graph, such that I can read from the time registers of a USRP?

Regards,

David

* * *

David Halls Ph.D.  
Research Engineer  
Toshiba Research Europe Limited  
32 Queen Square, Bristol, BS1 4ND, UK  
Tel: +44 (0) 117 906 0790

* * *

NOTE: The information in this email and any attachments may be  
confidential and/or legally privileged. This message may be read, copied  
and used only by the intended recipient. If you are not the intended  
recipient, please destroy this message, delete any copies held on your  
system and notify the sender immediately.

Toshiba Research Europe Limited, registered in England and Wales  
(2519556). Registered Office 208 Cambridge Science Park, Milton Road,  
Cambridge CB4 0GZ, England. Web: www.toshiba.eu/research/trl

---

<div class="post-metadata">

**Author:** ![divotdave](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bbe5ce/32.png) [@divotdave](https://www.ruby-forum.com/u/divotdave)\
**Post date:** [October 16, 2014, 1:23pm UTC](https://www.ruby-forum.com/t/get-a-pointer-to-uhd-sink-from-other-block-in-flow-graph/232573/2 "2014-10-16T13:23:11Z")

</div>

On 10/16/2014 12:41 PM, David Halls wrote:

> Is there any way to get a pointer to a UHD sink block from another  
> block in a flow graph, such that I can read from the time registers of  
> a USRP?

Depends how you’re building your flow-graph: In Python, simply pass a  
reference to your UHD block object to your block.  
In GRC, there is no way to reference another block id in a block’s  
params. Try this patch, if you want that [0]. Else, you could  
assume a fixed uhd sink block id and add that to your blocks XML’s make  
template.

Sebastian

[0]

> <https://github.com/skoslowski/gnuradio/commit/c90e2ddf1cea38ee2400ef56b234758048d980bf>

–  
Karlsruhe Institute of Technology (KIT)  
Communications Engineering Lab (CEL)

Dipl.-Ing. Sebastian Koslowski  
Research Associate

Kaiserstraße 12  
Building 05.01  
76131 Karlsruhe, Germany

Phone: +49 721 608-46275  
Fax: +49 721 608-46071  
Email: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Web: [http://www.cel.kit.edu/](http://www.cel.kit.edu/)

KIT – University of the State of Baden-Wuerttemberg and National  
Research Center of the Helmholtz Association

---

<div class="post-metadata">

**Author:** ![divotdave](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bbe5ce/32.png) [@divotdave](https://www.ruby-forum.com/u/divotdave)\
**Post date:** [October 16, 2014, 3:44pm UTC](https://www.ruby-forum.com/t/get-a-pointer-to-uhd-sink-from-other-block-in-flow-graph/232573/3 "2014-10-16T15:44:19Z")

</div>

On Thu, Oct 16, 2014 at 8:54 AM, Marcus Müller [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> conditions…
> 
> also, if you want to do things like defining starts and ends of burst,  
> you might do so using the good ol’ stream tags.
> 
> So many possibilities!
> 
> Greetings,  
> Marcus

Yes, Marcus is right. Use the message ports and stream tags to  
manipulate  
other blocks. Passing them around as references is bad practice because  
of  
lifecycle concerns of the block’s use inside the scheduler. You want to  
communicate through interfaces, not the objects themselves.

Tom

---

<div class="post-metadata">

**Author:** ![divotdave](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bbe5ce/32.png) [@divotdave](https://www.ruby-forum.com/u/divotdave)\
**Post date:** [October 16, 2014, 4:20pm UTC](https://www.ruby-forum.com/t/get-a-pointer-to-uhd-sink-from-other-block-in-flow-graph/232573/4 "2014-10-16T16:20:39Z")

</div>

Thanks Sebastian,

My solution in the end was to use a UHD source, which generates rx\_time,  
I then created a block which reads in this rx\_time tag and sends it as a  
message to a block just before my UHD sink which converts this to a  
tx\_time based on the number of bursts sent, and the burst interval that  
I desire.

Note that if you are transmitting MIMO, i.e. multiple USRPs in one UHD  
sink, you also have to use multiple USRPs in the UHD source to produce  
the rx\_time (although they multiple rx\_times will be equal).

Regards,

David

---

<div class="post-metadata">

**Author:** ![divotdave](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bbe5ce/32.png) [@divotdave](https://www.ruby-forum.com/u/divotdave)\
**Post date:** [October 16, 2014, 2:59pm UTC](https://www.ruby-forum.com/t/get-a-pointer-to-uhd-sink-from-other-block-in-flow-graph/232573/5 "2014-10-16T14:59:03Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

… and in C++ you can just use the sptr that you normally use when  
using the uhd sink.

But: since Martin added the message ports to the UHD blocks, things  
have gotten easier; you can just add an output message port to your  
block and connect it to the message port of the UHD sink, and send  
commands there without needing to care about objects, pointers, race  
conditions…

also, if you want to do things like defining starts and ends of burst,  
you might do so using the good ol’ stream tags.

So many possibilities!

Greetings,  
Marcus

On 16.10.2014 13:11, Koslowski, Sebastian (CEL) wrote:

> uhd sink block id and add that to your blocks XML’s make template.  
> 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)

-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1

iQEcBAEBAgAGBQJUP7/8AAoJEAFxB7BbsDrLmCsH/Rq2P5TH2/Xe4+oAdmS5WoH+  
VxOa5+DhfOPCGjzUgb/zyzMUBN+nj6rLwNNXCBL2y4zH5VYlnhNE2z9yCPnqGZRd  
ELyJ0irEuviYSUCx9SMfYxfWyYlnQnj94t3A49DPrXhECZoa2lZDoJBuFQpTawvG  
rk/A27B0PfLhbYfTQ+D50EmgFbzwm8a3I7ChAi0kL8SIHtCQi5fYunYBVjlzDh07  
NnC7Xjcgx3HGhwTN1Q+YVEFRgBT6FfR45jhkmSS/GqwZa+Bz8KCjIF890qM//omi  
3SmQT9pK8haqJWcHSTuX3sZeiM1zdwnjvPr5KscAZDH9FZni6IJYjs3JWq0BKL8=  
=IAbe  
-----END PGP SIGNATURE-----
