Use this file to discover all available pages before exploring further.
Streaming in UHD refers to moving IQ sample data between the host computer and the USRP device. Two objects handle this: uhd::rx_streamer carries samples from the device to the host, and uhd::tx_streamer carries samples from the host to the device. Both are created from a uhd::stream_args_t object that specifies data formats and channel mapping, and both expose a simple blocking API — recv() and send() — for the actual data transfer.
Before creating either streamer type, you must configure a uhd::stream_args_t. The two most important fields are cpu_format (the sample type in host memory) and otw_format (the sample type over the link layer).
// Create stream args: fc32 in host memory, sc16 over the wireuhd::stream_args_t stream_args("fc32", "sc16");// Optional: set samples per packet (reduces latency)stream_args.args["spp"] = std::to_string(200);// Optional: specify channels (defaults to channel 0)stream_args.channels = {0, 1}; // two-channel stream
while (keep_running) { // fill buff with your signal here size_t num_tx_samps = tx_stream->send( &buff.front(), buff.size(), md, 3.0 /*timeout s*/); md.start_of_burst = false; // only first packet is SOB}
What it is: The device is producing samples faster than recv() is consuming them. Buffers back up.What UHD does: Prints "O" (or "D") to stdout and sets ERROR_CODE_OVERFLOW in the RX metadata.Recovery: In continuous streaming mode the device resets itself once the FIFO clears — just keep calling recv(). In finite/triggered modes you may need to re-issue a stream command.
Underflow (TX)
What it is: The device is consuming samples faster than send() is supplying them.What UHD does: Prints "U" to stdout and pushes a message into the async message stream.Recovery: Call send() more frequently, or use the streamer=replay_buffered stream arg to buffer data in FPGA DRAM via the Replay block (requires RFNoC-capable device with Replay block in the FPGA image).
"O" and "U" prints are generally harmless informational messages indicating the host cannot sustain the requested rate. They do not by themselves indicate a fatal error.
recv() and send() are not thread-safe on a single streamer instance. Do not call recv() from two threads concurrently on the same rx_streamer, or send() from two threads on the same tx_streamer. Multiple different streamers may be called from separate threads simultaneously.
All three fast-path methods — tx_streamer::send(), rx_streamer::recv(), and tx_streamer::recv_async_msg() — can safely coexist in different threads.