Hi there,
I just started using UHD Python API to implement a simple 
transmission-reception experiment on an Ettus X310. I have a UBX 160 
daughterboard installed on slot B, with its TX (TX/RX port) connected to RX 
(RX2 port) directly using a SMA cable and a 30dB attenuator. I plan to transmit 
a sequence of waveforms from TX/RX port and to see the waveforms received at 
the RX2 port. Ideally the two waveforms should be highly similar with some time 
shift in between, but the received waveforms turned out to be not quite right 
(see the diagram below, the upper diagram shows the real part of the 
transmitted waveform and the lower, the real part of the received.).

Some of the parameters are defined as following:duration = 10 # second, the 
time length of the transmitter sending the 
waveformscentre_freq=1e8sample_rate=200000num_samples=200000 # number of 
samples to be collected by the receiving side.gain_tx=0 #dBgain_rx=20
USRP is defined as:usrp = 
uhd.usrp.MultiUSRP()usrp.set_tx_subdev_spec(uhd.usrp.SubdevSpec("B:0"))usrp.set_tx_antenna("TX/RX")
usrp.set_rx_subdev_spec(uhd.usrp.SubdevSpec("B:0"))usrp.set_rx_antenna("RX2")usrp.set_rx_bandwidth(sample_rate,
 0)
As the transmission and the reception happen at the same time, they are put in 
two separate threads, as below:threads = []rx_thread = 
threading.Thread(target=receive_data, args=(usrp, num_samples, centre_freq_rx, 
sample_rate, gain_rx))threads.append(rx_thread)rx_thread.start()tx_thread = 
threading.Thread(target=usrp.send_waveform, args=(tx_signal, duration, 
centre_freq_tx, sample_rate, [0], 
gain_tx))threads.append(tx_thread)tx_thread.start()
Here the function, receive_data() in the first thread, is a user-defined (by 
me) function, receiving samples using the uhd provided method, 
usrp.recv_num_samps() and saving the samples to a .txt file. A little more on 
the data format saved in the file, I used np.savetxt() function to save the 
samples (a numpy array) to a text file. As the numpy array has a data type of 
np.complex64, the real and imaginary of the samples are saved in the same file 
in the format of np.float32. I can confirm that 200000 complex samples were 
collected in the file saved, which verifies (partially at least) that data 
format didn't go wrong.   
I have been working on this script for a whole day, but couldn't fix it. I 
suspect I didn't configure the usrp variable correctly. Any suggestions would 
be appreciated.
Kind regards,Tom









As the transmission and reception happen simultaneously, the Python scritp  
_______________________________________________
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