CG
Christophe Grimault
Mon, Dec 16, 2024 2:15 PM
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
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
BP
Brian Padalino
Mon, Dec 16, 2024 2:27 PM
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
I don't think this is possible, but if it is I don't think it's advisable.
You should use 2 different streamers. The timestamps associated with them
should be the same so on the host you can still align them, but the
streamers itself I think would be weird trying to receive the same N
samples over the 2 channels.
Is there any particular reason you don't want to use 2 streamers?
Brian
On Mon, Dec 16, 2024 at 9:15 AM Christophe Grimault <
christophe.grimault@novagrid.com> wrote:
> 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
>
I don't think this is possible, but if it is I don't think it's advisable.
You should use 2 different streamers. The timestamps associated with them
should be the same so on the host you can still align them, but the
streamers itself I think would be weird trying to receive the same N
samples over the 2 channels.
Is there any particular reason you don't want to use 2 streamers?
Brian
CG
Christophe Grimault
Mon, Dec 16, 2024 2:44 PM
Hello Brian,
Thank you for this quick answer.
So I guess this is not a limitation related to using Python vs C++/boost
? Right ?
I understand that using the same streamer is tricky. Concerning your
advice to go with 2 streamers, you think this a totally fine way to go ?
Otherwise, I was trying to use a single streamer because I wanted to
have zero delay between the start time of the 2 streams.
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
Le 16/12/2024 à 15:27, Brian Padalino a écrit :
On Mon, Dec 16, 2024 at 9:15 AM Christophe Grimault
christophe.grimault@novagrid.com wrote:
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
I don't think this is possible, but if it is I don't think it's
advisable. You should use 2 different streamers. The timestamps
associated with them should be the same so on the host you can still
align them, but the streamers itself I think would be weird trying to
receive the same N samples over the 2 channels.
Is there any particular reason you don't want to use 2 streamers?
Brian
USRP-users mailing list --usrp-users@lists.ettus.com
To unsubscribe send an email tousrp-users-leave@lists.ettus.com
Hello Brian,
Thank you for this quick answer.
So I guess this is not a limitation related to using Python vs C++/boost
? Right ?
I understand that using the same streamer is tricky. Concerning your
advice to go with 2 streamers, you think this a totally fine way to go ?
Otherwise, I was trying to use a single streamer because I wanted to
have zero delay between the start time of the 2 streams.
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
Le 16/12/2024 à 15:27, Brian Padalino a écrit :
> On Mon, Dec 16, 2024 at 9:15 AM Christophe Grimault
> <christophe.grimault@novagrid.com> wrote:
>
> 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
>
>
> I don't think this is possible, but if it is I don't think it's
> advisable. You should use 2 different streamers. The timestamps
> associated with them should be the same so on the host you can still
> align them, but the streamers itself I think would be weird trying to
> receive the same N samples over the 2 channels.
>
> Is there any particular reason you don't want to use 2 streamers?
>
> Brian
>
> _______________________________________________
> USRP-users mailing list --usrp-users@lists.ettus.com
> To unsubscribe send an email tousrp-users-leave@lists.ettus.com
MD
Marcus D. Leech
Mon, Dec 16, 2024 3:53 PM
On 16/12/2024 09:44, Christophe Grimault wrote:
Hello Brian,
Thank you for this quick answer.
So I guess this is not a limitation related to using Python vs
C++/boost ? Right ?
I understand that using the same streamer is tricky. Concerning your
advice to go with 2 streamers, you think this a totally fine way to go ?
Otherwise, I was trying to use a single streamer because I wanted to
have zero delay between the start time of the 2 streams.
Chris
You'll HAVE to use two different streamers if you want them at different
sample rates. It's a fairly deep
architectural limitation.
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:27, Brian Padalino a écrit :
On Mon, Dec 16, 2024 at 9:15 AM Christophe Grimault
christophe.grimault@novagrid.com wrote:
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
I don't think this is possible, but if it is I don't think it's
advisable. You should use 2 different streamers. The timestamps
associated with them should be the same so on the host you can still
align them, but the streamers itself I think would be weird trying to
receive the same N samples over the 2 channels.
Is there any particular reason you don't want to use 2 streamers?
Brian
USRP-users mailing list --usrp-users@lists.ettus.com
To unsubscribe send an email tousrp-users-leave@lists.ettus.com
On 16/12/2024 09:44, Christophe Grimault wrote:
>
> Hello Brian,
>
> Thank you for this quick answer.
>
> So I guess this is not a limitation related to using Python vs
> C++/boost ? Right ?
>
> I understand that using the same streamer is tricky. Concerning your
> advice to go with 2 streamers, you think this a totally fine way to go ?
>
> Otherwise, I was trying to use a single streamer because I wanted to
> have zero delay between the start time of the 2 streams.
>
> Chris
>
You'll HAVE to use two different streamers if you want them at different
sample rates. It's a fairly deep
architectural limitation.
> 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:27, Brian Padalino a écrit :
>> On Mon, Dec 16, 2024 at 9:15 AM Christophe Grimault
>> <christophe.grimault@novagrid.com> wrote:
>>
>> 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
>>
>>
>> I don't think this is possible, but if it is I don't think it's
>> advisable. You should use 2 different streamers. The timestamps
>> associated with them should be the same so on the host you can still
>> align them, but the streamers itself I think would be weird trying to
>> receive the same N samples over the 2 channels.
>>
>> Is there any particular reason you don't want to use 2 streamers?
>>
>> Brian
>>
>> _______________________________________________
>> USRP-users mailing list --usrp-users@lists.ettus.com
>> To unsubscribe send an email tousrp-users-leave@lists.ettus.com
>
> _______________________________________________
> USRP-users mailing list --usrp-users@lists.ettus.com
> To unsubscribe send an email tousrp-users-leave@lists.ettus.com
BP
Brian Padalino
Mon, Dec 16, 2024 3:53 PM
Hello Brian,
Thank you for this quick answer.
So I guess this is not a limitation related to using Python vs C++/boost ?
Right ?
I understand that using the same streamer is tricky. Concerning your
advice to go with 2 streamers, you think this a totally fine way to go ?
Otherwise, I was trying to use a single streamer because I wanted to have
zero delay between the start time of the 2 streams.
On Mon, Dec 16, 2024 at 9:44 AM Christophe Grimault <
christophe.grimault@novagrid.com> wrote:
> Hello Brian,
>
> Thank you for this quick answer.
>
> So I guess this is not a limitation related to using Python vs C++/boost ?
> Right ?
>
> I understand that using the same streamer is tricky. Concerning your
> advice to go with 2 streamers, you think this a totally fine way to go ?
>
> Otherwise, I was trying to use a single streamer because I wanted to have
> zero delay between the start time of the 2 streams.
>
I think using two streamers and the timestamp functionality is good. Check
the Streamed Commands here for how to tell a stream to start at a specific
time:
https://files.ettus.com/manual/page_timedcmds.html#timedcmds_stream_cmds
Brian
CG
Christophe Grimault
Mon, Dec 16, 2024 6:47 PM
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
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-leave@lists.ettus.com
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
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-leave@lists.ettus.com
CG
Christophe Grimault
Mon, Dec 16, 2024 6:48 PM
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
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-leave@lists.ettus.com
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 à 16:53, Brian Padalino a écrit :
On Mon, Dec 16, 2024 at 9:44 AM Christophe Grimault
christophe.grimault@novagrid.com wrote:
Hello Brian,
Thank you for this quick answer.
So I guess this is not a limitation related to using Python vs
C++/boost ? Right ?
I understand that using the same streamer is tricky. Concerning
your advice to go with 2 streamers, you think this a totally fine
way to go ?
Otherwise, I was trying to use a single streamer because I wanted
to have zero delay between the start time of the 2 streams.
I think using two streamers and the timestamp functionality is good.
Check the Streamed Commands here for how to tell a stream to start at
a specific time:
https://files.ettus.com/manual/page_timedcmds.html#timedcmds_stream_cmds
Brian
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
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-leave@lists.ettus.com
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 à 16:53, Brian Padalino a écrit :
> On Mon, Dec 16, 2024 at 9:44 AM Christophe Grimault
> <christophe.grimault@novagrid.com> wrote:
>
> Hello Brian,
>
> Thank you for this quick answer.
>
> So I guess this is not a limitation related to using Python vs
> C++/boost ? Right ?
>
> I understand that using the same streamer is tricky. Concerning
> your advice to go with 2 streamers, you think this a totally fine
> way to go ?
>
> Otherwise, I was trying to use a single streamer because I wanted
> to have zero delay between the start time of the 2 streams.
>
>
> I think using two streamers and the timestamp functionality is good.
> Check the Streamed Commands here for how to tell a stream to start at
> a specific time:
>
> https://files.ettus.com/manual/page_timedcmds.html#timedcmds_stream_cmds
>
> Brian
MD
Marcus D. Leech
Mon, Dec 16, 2024 6:56 PM
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-leave@lists.ettus.com
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-leave@lists.ettus.com
>
> _______________________________________________
> USRP-users mailing list --usrp-users@lists.ettus.com
> To unsubscribe send an email tousrp-users-leave@lists.ettus.com
BP
Brian Padalino
Mon, Dec 16, 2024 7:24 PM
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.0start_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 = Falsestream_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 = Falsestream_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?
My guess is that you're going through another Halfband FIR filter
somewhere, so there is group delay that isn't being accounted for in the
digital filters.
What is the lag (in samples) of the lower rate sampled signal?
Brian
On Mon, Dec 16, 2024 at 1:57 PM Marcus D. Leech <patchvonbraun@gmail.com>
wrote:
> 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.0start_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 = Falsestream_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 = Falsestream_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?
>
My guess is that you're going through another Halfband FIR filter
somewhere, so there is group delay that isn't being accounted for in the
digital filters.
What is the lag (in samples) of the lower rate sampled signal?
Brian
MD
Marcus D. Leech
Mon, Dec 16, 2024 7:26 PM
On 16/12/2024 14:24, Brian Padalino wrote:
My guess is that you're going through another Halfband FIR filter
somewhere, so there is group delay that isn't being accounted for in
the digital filters.
What is the lag (in samples) of the lower rate sampled signal?
Brian
That was my other thought, assuming that the streams really are starting
at the same time--different group delay
due to the different sample rates.
On 16/12/2024 14:24, Brian Padalino wrote:
>
>
> My guess is that you're going through another Halfband FIR filter
> somewhere, so there is group delay that isn't being accounted for in
> the digital filters.
>
> What is the lag (in samples) of the lower rate sampled signal?
>
> Brian
That was my other thought, assuming that the streams really are starting
at the same time--different group delay
due to the different sample rates.