I've been trying to use the DDS to set up two CW outputs on the ADALM-PLUTO (modified for 2 tx and 2 rx ports).
I've been finding that only the second output to be declared will output a tone. Is this a limitation of the firmware, or am I missing something?
That is, if I use
sdr.dds_single_tone(freq, scale, 0)
...followed by
sdr.dds_single_tone(freq, scale, 1)
...there will only be a tone at the second port.
But if I switch the order of the lines, there will only be a tone at the first port. Is there something more I need to do?
Here's a script that illustrates my issue (if you loop the Tx back to the Rx ports)
import adi import numpy as np import matplotlib.pyplot as plt sdr = adi.ad9361("ip:192.168.2.1") sdr.rx_enabled_channels = [0, 1] sdr.tx_enabled_channels = [0, 1] sample_rate = int(30.72e6) lo_freq = int(1e9) cw_freq = int(1e6) sdr.sample_rate = sample_rate sdr.rx_rf_bandwidth = sample_rate sdr.tx_rf_bandwidth = sample_rate # set up Tx sdr.tx_lo = lo_freq sdr.tx_hardwaregain_chan0 = -10 sdr.tx_hardwaregain_chan1 = -10 ## Only the second DDS tone will generate an output ## ###################################################### sdr.dds_single_tone(cw_freq, 0.9, channel=0) sdr.dds_single_tone(0 - cw_freq, 0.9, channel=1) ###################################################### # set up Rx sdr.rx_lo = lo_freq sdr.gain_control_mode_chan0 = 'manual' sdr.gain_control_mode_chan1 = 'manual' sdr.rx_hardwaregain_chan0 = 0 sdr.rx_hardwaregain_chan1 = 0 # Clear Buffer for i in range (0, 10): sdr.rx() # Receive samples rx_samples = sdr.rx() # Calculate Power Spectral Density (Frequency Domain) psd_1 = np.abs(np.fft.fftshift(np.fft.fft(rx_samples[0])))**2 psd_dB_1 = 10*np.log10(psd_1) psd_2 = np.abs(np.fft.fftshift(np.fft.fft(rx_samples[1])))**2 psd_dB_2 = 10*np.log10(psd_2) # generate frequency span f = np.linspace(sample_rate/-2, sample_rate/2, sdr.rx_buffer_size) f += sdr.rx_lo # Plot full_fig = plt.figure(0) time_plot = full_fig.add_subplot(211) freq_plot = full_fig.add_subplot(212) # Time Plot time_plot.plot(np.real(rx_samples[0][:100]), label='Rx 1 Real') time_plot.plot(np.imag(rx_samples[0][:100]), label='Rx 1 Imag') time_plot.plot(np.real(rx_samples[1][:100]), label='Rx 2 Real') time_plot.plot(np.imag(rx_samples[1][:100]), label='Rx 2 Imag') time_plot.set_xlabel("Samples") time_plot.legend() time_plot.grid() # Freq Plot freq_plot.plot(f/1e6, psd_dB_1, alpha=0.7, label='Rx 1') freq_plot.plot(f/1e6, psd_dB_2, alpha=0.7, label='Rx 2') freq_plot.legend() freq_plot.set_xlabel("Frequency [MHz]") freq_plot.set_ylabel("PSD") freq_plot.grid() plt.show()
vs.