The code is hard to read in the formatting that came through. But some
comments:
- start_of_burst is not actually required, that's true. It's a remnant from
the past.
- You don't send a zero after EOB, rather, you need to attach the EOB to
something. In your example, you could also attach EOB to the last loop
iteration's send() call.

--M

On Thu, Oct 24, 2024 at 10:47 AM <yibinden...@outlook.com> wrote:

> Hi, I am new to usrp. In a test I want to send a constant bit for a while
> using my B210 at a sampling rate of 1M. One way is to call send_wave() in
> python api. The received signal is shown in fig.1, which is relatively good.
>
> As an alternative, I wrote a send function on my own based on send_wave(),
> and invoke it in a loop. The code is as follows. However there are spikes
> in the received signal with a periodic of length of samples, which is shown
> in fig.2.
>
> def my_send(
>
> waveform_proto,
>
> start_time=None,
>
> streamer=None,
>
> metadata=None,
>
> ):
>
> buffer_samps = streamer.get_max_num_samps()
>
> proto_len = waveform_proto.shape[-1]
>
> send_samps = 0
>
> if len(waveform_proto.shape) == 1:
>
> waveform_proto = waveform_proto.reshape(1, waveform_proto.size)
>
> # Now stream
>
> print(usrp_tx.get_time_now().get_real_secs())
>
> if metadata is None:
>
> metadata = uhd.types.TXMetadata()
>
> if start_time is not None:
>
> metadata.time_spec = start_time
>
> metadata.has_time_spec = True
>
> while send_samps < proto_len:
>
> real_samps = min(proto_len - send_samps, buffer_samps)
>
> samples = streamer.send(waveform_proto[:,
> send_samps:send_samps+real_samps], metadata)
>
> send_samps += samples
>
> # Send EOB to terminate Tx
>
> metadata.end_of_burst = True
>
> # streamer.send(np.zeros((1, 1), dtype=np.complex64), metadata)
>
> return send_samps
>
> tx_signals = np.ones([500, 1]).reshape(num_channels, -1)
>
> md_tx = uhd.types.TXMetadata()
>
> while True:
>
> md_tx.start_of_burst = True
>
> send_samples = my_send(tx_signal, streamer=tx_streamer, metadata=md_tx)
>
> When I looked into the send_wave() I found these lines:
>
> # Send EOB to terminate Tx
> metadata.end_of_burst = True
> streamer.send(np.zeros((1, 1), dtype=np.complex64), metadata)
>
> Moreover, it seems there are no mentions of start_of_burst. If I delete
> these lines, spikes are removed but the received signal looks very strange,
> which is shown in fig.3.
>
> These facts made me confused at the functions of start_of_burst and
> end_of_burst. Moreover, why should the streamer send a zero after
> end_of_burst?
> _______________________________________________
> 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

Reply via email to