Help on gr_top_block and gr_hier_block2 when trying to receive after transmitting

Dear All,

I was trying to make a channel estimation procedure to work, and I am
in desperate need for some help. I had a preliminary version that
works only part of the time, and I decided to start from scratch. I
followed Eric’s advice and used tunnel.py as an example.

I have two USRPs, one called S and the other called R. The procedure is:
(1). S sends channel estimation sequence. R receives, and estimate the
channel.
(2). R sends the channel estimation report back to S.
(3). S sends data to R according to the channel estimation

Everything works perfectly until step (2), that is, S can get the
channel estimation report and can send data to R. The problem is that
R cannot receive. The signal received by R is almost always near 0. My
guess is that something is preventing R from receiving after it
started the transmit path.

Here is the skeleton of the code:

tb.start()

print "--- started listening! ---"

while not tb.rxpath.receiver.finished_phase_diff_est():
    time.sleep(0.001) #orig: 0.001

# here I do carrier sense, until the sender finishes
while tb.rxpath.receiver.est_snr() > 0.001:
    time.sleep(0.001)

print "--- sender stopped, preparing to send report! ---"

# here I call some functions to estimate the chanel

tb.lock()
tb.disconnect_all()

# the transmting path was not connected originally, because my

laptops are slow. I am getting some new ones.

# add then cannot receive begin
tb.connect(tb.txpath)
tb.unlock()
tb.txpath.set_tx_amplitude(_def_rv_tx_power)
print "--- sending rpt ---"

time.sleep(0.01) #orig: 0.01
tb.txpath.set_tx_amplitude(0)
time.sleep(0.1) #try to make sure that 0 is written into the data 

buffer.

tb.lock()
print "--- done sending! ---"
# add then cannot receive end

tb.disconnect_all()

tb.connect(tb.rxpath)

tb.unlock()
time.sleep(1)
print "--- done receving ---"

I noticed that if I delete the code between

# add then cannot receive begin
# add then cannot receive end

, then the receiver can receive some signals. txpath and rxpath are
both gr.hier_block2, and tb is gr_top_block, same as in tunnel.py. Can
someone give me some hint to this? Thanks so much!

Please let me know if more information is needed.

Best regards,
Zenny