Hi Tim, The recv() call will return if an EOB is detected, or there's a jump in timestamps. In other words, using recv(), the only option you have is to receive bursts one-by-one. As you've probably noticed, you can only return one metadata object per receive call (hence the discontinuity; the recv() call wouldn't be able to do what you're asking).
However, that's not necessarily so bad. Internally, the recv() call is just a loop over a buffer interface (e.g., when using Ethernet packets, it would fish one Ethernet packet out of a network buffer at a time, look at the metadata, and then do whatever makes sense). If you want your Python code to concatenate recv() calls, then use the return value `num_rx_samps` to index your `rx_buffer`, and add a separate list of metadata objects. --M On Thu, Dec 12, 2024 at 1:24 PM Tim Vancauwenbergh < tim.vancauwenberg...@gmail.com> wrote: > Hi all, > > I am working with the UHD Python API to handle burst-mode data > transmission and reception. Both the transmitter and receiver are set to be > active at specific times, for a fixed number of samples per burst. This > process occurs approximately 100 times per second. > > Currently, the transmit and receive processes are handled in separate > threads, where they wait for a timestamp to start their respective > operations. When both are finished, a new loop begins. The waiting however > can create some late commands. I would like to process the buffer > separately. > > For each RX burst, the following function is called: > *rx_buffer_size = int(5000) # each recv is 500 samples, but we want more > space for multiple bursts* > *rx_buffer = np.zeros(rx_buffer_size, dtype=np.complex64)* > > *def rx(start_time, rx_streamer, rx_buffer, rx_metadata):* > * global rx_time* > * rx_stream_cmd = uhd.types.StreamCMD(uhd.types.StreamMode.num_done)* > * rx_stream_cmd.num_samps = 500* > * rx_stream_cmd.stream_now = False* > * rx_stream_cmd.time_spec = start_time* > * rx_streamer.issue_stream_cmd(rx_stream_cmd)* > > * num_rx_samps = rx_streamer.recv(rx_buffer, rx_metadata, timeout=1.0)* > * rx_time = rx_metadata.time_spec.get_real_secs()* > > Each receive burst consists of exactly 500 samples. However, this approach > feels inefficient as I am processing each burst individually. My goal is to: > > 1. *Optimize Efficiency*: Fill a larger buffer with multiple bursts > (e.g., 10 bursts = 5000 samples) before processing. > 2. *Preserve Timestamps*: Retain the metadata timestamp for each burst > (i.e., every 500th sample) within the larger buffer. > > For example, if a buffer holds 10 bursts, I would like: > > - The buffer to contain 5000 samples. > - To retrieve the rx_metadata timestamp for the first sample of each > burst (at indices 0, 500, 1000, ...). > > How can I achieve this efficiently while ensuring accurate timestamp > extraction for each burst? > > Best regards, > Tim > _______________________________________________ > 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