Hi Sunny,
I have never tried this, but I'm wondering if you can send multiple
rx_streamer->issue_stream_cmd() prior to calling the first
rx_streamer->recv()?  Or, a similar idea of separating the
issue_stream_cmd() into a separate thread from the recv()?
Rob

On Wed, Aug 18, 2021 at 11:34 AM Sunny Sam <[email protected]> wrote:

> Hello,
>
> I want to be able to schedule multiple timed receives without waiting for
> the rx_streamer blocking call to schedule the next receive. When the time
> difference between two consecutive rx_streamer->recv() calls is below
> around 400 microseconds, the  time_spec for the second call sometimes will
> be in the past because of the latency of the first blocking call
> for lower sample rates. Is there a way to schedule multiple receives in
> advance to avoid this issue? I included a sample code below. The
> next_rx_time is configured to make sure rx has enough time to collect the
> number of samples specified in num_rx_samples based on the radio sample
> rate. I am using X310.
>
> For tx, the buffer and the time to send is issued with the
> tx_streamer.send() call. But for rx, the time to receive has to be set
> first with issue_stream_cmd before calling the rx_streamer.recv(). Why is
> this implemented this way for rx?
>
> uhd::stream_cmd_t
> stream_cmd(uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE);
> stream_cmd.stream_now = false;
> stream_cmd.num_samps = num_rx_samples;
> stream_cmd.time_spec = uhd::time_spec_t(rx_time_spec);
> rx_streamer->issue_stream_cmd(stream_cmd);
>
> while (1)
> {
>    rx_streamer->recv(&buff.front(),  num_rx_samples , md, 1.0);
>    ....
>    //schedule the next recv
>    rx_time_spec += next_rx_time;
>    stream_cmd.time_spec = uhd::time_spec_t(rx_time_spec);
>    stream_cmd.stream_now = false;
>    stream_cmd.num_samps =  num_rx_samples;
>    rx_streamer->issue_stream_cmd(stream_cmd);
> }
>
> Thank you in advance for your help.
>
> Sunny
> _______________________________________________
> USRP-users mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
>
_______________________________________________
USRP-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to