The concept of streaming refers to the transportation of samples or other data between host and device. A streamer is an object that facilitates such streaming. An RX streamer (uhd::rx_streamer) allows the user to receive data from the device. A TX streamer (uhd::tx_streamer) allows the user to transmit data to the device.
For RX streaming, the following actions need to be taken:
In Python, the steps could look like this:
For TX streaming, the following actions need to be taken:
In Python, the steps could look like this:
For more details on configuring streamers, cf. Streaming Arguments (Stream Args).
For more details on overruns/underruns, cf. Overflow/Underflow Notes.
Between the host and the device, data (such as I/Q samples) are packetized and encapsulated. Refer to Radio Transport Protocols for more details on the protocols used.
The length of an IF data packet can be limited by several factors:
There are two important data types to consider when streaming. They are referred to as arguments in the uhd::stream_args_t object:
cpu argument)otw argument)The host data type refers to the format of samples used in the host for baseband processing. Typically, the data type is complex baseband such as normalized complex-float32 or complex-int16.
The link-layer or "over-the-wire" data type refers to the format of the samples sent through the link. Typically, this data type is complex-int16. However, to increase throughput over the link-layer, at the expense of precision, complex-int8 may be used.
The user may request arbitrary combinations of host and link data types; however, not all combinations are supported. The user may register custom data type formats and conversion routines. See convert.hpp and Converters for further documentation.
Ethernet-based devices allow sending data to an alternative destination instead of back to the controlling UHD session.
Starting with UHD 4.4, these devices allow streaming data to alternative locations from their QSFP/SFP connectors (streaming data to alternative locations from the RJ45 connector is not possible).
To enable remote streaming, create a regular RX streamer. This will work as a proxy for UHD, and an object that will accept stream commands.
Consider the following example: A UHD host controller is running on a computer with IP address 192.168.40.1. It is opening a session with a USRP with IP address 192.168.40.2. It configures the USRP, sets the desired frequency and gain, and any other settings that might be required. Then, it initiates a data stream from the USRP to another computer with IP address 192.168.40.5.
The sequence of events to enable this feature is illustrated with the following Python snippet:
The ability to call recv() without a fatal error condition allows using this API with some preexisting applications.
The streamer objects accepts the following arguments:
dest_addr, dest_port: The remote destination IP address and port. Both must be provided.dest_mac_addr: If provided, this value is used as a MAC address. Must be in AA:BB:CC:DD:EE:FF format. If not provided, the device uses ARP to identify the MAC address based on the IP address. When given, there are no further checks that the IP address matches the MAC address.adapter: The adapter that is used to stream data out of. The adapter names match the interface names as listed on the command line (e.g., sfp0, sfp1). This allows connecting to one interface and streaming out of another. It also allows running UHD on the device itself (for MPM devices, i.e., X4xx, E3xx, N3xx series) and streaming to a remote destination at a high rate. Note that for X3x0, the available adapter names are hardcoded as sfp0 and sfp1, respectively.stream_mode: This key allows two options: raw_payload (the default) and full_packet. When full_packet is selected, the full CHDR packet is streamed and the remote destination needs to dissect or remove the header. With raw_payload, only the data is sent as a UDP packet (e.g., only IQ samples). See Radio Transport Protocols for more details on CHDR.enable_fc: Either "0" (default) or "1". Set to "1" to enable flow control. In that case, stream_mode must also be set to full_packet in order to be able to handle flow control responses. See the following section for more information.mtu: This is not specific to remote streaming, but it is useful because for remote streaming, UHD is unable to do automatic MTU detection. Note that this argument is independent of the underlying link type (regular UDP, DPDK, ...) and will always be respected by RFNoC, but if it is incorrectly chosen, it may cause packet fragmentation and data loss.By default, the USRP will stream data to the remote streaming destination at whatever data rate it is set to, and there are no checks to ensure the destination can keep up. This is different from streaming to UHD, where flow control is used to match rates between device and host computer.
If flow control is desired, then using enable_fc=1 as a stream argument will enable flow control. However, the remote destination must now unpack the data packets and send flow control responses to the USRP in order for it to keep streaming. Refer to the RFNoC specification for how to format flow control response packets.
The following limitations apply when using remote streaming:
The N200 Series of USRPs supports alternative stream destinations starting with UHD 3.5.
The sequence to activate remote destination streaming is identical to that in Section RFNoC Devices (X440, X410, X3x0, N3xx Series, E320), with the following differences:
addr and port arguments are supported.