g0orx / linhpsdr

Linux HPSDR
GNU General Public License v3.0
74 stars 44 forks source link

SoapySDR: (1) allow user to manually enter raw sampling rate, bandwidth and decimation factor in the RX-X menu. (2) Detect networked devices not only USB ones #41

Open satfan52 opened 4 years ago

satfan52 commented 4 years ago

Hello,

Everything is in the title.

1) Unfortunately the sampling rates available in the RX-0 menu do not allow me to use my PlutoSDR with linhpsdr. Reception is impossible as audio is terrible, sometimes there are even some awful audio oscillations. By default the sampling rate is set to 48 Khz (KSA) but changing it to any of the other values currently offered in the RX-0 menu does not improve the situation. See the critical error message below, linhpsdr complains it is unable to set the BB Rate. Out of experience with SDRANGEL, I know for that a sampling rate of 2 and 2.5 MSA gives good results with my plutosdr but it can not be entered in the RX-0 menu as the max sampling rate supported is 1.5 MSA. For any soapysdr devices, as a matter of principle, it should be possible to manually enter the sampling rate and the bandwidth in the RX-x menu. There are just too many devices supported to figure out all use cases so better let the user enter manually his parameters

2) I sometimes use an Ethernet adapter with my PlutoSDR but linhpsdr is unable to detect it over my network despite the fact that my Pluto and my PC are on the same subnet. My Pluto is only detected by linhpsdr if connected to my PC over USB. So because some SoapySDR devices can be networked but not detected by linhpsdr automatically, it should also be possible, as a backup, one way or another to specify somewhere a hostname (or IP address) and a port number to force the detection of such SoapySDR networked device (this is how it is implemented in SdrAngel ).

soapy_discovery soapy_discovery: get_info: plutosdr DriverKey=PlutoSDR HardwareKey=ADALM-PLUTO soapy_discovery: hardware info key=ad9361-phy,model val=ad9364 soapy_discovery: hardware info key=ad9361-phy,xo_correction val=39999835 soapy_discovery: hardware info key=backend_version val=0.18 (git tag: v0.18 ) soapy_discovery: hardware info key=fw_version val=v0.31 soapy_discovery: hardware info key=hw_model val=Analog Devices PlutoSDR Rev.B (Z7010-AD9364) soapy_discovery: hardware info key=hw_model_variant val=1 soapy_discovery: hardware info key=hw_serial val=104400b8399100140b0027004b28656d80 soapy_discovery: hardware info key=library_version val=0.18 (git tag: c0012d0) soapy_discovery: hardware info key=local,kernel val=4.14.0-42540-g387d584 soapy_discovery: hardware info key=usb,idProduct val=b673 soapy_discovery: hardware info key=usb,idVendor val=0456 soapy_discovery: hardware info key=usb,libusb val=1.0.21.11156 soapy_discovery: hardware info key=usb,product val=PlutoSDR (ADALM-PLUTO) soapy_discovery: hardware info key=usb,release val=2.0 soapy_discovery: hardware info key=usb,serial val=104400b8399100140b0027004b28656d80 soapy_discovery: hardware info key=usb,vendor val=Analog Devices Inc. Rx channels: 1 Rx channel full duplex: channel=0 fullduplex=1 Tx channels: 1 Tx channel full duplex: channel=0 fullduplex=1 Rx sample rates: 65105.000000 -> 65105.000000 (1.356354),1000000.000000 -> 1000000.000000 (20.833333),2000000.000000 -> 2000000.000000 (41.666667),3000000.000000 -> 3000000.000000 (62.500000),4000000.000000 -> 4000000.000000 (83.333333),5000000.000000 -> 5000000.000000 (104.166667),6000000.000000 -> 6000000.000000 (125.000000),7000000.000000 -> 7000000.000000 (145.833333),8000000.000000 -> 8000000.000000 (166.666667),9000000.000000 -> 9000000.000000 (187.500000),10000000.000000 -> 10000000.000000 (208.333333), sample_rate selected 6000000 Tx sample rates: 65105.000000 -> 65105.000000 (1.356354),1000000.000000 -> 1000000.000000 (20.833333),2000000.000000 -> 2000000.000000 (41.666667),3000000.000000 -> 3000000.000000 (62.500000),4000000.000000 -> 4000000.000000 (83.333333),5000000.000000 -> 5000000.000000 (104.166667),6000000.000000 -> 6000000.000000 (125.000000),7000000.000000 -> 7000000.000000 (145.833333),8000000.000000 -> 8000000.000000 (166.666667),9000000.000000 -> 9000000.000000 (187.500000),10000000.000000 -> 10000000.000000 (208.333333), Rx bandwidths: 200000.000000, 1000000.000000, 2000000.000000, 3000000.000000, 4000000.000000, 5000000.000000, 6000000.000000, 7000000.000000, 8000000.000000, 9000000.000000, 10000000.000000, Tx bandwidths: 200000.000000, 1000000.000000, 2000000.000000, 3000000.000000, 4000000.000000, 5000000.000000, 6000000.000000, 7000000.000000, 8000000.000000, 9000000.000000, 10000000.000000, RX0: bandwidth=1000000.000000 TX0: bandwidth=18000000.000000 Rx freq ranges: [70000000.000000 Hz -> 6000000000.000000 Hz step=0.000000], Rx antennas: A_BALANCED, Tx antennas: A, has_automaic_gain=1 has_automaic_dc_offset_correction=1 Rx formats: CS8, CS12, CS16, CF32, float=4 double=8 Rx gains: PGA 0.000000 -> 73.000000 step=0.000000 Tx gains: PGA 0.000000 -> 89.000000 step=0.000000 main: discovery found 1 devices discovered: 0 device=7 adding plutosdr tree_selection_changed_cb tree_selection_changed_cb: selected=plutosdr,SoapySDR,0.0.0,, tree_selection_changed_cb: first=plutosdr,SoapySDR,0.0.0,, found 0 starting Linux HPSDR (Beta): plutosdr SoapySDR v0.0.0 () on USB create_radio for plutosdr 7 loadProperties: /home/peter/.local/share/linhpsdr/plutosdr.props soapy_protocol_init soapy_protocol_init: SoapySDRDevice_make audio: create_audio: USE_PULSEAUDIO create_receiver: channel=0 sample_rate=6000000 create_receiver: channel=0 frequency_min=70000000 frequency_max=6000000000 create_receiver: buffer_size=1024 create_receiver: fft_size=2048 create_receiver: OpenChannel: channel=0 buffer_size=1024 sample_rate=48000 fft_size=2048 output_samples=1024 receiver_change_sample_rate: resample_step=125 soapy_protocol_set_rx_frequency: 144996600.000000 receiver_init_analyzer: channel=0 zoom=1 pixels=0 pixel_samples=(nil) receiver_update_title: Linux HPSDR: Rx-0 ADC-0 48000 create_vfo: rx=0 rx_panadapter_configure_event_cb receiver_configure_event: gtk_paned_set_position: rx=0 position=59 height=120 percent=0.499481 audio_open_output: alsa_output.pci-0000_00_14.2.analog-stereo audio_open_output: allocated local_audio_buffer 0x55a9e4b24050 size 8192 bytes soapy_protocol_create: setting samplerate=48000.000000 [CRITICAL] sample rate is not supported. [ERROR] Unable to set BB rate. soapy_protocol_create_receiver: SoapySDRDevice_setupStream: channel=0 [INFO] Using format CF32. [INFO] Auto setting Buffer Size: 8192 [INFO] Set MTU Size: 8192 create_transmitter: channel=8 transmitter_init_analyzer: width=0 pixels=0 update_timer: fps=10 soapy_protocol_create_transmitter: setting samplerate=48000.000000 [CRITICAL] sample rate is not supported. [ERROR] Unable to set BB rate. soapy_protocol_create_transmitter: SoapySDRDevice_setupStream: channel=0 [INFO] Using format CF32. [INFO] Has direct TX copy: 1 soapy_protocol_create_transmitter: max_tx_samples=0 soapy_protocol: set_rx_antenna: A_BALANCED soapy_protocol_set_rx_frequency: 144996600.000000 soapy_protocol_start_receiver: activate_stream [INFO] Has direct RX copy: 1 soapy_protocol_start_receiver: create receive_thread receive_thread: id=0x55a9e23fcad0 soapy_protocol: set_tx_antenna: (null) soapy_protocol: receive_thread soapy_protocol: SoapySDRDevice_setAntenna TX failed: TIMEOUT Server listening on port 50000 x=83 y=61 moving main_window to x=83 y=61 audio: state_cb: PA_CONTEXT_AUTHORIZING rx_panadapter: resize_timeout receiver_init_analyzer: channel=0 zoom=1 pixels=1015 pixel_samples=(nil) receiver_init_analyzer: g_new0: channel=0 pixel_samples=0x55a9e70f5000 SetAnalyzer id=0 buffer_size=1024 fft_size=8192 overlap=2048 audio: state_cb: PA_CONTEXT_SETTING_NAME audio: state_cb: PA_CONTEXT_READY Output: 0: alsa_output.pci-0000_00_01.1.hdmi-surround (Built-in Audio Digital Surround 5.1 (HDMI)) Output: 1: alsa_output.pci-0000_00_14.2.analog-stereo (Built-in Audio Analog Stereo) Output: 2: QuiskDigitalInput (QuiskDigitalInput) Output: 3: QuiskDigitalOutput (QuiskDigitalOutput) Input: 0: alsa_output.pci-0000_00_01.1.hdmi-surround.monitor (Monitor of Built-in Audio Digital Surround 5.1 (HDMI)) Input: 1: alsa_output.pci-0000_00_14.2.analog-stereo.monitor (Monitor of Built-in Audio Analog Stereo) Input: 2: alsa_input.pci-0000_00_14.2.analog-stereo (Built-in Audio Analog Stereo) Input: 3: QuiskDigitalInput.monitor (Monitor of QuiskDigitalInput) Input: 4: QuiskDigitalOutput.monitor (Monitor of QuiskDigitalOutput) radio_start tx_panadapter_configure_event: width=300 height=165 transmitter_init_analyzer: width=300 pixels=3600 SetAnalyzer id=8 buffer_size=1024 overlap=3392 rx_panadapter_configure_event_cb rx_panadapter: resize_timeout receiver_init_analyzer: channel=0 zoom=1 pixels=1837 pixel_samples=0x55a9e70f5000 receiver_init_analyzer: g_new0: channel=0 pixel_samples=0x55a9e24b9400 SetAnalyzer id=0 buffer_size=1024 fft_size=8192 overlap=2048

satfan52 commented 4 years ago

ok the problem for the plutosdr is that the minimum raw sampling rate (before dedcimation/interpolation) is 2084k for for TX and for RX. Then it can be decimated/interpolated by 1,2,4,8,16,32,64.

So if a soapysdr device is detected, instead of offering sampling rate values of 48, 96, 192, 384 Khz up to 1,536 MSP better let the user enter manually a raw sampling rate (ie, min 2.084 MSP for the pluto) AND a decimation factor (1,2,4,8,16,32,64). Same story for the TX signal, add a box for the TX sampling rate (min 2.084 MSP for the pluto) and a box for the interpolation factor (1,2,4,8,16,32,64)

g0orx commented 4 years ago

I am hoping to get a Pluto SDR in the next couple of weeks. I can spend some time looking at it then. -- John

satfan52 commented 4 years ago

Many Thanks John, actually there is also the decimation factor to be entered manually (values 1,2,4,8,16,32,64) So 3 parameters to be entered

Note: The TX part of the soapyplutosdr module was recently fixed and now works https://github.com/pothosware/SoapyPlutoSDR/issues/32

dj1an commented 3 years ago

Is there any Progress on this issue? Tried using Plutosdr with linhpsdr and soapy today. Noticed linhpsdr picks a way too high Samplerate for RX and TX, saturating the ethernet or usb Connection:

sample_rate selected 6000000

Manual selection of samplerate / decimation as proposed should do the trick.

g0orx commented 3 years ago

Not currently. I am too busy with other projects. The message "sample_rate selected 6000000" is not the sample rate it is actually running at. It is currently set to 768000. I do not find this is saturating the USB or the Network and is working with no problems for QO-100 at my location. I will look at manual selection as soon as I have time.

linhpsdr

dj1an commented 3 years ago

Then there seems to be an error on my side. Maybe Soapy Lib? I watched Network throughput at different Samplingrates and got about 6 Mbyte/s at 768k and 9 Mbyte/s at 48k. In Tx Mode i can see an increase of 2 Mbyte/s at 768k and no change at 48k. All other Sampling Rates are in between this values. So it might not be a saturated link, but it seems, that the selected Samplerate of 6MS/s is being actually transferred over the network. If there is anything i can do to help debug this issue, let me know

satfan52 commented 3 years ago

John, I was able to receive correctly with my plutosdr with a samping frequency of 768000. The problem is that it only worked ONCE. After I restarted the application the audio became choppy (as if there was not enough bandwidth, but there is plenty!) and despite all my efforts (I even recompiled a fresh version) I could not make it work again. I also looked for cached files to try to clear them, the only one I found is in the .local/share/linhpsdr directory and clearing it did not help.

Also TX does not work at ALL with my pluto and linhpsdr.

Can you share with us the exact TX and RX parameters that you use with your pluto (other than the sampling rate of 768000) ? as well as what are the relevant cache files to clean when we get into trouble ? I am using Ubuntu 18.04 LTS and I have no errors when I compile your software

Thanks Regards Peter

Note: I am able to receive and transmit fine with pluto, soapysdr, the SoapyPlutoSDR module and sdrangel, so I am 100% confident that my SoapySDR installation is OK.

satfan52 commented 3 years ago

Crashes to on some ocassions when trying to set the sampling rate to 768000

receiver_change_sample_rate: from 6000000 to 768000 radio=6000000 Segmentation fault (core dumped)

I am sorry but in my environment, Ubuntu 18.04 LTS, using linhpsdr with SoapySDR and plutosdr is just not feasible for sustained operation. Linhpsdr crashes all the time and audio is choppy 90% of the time (I use Pulseaudio). Linhpsdr works ok with my redpitaya (metis/hpsdr) in both TX and RX modes but with soapysdr and pluto we are not there yet very very unfortunately.