[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gr-uhd: Switching DSP frequency of *RX* over stream tags in TX (USRP Sin
From: |
Lukas Haase |
Subject: |
gr-uhd: Switching DSP frequency of *RX* over stream tags in TX (USRP Sink) |
Date: |
Tue, 3 Mar 2020 23:33:36 +0100 |
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])
- gr-uhd: Switching DSP frequency of *RX* over stream tags in TX (USRP Sink),
Lukas Haase <=