pothosware / SoapyUHD

Soapy SDR plugins for UHD supported SDR devices
https://github.com/pothosware/SoapyUHD/wiki
GNU General Public License v3.0
55 stars 29 forks source link

Multiple RX channels issue #46

Open GVardakis opened 3 years ago

GVardakis commented 3 years ago

Issue Description

UHD module fails when using two RX channels on USRP B210 with message Invalid recv stream command - stream now on multiple channels in a single streamer will fail to time align.

Setup Details

USRP B210, openSUSE Tumbleweed, SoapySDR v0.8, SoapyUHD v0.4.1-9a738c3

Steps to reproduce

SoapySDRUtil --args="driver=uhd" --rate=1e6 --channels="0, 1" --direction=RX

The above command instead of performing the expected rate test fails with the message mentioned in the description

Comments

This problem seems to originate inside the activateStream function in SoapyUHDDevice.cpp. The stream_now variable should not be set to True when more than one channels have been requested, but this is not handled in the code. Instead, the stream_now should be set to False and the time_spec to a time offset with respect to the current time, so that reception begins in a later time. The fix below seems to solve the issue of the rate test but probably needs more testing,

cmd.stream_now = (flags & SOAPY_SDR_HAS_TIME) == 0 && (stream->rx.get()->get_num_channels() == 1);

cmd.time_spec = _dev->get_time_now() + uhd::time_spec_t(0.1);

alphafox02 commented 2 years ago

Applying this change allowed the rate test to work using both channels on an X310 w/ one Twin Rx card inserted.