Hi Martin,
Thanks for your suggestions. I have been playing with the script, and just made 
a progress. One of the issues in my previous script was that the pulse shaped 
samples which are stored in a numpy array has a data type (i.e. dtype) of 
np.complex128 which was supposed to be np.complex64. After a conversion to 
np.complex64, the waveforms looks a lot better (the shape of the received 
waveforms looks reasonably similar with those transmitted.). I was focusing on 
the signal processing within the SDR, suspecting there was aliasing or iq 
imbalance causing the issue, which turned out to be a wrong direction.

Kind regards,Tom
    On Thursday 12 December 2024 at 03:05:52 am AEDT, Martin Braun 
<martin.br...@ettus.com> wrote:  
 
 Tom,
some pointers:
- I recommend using timed streaming for both Tx and Rx. You will get a more 
deterministic time offset.- I think you're not accounting for phase offsets as 
well as time offsets. Your two signals do look similar -- maybe plot the 
envelope instead of the real part. Also, you can play around with gain settings 
to get a better amplitude alignment.- Looping back into the same daughterboard 
means you need to deal with crosstalk. If you're just playing around, you might 
be fine but in general, if there's leakage from the Tx channel to the Rx 
channel, it will interfere with the signal received through the cable.
--M

On Wed, Dec 11, 2024 at 12:58 PM Q W via USRP-users 
<usrp-users@lists.ettus.com> wrote:

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

_______________________________________________
USRP-users mailing list -- usrp-users@lists.ettus.com
To unsubscribe send an email to usrp-users-le...@lists.ettus.com
  
_______________________________________________
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