From 97cb51d990b4929211ffe5463e25c117cf81f418 Mon Sep 17 00:00:00 2001 From: Andrea Montefusco Date: Sun, 15 Mar 2020 17:24:36 +0100 Subject: [PATCH 1/4] Perseus SDR HF receiver first support --- config_webrx.py | 53 ++++++++++++++++++++++++++++++++++++++- owrx/feature.py | 21 ++++++++++++++++ owrx/source/perseussdr.py | 31 +++++++++++++++++++++++ 3 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 owrx/source/perseussdr.py diff --git a/config_webrx.py b/config_webrx.py index a568481..5ef9866 100644 --- a/config_webrx.py +++ b/config_webrx.py @@ -99,7 +99,7 @@ Note: if you experience audio underruns while CPU usage is 100%, you can: ################################################################################################# # Currently supported types of sdr receivers: -# "rtl_sdr", "sdrplay", "hackrf", "airspy", "airspyhf", "fifi_sdr" +# "rtl_sdr", "sdrplay", "hackrf", "airspy", "airspyhf", "fifi_sdr", "perseussdr" # # In order to use rtl_sdr, you will need to install librtlsdr-dev and the connector. # In order to use sdrplay, airspy or airspyhf, you will need to install soapysdr, the corresponding driver, and the @@ -107,6 +107,10 @@ Note: if you experience audio underruns while CPU usage is 100%, you can: # # https://github.com/jketterl/owrx_connector # +# In order to use Perseus HF you need to install the libperseus-sdr +# +# https://github.com/Microtelecom/libperseus-sdr +# # NOTE: The connector sources have replaced the old piped nmux style of reading input. If you still have any sdrs # configured that have type endin in "_connector", simply remove that suffix. @@ -137,6 +141,53 @@ sdrs = { }, }, }, + "perseussdr": { + "name": "Microtelecom Perseus HF receiver", + "type": "perseussdr", + "ppm": 0, + "profiles": { + "40m": { + "name": "40m", + "center_freq": 7150000, + "rf_gain": 0, + "samp_rate": 500000, + "start_freq": 7050000, + "start_mod": "lsb", + }, + "20m": { + "name": "20m", + "center_freq": 14150000, + "rf_gain": 0, + "samp_rate": 500000, + "start_freq": 14070000, + "start_mod": "usb", + }, + "30m": { + "name": "30m", + "center_freq": 10125000, + "rf_gain": 0, + "samp_rate": 192000, + "start_freq": 10142000, + "start_mod": "usb", + }, + "80m": { + "name": "80m", + "center_freq": 3650000, + "rf_gain": 0, + "samp_rate": 500000, + "start_freq": 3570000, + "start_mod": "usb", + }, + "49m": { + "name": "49m Broadcast", + "center_freq": 6000000, + "rf_gain": 0, + "samp_rate": 500000, + "start_freq": 6070000, + "start_mod": "am", + }, + }, + }, "airspy": { "name": "Airspy HF+", "type": "airspyhf", diff --git a/owrx/feature.py b/owrx/feature.py index 7e7bf9c..e18aae9 100644 --- a/owrx/feature.py +++ b/owrx/feature.py @@ -25,6 +25,7 @@ class FeatureDetector(object): "rtl_sdr_soapy": ["soapy_connector", "soapy_rtl_sdr"], "sdrplay": ["soapy_connector", "soapy_sdrplay"], "hackrf": ["hackrf_transfer"], + "perseussdr": ["perseustest"], "airspy": ["soapy_connector", "soapy_airspy"], "airspyhf": ["soapy_connector", "soapy_airspyhf"], "lime_sdr": ["soapy_connector", "soapy_lime_sdr"], @@ -150,6 +151,26 @@ class FeatureDetector(object): # TODO also check if it has the stdout feature return self.command_is_runnable("hackrf_transfer --help") + def has_perseustest(self): + """ + To use a Microtelecom Perseus HF receiver, compile and + install the libperseus-sdr: + ``` + sudo apt install libusb-1.0-0-dev + cd /tmp + wget https://github.com/Microtelecom/libperseus-sdr/releases/download/v0.7.5/libperseus_sdr-0.7.5.tar.gz + tar -zxvf libperseus_sdr-0.7.5.tar.gz + cd libperseus_sdr-0.7.5/ + ./configure + make + sudo make install + sudo ldconfig + perseustest + ``` + """ + return self.command_is_runnable("perseustest -d -1 -a -t 1") + + def has_digiham(self): """ To use digital voice modes, the digiham package is required. You can find the package and installation diff --git a/owrx/source/perseussdr.py b/owrx/source/perseussdr.py new file mode 100644 index 0000000..29c382a --- /dev/null +++ b/owrx/source/perseussdr.py @@ -0,0 +1,31 @@ +from .direct import DirectSource +from owrx.command import Flag, Option + + +# +# perseustest -s 768000 -u 0 -f 14150000 -r-|csdr convert_s8_f|nmux --bufsize 192512 --bufcnt 260 --port 35989 --address 127.0.0.1 +# perseustest -a -t0 -o - +# perseustest -d 9 -a -t 100000 -o - -s 768000 -u 0 -f 14150000 -r- + +class PerseussdrSource(DirectSource): + def getCommandMapper(self): + return super().getCommandMapper().setBase("perseustest -p -d -1 -a -t 100000 -o - ").setMappings( + { + "samp_rate": Option("-s"), + "tuner_freq": Option("-f"), + "rf_gain": Option("-u"), + "lna_gain": Option("-g"), + "rf_amp": Option("-x"), + } + ).setStatic("-r-") + + def getEventNames(self): + return super().getEventNames() + [ + "lna_gain", + "rf_amp", + ] + + def getFormatConversion(self): +# return ["csdr convert_s24_f --bigendian"] +# return ["csdr convert_s24_f", "csdr gain_ff 20"] + return ["csdr gain_ff 20"] From 68e8a77b1d279eca90fd9e2b76deb24b4b8a62a6 Mon Sep 17 00:00:00 2001 From: Andrea Montefusco Date: Mon, 16 Mar 2020 00:13:51 +0100 Subject: [PATCH 2/4] more refinements as per Jakob Ketterl suggestions --- owrx/feature.py | 8 ++++---- owrx/source/perseussdr.py | 38 +++++++++++++++++++++++--------------- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/owrx/feature.py b/owrx/feature.py index e18aae9..f873847 100644 --- a/owrx/feature.py +++ b/owrx/feature.py @@ -158,9 +158,9 @@ class FeatureDetector(object): ``` sudo apt install libusb-1.0-0-dev cd /tmp - wget https://github.com/Microtelecom/libperseus-sdr/releases/download/v0.7.5/libperseus_sdr-0.7.5.tar.gz - tar -zxvf libperseus_sdr-0.7.5.tar.gz - cd libperseus_sdr-0.7.5/ + wget https://github.com/Microtelecom/libperseus-sdr/releases/download/v0.8.2/libperseus_sdr-0.8.2.tar.gz + tar -zxvf libperseus_sdr-0.8.2.tar.gz + cd libperseus_sdr-0.8.2/ ./configure make sudo make install @@ -168,7 +168,7 @@ class FeatureDetector(object): perseustest ``` """ - return self.command_is_runnable("perseustest -d -1 -a -t 1") + return self.command_is_runnable("perseustest -h") def has_digiham(self): diff --git a/owrx/source/perseussdr.py b/owrx/source/perseussdr.py index 29c382a..890600b 100644 --- a/owrx/source/perseussdr.py +++ b/owrx/source/perseussdr.py @@ -3,29 +3,37 @@ from owrx.command import Flag, Option # -# perseustest -s 768000 -u 0 -f 14150000 -r-|csdr convert_s8_f|nmux --bufsize 192512 --bufcnt 260 --port 35989 --address 127.0.0.1 -# perseustest -a -t0 -o - -# perseustest -d 9 -a -t 100000 -o - -s 768000 -u 0 -f 14150000 -r- +# In order to interface Perseus hardware, we resolve to use the +# perseustest utility that comes with libperseus-sdr support package. +# Below the base options used are shown: +# +# -p output I/Q samples as 32 bits floating point +# -d -1 suppress debug messages +# -a don't test attenuators on startup +# -t 0 runs indefinitely +# -o - output samples on stdout +# +# As we are already returning I/Q samples as pairs of 32 bits +# floating points (option -p),no need for further conversions, +# so the method getFormatConversion(self) is not implemented at all. class PerseussdrSource(DirectSource): def getCommandMapper(self): - return super().getCommandMapper().setBase("perseustest -p -d -1 -a -t 100000 -o - ").setMappings( + return super().getCommandMapper().setBase("perseustest -p -d -1 -a -t 0 -o - ").setMappings( { "samp_rate": Option("-s"), "tuner_freq": Option("-f"), - "rf_gain": Option("-u"), - "lna_gain": Option("-g"), - "rf_amp": Option("-x"), + "attenuator": Option("-u"), + "adc_preamp": Option("-m"), + "adc_dither": Option("-x"), + "wideband": Option("-w"), } - ).setStatic("-r-") + ) def getEventNames(self): return super().getEventNames() + [ - "lna_gain", - "rf_amp", + "attenuator", + "adc_preamp", + "adc_dither", + "wideband", ] - - def getFormatConversion(self): -# return ["csdr convert_s24_f --bigendian"] -# return ["csdr convert_s24_f", "csdr gain_ff 20"] - return ["csdr gain_ff 20"] From 34ee5d8e3bfc9785906fdd0aced2fcae26bf20a3 Mon Sep 17 00:00:00 2001 From: Andrea Montefusco Date: Mon, 16 Mar 2020 00:21:49 +0100 Subject: [PATCH 3/4] More info on Perseus integration. --- config_webrx.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config_webrx.py b/config_webrx.py index 5ef9866..d564276 100644 --- a/config_webrx.py +++ b/config_webrx.py @@ -111,6 +111,9 @@ Note: if you experience audio underruns while CPU usage is 100%, you can: # # https://github.com/Microtelecom/libperseus-sdr # +# and do the proper changes to the sdrs object below +# (see also Wiki in https://github.com/jketterl/openwebrx/wiki/Sample-configuration-for-Perseus-HF-receiver). +# # NOTE: The connector sources have replaced the old piped nmux style of reading input. If you still have any sdrs # configured that have type endin in "_connector", simply remove that suffix. From d74b79f585594afe508ebd5616480da8a51d349d Mon Sep 17 00:00:00 2001 From: Andrea Montefusco Date: Mon, 16 Mar 2020 18:05:49 +0100 Subject: [PATCH 4/4] references to Perseus HF receiver removed from main config file --- config_webrx.py | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) diff --git a/config_webrx.py b/config_webrx.py index d564276..9f33171 100644 --- a/config_webrx.py +++ b/config_webrx.py @@ -144,53 +144,6 @@ sdrs = { }, }, }, - "perseussdr": { - "name": "Microtelecom Perseus HF receiver", - "type": "perseussdr", - "ppm": 0, - "profiles": { - "40m": { - "name": "40m", - "center_freq": 7150000, - "rf_gain": 0, - "samp_rate": 500000, - "start_freq": 7050000, - "start_mod": "lsb", - }, - "20m": { - "name": "20m", - "center_freq": 14150000, - "rf_gain": 0, - "samp_rate": 500000, - "start_freq": 14070000, - "start_mod": "usb", - }, - "30m": { - "name": "30m", - "center_freq": 10125000, - "rf_gain": 0, - "samp_rate": 192000, - "start_freq": 10142000, - "start_mod": "usb", - }, - "80m": { - "name": "80m", - "center_freq": 3650000, - "rf_gain": 0, - "samp_rate": 500000, - "start_freq": 3570000, - "start_mod": "usb", - }, - "49m": { - "name": "49m Broadcast", - "center_freq": 6000000, - "rf_gain": 0, - "samp_rate": 500000, - "start_freq": 6070000, - "start_mod": "am", - }, - }, - }, "airspy": { "name": "Airspy HF+", "type": "airspyhf",