On 16/12/2024 13:47, Christophe Grimault wrote:

I followed your advice and I'm getting closer !-)

I tried this :

usrp = uhd.usrp.MultiUSRP(f"addr=192.168.30.2")
duration =10.0 start_time_spec = 
uhd.libpyuhd.types.time_spec(usrp.get_time_now().get_real_secs() +1.0)

rx_rates = [390625.0*2,390625.0]

# --------------- # Craft commands # --------------- # Start with chan 0 ... usrp.set_rx_rate(rx_rates[0],chan=0)
rx_tune_request0 = uhd.types.TuneRequest(1100.0e6)
usrp.set_rx_freq(tune_request=rx_tune_request0,chan=0)
usrp.set_rx_gain(45.0,chan=0)
num_samps0 = math.ceil(int(usrp.get_rx_rate(chan=0)) * duration)

rx_streamer_args0 = uhd.usrp.StreamArgs("fc32","sc16")
rx_streamer_args0.channels = [0]
rx_streamer0 = usrp.get_rx_stream(rx_streamer_args0)
max_samps_per_packet = rx_streamer0.get_max_num_samps()
L0 = math.ceil(num_samps0 / max_samps_per_packet) * max_samps_per_packet
recv_buffer0 = np.zeros(L0,dtype=np.complex64)
stream_cmd0 = uhd.types.StreamCMD(uhd.types.StreamMode.start_cont)#num_done) 
stream_cmd0.stream_now =False stream_cmd0.num_samps = num_samps0
stream_cmd0.time_spec = start_time_spec

# Then chan 1, which is 2 times slower. usrp.set_rx_rate(rx_rates[1],chan=1)
rx_tune_request1 = uhd.types.TuneRequest(1100.0e6)
usrp.set_rx_freq(tune_request=rx_tune_request1,chan=1)
usrp.set_rx_gain(35.0,chan=1)
num_samps1 = math.ceil(int(usrp.get_rx_rate(chan=1)) * duration)

rx_streamer_args1 = uhd.usrp.StreamArgs("fc32","sc16")
rx_streamer_args1.channels = [1]
rx_streamer1 = usrp.get_rx_stream(rx_streamer_args1)
max_samps_per_packet = rx_streamer1.get_max_num_samps()
L1 = math.ceil(num_samps1 / max_samps_per_packet) * max_samps_per_packet
recv_buffer1 = np.zeros(L1,dtype=np.complex64)
stream_cmd1 = uhd.types.StreamCMD(uhd.types.StreamMode.start_cont)#num_done) 
stream_cmd1.stream_now =False stream_cmd1.num_samps = num_samps1
stream_cmd1.time_spec = start_time_spec

# -------------------------------------------------- # Launch sampling on both streamers, i.e. channels # -------------------------------------------------- rx_streamer0.issue_stream_cmd(stream_cmd0)
rx_streamer1.issue_stream_cmd(stream_cmd1)

metadata0 = uhd.types.RXMetadata()
nb_samples0 = rx_streamer0.recv(recv_buffer0, metadata0,3.0)

metadata1 = uhd.types.RXMetadata()
nb_samples1 = rx_streamer1.recv(recv_buffer1, metadata1,3.0)

metadata0.time_spec.get_real_secs() - metadata1.time_spec.get_real_secs()

And got the attached figures.

Over the 10 s of capture, I switch of the signal at the same time on both channels (exact same time because the switch is before the RF coupler). Both capture are roughly aligned in time, but when I zoom, I see 26 us of delay (which is roughly 10 samples at rx_rate_1 of 390625). Am I wrong expecting a "perfect timing" ? And when I compute :

metadata0.time_spec.get_real_secs() - metadata1.time_spec.get_real_secs()

still I get 0.0 us.

What am I doing wrong ? Shall I launch threads ?

Any thoughts ?

Thanks in advance

Chris

A cursory inspection of your code doesn't indicate any glaring errors, but your start-time is only 1 second ahead of when   you get the time from the device.  That MAY not be enough to get both streamers set-up so that they'll "trigger" at the
  same time.

What device type is this?



Christophe Grimault
NovaGrid SAS
Les Jardins de la Teillais
3, allée de la grande égalonne
35740 Pacé, France
Tel : (33)2 23 41 37 97
Mob: (33)6 82 22 46 93
www.novagrid.com
Le 16/12/2024 à 15:15, Christophe Grimault a écrit :

Dear users,

I'm using python wrappers with UHD >= 4.5 and a X300 with 2 twinRx.

I would like to know if it is possible to create a streamer, for more than N channels, with a sampling rate which different for each channel.

As for now, when I try this, I get all my 4 channels with the same sampling rate, which is the one of the last channel added.

Is it just possible to do it ? Say, for example,  have a streamer with 2 channels :

  * chan 0 on fc = 140 Mhz, rx_rate=20 MS/s
  * chan 1 on fc = 140 MHz, rx_rate=1 MS/s

Thanks in advance

Chris


--
Christophe Grimault
NovaGrid SAS
Les Jardins de la Teillais
3, allée de la grande égalonne
35740 Pacé, France
Tel : (33)2 23 41 37 97
Mob: (33)6 82 22 46 93
www.novagrid.com

_______________________________________________
USRP-users mailing list --usrp-users@lists.ettus.com
To unsubscribe send an email tousrp-users-le...@lists.ettus.com

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