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

2020-03-13 Thread Martin Braun
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,  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])
>
>
>


Re: Accurate GPIO Clock

2020-03-13 Thread Martin Braun
Your hardware might have some hardware timers and programmable interrupts.
Otherwise, what Jean-Michel said... Time to bring out the FPGAs!

M

On Sun, 1 Mar 2020, 05:10 jean-michel.fri...@femto-st.fr, <
jean-michel.fri...@femto-st.fr> wrote:

> welcome to the field of real time operating systems. There are a few
> thousand
> pages about the latencies introduced by the scheduler in non-real time OS,
> the
> first google hit being
> https://www.veterobot.org/2012/04/precise-pwms-with-gpio-using-xenomai.html
> A few microseconds is not too bad actually. Unless you shift the hard real
> time
> task to hardware (FPGA), I am not sure you can get any better.
>
> JM
>
> --
> JM Friedt, FEMTO-ST Time & Frequency/SENSeOR, 26 rue de l'Epitaphe,
> 25000 Besancon, France
>
> March 1, 2020 12:57 PM, "Till Hülder"  wrote:
>
> > Hello,
> >
> > i want to build a accurate GPIO Clock . I wrote a wait function :
> >
> > void sleepus(int n)
> > {
> > clock_t end=clock()+n*CLOCKS_PER_SEC/100;
> > while(clock() < end) continue;
> > }
> >
> > And wait until the value of the bits change .I recognized that the time
> of these wait time is not
> > constant. It differs by a few microseconds.
> >
> > Is there are another way to get a more accurate clock ?
> >
> > Best regards ,
> >
> > Till
>
>


Re:

2020-03-13 Thread Sebastian Koslowski
Hi Vandit,

glad to hear you want to contribute to GNU Radio and especially to GRC.
Since you haven't explicitly mentioned it, I am assuming that you are
interested in a GSoC participation with GNU Radio.
If this is the case, please check-out our wiki [1], maybe
introduce yourself a little more and get to know the project (we have nice
tutorials).
If you have specific questions regarding the project idea, feel free to
contact me.

Sebastian

[1] https://wiki.gnuradio.org/index.php/GSoC

On Fri, Mar 13, 2020 at 5:51 AM Vandit Khurana 
wrote:

> Hi
>
> I'm Vandit, second year undergraduate from Chitkara University, India. I
> would love to contribute to the project "GRC: Build-in sub flowgraphs".
> Please guide me to work on it. A quick response will be highly appreciated.
>
> Yours sincerely
>
> Vandit
>