Hi,

After sending signal to the device and setting a proper carrier frequency (1GHz\
in this case) I can confirm that it works. To summarize I attach the working\
python script and screenshot of a figure that is drawn by the script.

Thank you Rob for the idea. It should be very useful for testing new blocks.

Best Regards,\
Piotr Krysik
#!/usr/bin/python3
import uhd
import numpy as np
import matplotlib.pyplot as plt

master_clock_rate = 256e6
fft_size = 256
mtu = 9000
graph = uhd.rfnoc.RfnocGraph("addr=192.168.10.2,master_clock_rate=256e6")

sa = uhd.usrp.StreamArgs("fc32", "sc16")

rx_streamer = graph.create_rx_streamer(1, sa)

decim = 128
ddc_block = graph.get_block("0/DDC#0")
ddc_control = uhd.rfnoc.DdcBlockControl(ddc_block)
ddc_control.set_input_rate(master_clock_rate, 0)
ddc_control.set_output_rate(master_clock_rate/decim, 0)

radio = uhd.rfnoc.RadioControl(graph.get_block("0/Radio#0"))
radio.set_properties("spp=" + str(fft_size))
radio.set_rx_frequency(1e9, 0)

graph.connect("0/Radio#0", 0, "0/DDC#0", 0, False)
graph.connect("0/DDC#0", 0, "0/FFT#0", 0)
graph.connect("0/FFT#0", 0, rx_streamer, 0)
graph.commit()

num_samps = int(fft_size * 10)

buffer = np.zeros((1, (int(mtu/fft_size+1)*fft_size)), dtype=np.complex64)

stream_cmd = uhd.types.StreamCMD(uhd.types.StreamMode.num_done)
stream_cmd.num_samps = num_samps
stream_cmd.stream_now = False
stream_cmd.time_spec = graph.get_mb_controller(0).get_timekeeper(0).get_time_now() + 1.0

rx_streamer.issue_stream_cmd(stream_cmd)
rx_metadata = uhd.types.RXMetadata()

ffts_abs = []
num_recv_samps = 0
for i in range(0, 20):
    num_recv_samps = rx_streamer.recv(buffer, rx_metadata, 0.1)
    if num_recv_samps > 0:
        break

print(num_recv_samps, rx_metadata)
ffts_abs = (np.abs(buffer[0:num_recv_samps]).real)[0]
plt.plot(ffts_abs)
plt.show()
plt.pause(10)
_______________________________________________
USRP-users mailing list -- usrp-users@lists.ettus.com
To unsubscribe send an email to usrp-users-le...@lists.ettus.com

Reply via email to