Streamers are the host-side objects that move IQ samples between your application and USRP hardware. AnDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/EttusResearch/uhd/llms.txt
Use this file to discover all available pages before exploring further.
rx_streamer receives samples from the device into host memory; a tx_streamer sends samples from host memory to the device. Both are created by calling get_rx_stream() / get_tx_stream() on a multi_usrp (or rfnoc_graph) object, and neither is thread-safe — only one thread should call recv() or send() on a given streamer at a time.
stream_args_t
stream_args_t is passed to get_rx_stream() or get_tx_stream() to specify the data formats and channel mapping.
Format of samples in host memory. See the table below for supported values.
Over-the-wire (transport) format used between the host and device. Using a narrower format reduces link bandwidth at the cost of dynamic range.
Optional key/value arguments. Notable keys:
"spp"— samples per packet (reduces packet size and latency)."fullscale"— full-scale amplitude for floating-point formats (default1.0)."peak"— fractional peak level used for sc8 wire-format scaling."underflow_policy"— TX behavior on underflow:"next_burst"or"next_packet".
List of channel indices to include in this streamer. Default is
{0}. For multi-channel streaming, list all channels in the desired order.CPU Format Values
| Value | C++ Type | Description |
|---|---|---|
"fc64" | std::complex<double> | 64-bit float complex (128 bits/sample) |
"fc32" | std::complex<float> | 32-bit float complex (64 bits/sample) — most common |
"sc16" | std::complex<int16_t> | 16-bit signed integer complex (32 bits/sample) |
"sc8" | std::complex<int8_t> | 8-bit signed integer complex (16 bits/sample) |
OTW Format Values
| Value | Wire Encoding | Notes |
|---|---|---|
"sc16" | Q16 I16 | Default; full dynamic range |
"sc8" | Q8 I8 (packed pairs) | Halves link bandwidth, allows higher sample rates on bandwidth-limited links |
"sc12" | 12-bit packed | Only supported on select devices |
rx_streamer
Therx_streamer class provides the host interface for receiving samples.
recv()
A
ref_vector<void*> containing one pointer per channel. Each pointer must address a writable buffer of at least nsamps_per_buff samples. For single-channel use: rx_stream->recv(&buf.front(), ...).Maximum number of samples to write into each channel buffer. Passing
0 is valid for metadata-only retrieval.Output parameter filled with timing and error information. Always check
metadata.error_code after the call.Timeout in seconds applied per internal sub-call within
recv(). The total blocking time may exceed this value for multi-packet operations.When
true, return immediately after a single packet is processed regardless of buffer size.nsamps_per_buff.
issue_stream_cmd()
recv() will return data. See stream_cmd_t below.
get_num_channels() / get_max_num_samps()
tx_streamer
Thetx_streamer class provides the host interface for transmitting samples.
send()
A
ref_vector<const void*> containing one pointer per channel. Each pointer must address a readable buffer of at least nsamps_per_buff samples.Number of samples to transmit from each channel buffer.
Timing and burst flag information. Set
start_of_burst = true on the first call and end_of_burst = true on the last call of a burst sequence.Timeout in seconds. If the device cannot accept samples within the timeout, fewer samples than requested may be returned.
recv_async_msg()
true when a valid message is available; false on timeout.
stream_cmd_t
A stream command controls when and how the device delivers samples to the host.One of the four modes above.
Number of samples to acquire. Only used with
STREAM_MODE_NUM_SAMPS_AND_DONE and STREAM_MODE_NUM_SAMPS_AND_MORE.When
true, start streaming immediately (ASAP). When false, start at time_spec.Time at which to begin streaming when
stream_now = false and trigger = TIMED. Must be in the future.Trigger source when
stream_now = false. TIMED starts streaming when time_spec is reached; TX_RUNNING starts streaming when the transmitter is active.rx_metadata_t
Returned byrx_streamer::recv() on every call.
true when time_spec contains the timestamp of the first sample in the buffer.Timestamp of the first sample returned. Valid when
has_time_spec is true.true when the current packet was too large to fit in the buffer. Subsequent recv() calls will continue from where this one left off.Sample count at the start of the buffer relative to the beginning of the fragmented packet.
true when the last sample in the buffer is the end of a burst.Error status. Check this on every
recv() call.When
error_code == ERROR_CODE_OVERFLOW, this flag distinguishes a hardware overflow (false) from a dropped transport packet (true).RX Error Codes
| Code | Value | Description |
|---|---|---|
ERROR_CODE_NONE | 0x0 | No error |
ERROR_CODE_TIMEOUT | 0x1 | No packet received within the timeout |
ERROR_CODE_LATE_COMMAND | 0x2 | A stream command was issued in the past |
ERROR_CODE_BROKEN_CHAIN | 0x4 | An expected follow-on stream command was not received |
ERROR_CODE_OVERFLOW | 0x8 | Hardware FIFO overflowed or a packet was dropped |
ERROR_CODE_ALIGNMENT | 0xc | Multi-channel time alignment failed |
ERROR_CODE_BAD_PACKET | 0xf | Received packet could not be parsed |
tx_metadata_t
Passed totx_streamer::send() on every call.
When
false, transmit immediately. When true, hold samples until time_spec is reached.Absolute time at which the first sample should be transmitted. Requires
has_time_spec = true.Set
true on the first send() call of a burst sequence.Set
true on the last send() call of a burst sequence. Causes the device to flush remaining samples and mark end-of-burst in the RF output.async_metadata_t
Returned bytx_streamer::recv_async_msg() to report asynchronous TX events.
TX Async Event Codes
| Code | Value | Description |
|---|---|---|
EVENT_CODE_OK | 0x0 | Status report with no error |
EVENT_CODE_BURST_ACK | 0x1 | Burst transmitted successfully |
EVENT_CODE_UNDERFLOW | 0x2 | TX buffer underflowed between packets |
EVENT_CODE_SEQ_ERROR | 0x4 | Packet loss between host and device |
EVENT_CODE_TIME_ERROR | 0x8 | Packet arrived late (time was in the past) |
EVENT_CODE_UNDERFLOW_IN_PACKET | 0x10 | Underflow occurred mid-packet |
EVENT_CODE_SEQ_ERROR_IN_BURST | 0x20 | Packet lost within a burst |
EVENT_CODE_USER_PAYLOAD | 0x40 | Custom payload from user-defined FPGA fabric |
