discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: gr-uhd: Switching DSP frequency of *RX* over stream tags in TX (USRP


From: Martin Braun
Subject: Re: gr-uhd: Switching DSP frequency of *RX* over stream tags in TX (USRP Sink)
Date: Fri, 13 Mar 2020 09:05:30 -0700

Lukas,

There's a pull request being discussed right now on GitHub (on my phone, so you'll have to find it yourself) that might do what you need.

Please head over there and join the conversation.

M

On Tue, 3 Mar 2020, 14:38 Lukas Haase, <address@hidden> wrote:
Hi,

I need to (synchronously) switch the DUC/DDC frequency at certain sample intervals.

I previously used the message ports for that and created timed commands. This worked nicely for the RX (USRP Source) and with analog retuning.
However, it turned out that this does not work for the transmitter with DUC-only retuning since the DUC/DDC does not have access to the MB clock. On the other hand, gr-uhd does not add the sample timing information needed. See our discussion in http://lists.ettus.com/pipermail/usrp-users_lists.ettus.com/2020-March/061615.html.

It was suggested to try stream tags and bounce this question on this mailing list.

I now use stream tags with USRP Sink with the module below.
Now the DSP retuning seems to work nicely but ONLY for TX.
How can I re-tune RX as well?

My approach with the message ports would have allowed me to do both. However, stream tags I can only use for "USRP Sink".

Any suggestions are highly appreciated.


Best,
Lukas







PS: This is the code which adds stream tags to retune DUC for USRP Sink:

import numpy as np
import pmt
from gnuradio import gr
from gnuradio import uhd

class blk(gr.sync_block):
    def __init__(self, hop_interval_samples=1000, hop_frequencies=[ 0 1e6 ]):
        gr.sync_block.__init__(
            self,
            name='Controller',
            in_sig=[np.complex64],
            out_sig=[np.complex64]
        )
        self.hop_frequencies = hop_frequencies
        self.hop_interval_samples = int(hop_interval_samples)
        # state
        self.next_hop = self.hop_interval_samples
        self.current_freq_idx = 0

    def work(self, input_items, output_items):
        output_items[0][:] = input_items[0]

        window_start = self.nitems_read(0)
        window_end = window_start + len(input_items[0])

        while(self.next_hop > window_start and self.next_hop < window_end):
            fcenter = self.hop_frequencies[self.current_freq_idx]

            key = pmt.intern("tx_command")
            value = pmt.make_dict()
            value = pmt.dict_add(value, pmt.to_pmt("lo_freq"), pmt.to_pmt(900e6))
            value = pmt.dict_add(value, pmt.to_pmt("dsp_freq"), pmt.to_pmt(-fcenter))
            self.add_item_tag(0, self.next_hop, key, value)
            self.next_hop = self.next_hop + self.hop_interval_samples
            self.current_freq_idx = (self.current_freq_idx + 1) % len(self.hop_frequencies)

        return len(output_items[0])



reply via email to

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