Trouble on top block lock/disconnect/connect/unlock with usrp2

Happy New Year! folks,

I need to dynamically change software filter coefficient according to
user
command while the program is running.
So, I made a test program similar to the following.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class my_top_block(gr.top_block):
Bla bla bla ~~~
usrp2 initialization and flow graph generation
Bla bla bla ~~~

self.connect(self.u, self.s2v, self.fft, self.c2mag, self.stats)

def Main(tb):
Bla bla bla ~~~
Various preparations
Bla bla bla ~~~

while(1):
    check_uesr_command()

    tb.lock()
    print "Tob block locked"
    tb.disconnect(tb.u, tb.s2v, tb.fft, tb.c2mag, tb.stats)
    print "Tob block disconnected"
    tb.connect(tb.u, tb.s2v, tb.fft, tb.c2mag, tb.stats)
    print "Tob block re-connected"
    tb.unlock()
    print "Tob block unlocked"

    Bla bla bla ~~~

if name == ‘main’:
tb = my_top_block()

try:
    tb.start()
    main_loop(tb)

except KeyboardInterrupt:
    pass

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

While it is running, the program hangs after the following messages

++++++++++++++++++++++++++
Tob block locked
Tob block disconnected
Tob block re-connected
Tob block unlocked
usrp2: channel 0 not receiving
usrp2::rx_samples() failed
++++++++++++++++++++++++++

The program hangs at the point that it is waiting for the message queue
to
be filled. My guess is that the usrp2 stops sending samples to host
after
the lock/disconnect/connect/unlock procedure.
Without the lock/disconnect/connect/unlock procedure, it works pretty
well
for quite a long time like several days.
I don’t know what I did wrong.

Any hints or advice?

Regards,

ILKYOUNG

On Sun, Jan 03, 2010 at 02:41:35AM +0900, ILKYOUNG KWOUN wrote:

Happy New Year! folks,

I need to dynamically change software filter coefficient according to user
command while the program is running.
So, I made a test program similar to the following.

There’s no reason to do all this lock/disconnect/connect/unlock stuff
if all you want to do is change the filter coefficients.

Just set them.

Eric

Eric,

Thank you for your prompt comment. :slight_smile:

My mistake on the previous explanation. Actually, what I want to do is
not
simply change the filter coefficients but to change the entire filter.

To prevent the sample value converge to ‘0’ by the hardware decimation
filters in FPGA(I posted once asking this matter before), I fixed the
usrp2
decimation rate to ‘4’ and implemented software decimation filters.
The filter frequency band(passband cut-off, stopband cut-off) and number
of
decimation would dynamically changes. So, my idea is to re-generate the
filter every time the user command changes. To do this, I thought I had
to
perform the ‘lock/disconnect/changing_filter(s)/connect/unlock’
procedure.
(The filter(s) shall be between ‘self.u’ and ‘self.s2v’ in my previous
post)

  1. Am I on the right track? Or, still can I just change the filter
    coeffs.
    and decimation rate at runtime?

  2. Filter coeffs. and decimation rate are two parameters of
    gr.fir_filter_ccf() function to generate a decimation filter. What
    function
    can I use to change the parameters of running filter instance?

  3. This is an off topic, but I wonder if gnuraio.org server is still
    down. I
    could not have connected the site since evening of the day before
    yesterday.

Regards,
ILKYOUNG.

2010/1/3 Eric B. [email protected]