discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] TX and RX synchronization to control latency


From: Daniele Nicolodi
Subject: [Discuss-gnuradio] TX and RX synchronization to control latency
Date: Tue, 04 Aug 2015 14:43:59 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

Hello,

the recommended way to control latency due to buffers both in software
and hardware is to synchronize the TX and RX streams, namely to have a
mechanism that emits samples only when samples are received, minus a
maximum latency.

My naive solution to implement that is this:

class synchronize(gr.hier_block2):
    def __init__(self, fs, delay):
        gr.hier_block2.__init__(self, self.__class__.__name__,
            gr.io_signature(2, 2, gr.sizeof_gr_complex),
            gr.io_signature(1, 1, gr.sizeof_gr_complex))

        delay = blocks.delay(gr.sizeof_gr_complex, int(fs * delay))
        multiply = blocks.multiply_const_cc(0)
        add = blocks.add_cc()
        self.connect((self, 0), (add, 0))
        self.connect((self, 1), delay, multiply, (add, 1))
        self.connect(add, self)

Which is simple enough, but also probably not the most efficient or
elegant way. There is a better way of doing it, other than writing a new
block, probably based on the delay block?

Cheers,
Daniele



reply via email to

[Prev in Thread] Current Thread [Next in Thread]