SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ......

33
SDR-J-SW-7 * Software for SDR : The 32 bits sw-receiver Jan van Katwijk Lazy Chair Computing The Netherlands [email protected] September 21, 2015 * ©: 2015, Jan van Katwijk, Lazy Chair Computing 1

Transcript of SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ......

Page 1: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

SDR-J-SW-7∗

Software for SDR : The 32 bits sw-receiver

Jan van KatwijkLazy Chair Computing

The [email protected]

September 21, 2015

∗©: 2015, Jan van Katwijk, Lazy Chair Computing

1

Page 2: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

1 Introduction

Well over 25 years, there are programs for handling the output of a radio, in that sense Software DefinedRadio (SDR) is hardly something new. Year after year, computer processing moves towards the front ofthe radio processing chain, more and more signal processing is done in regular computers. Now, manySDR devices are on the market, ranging from extremely simple to extremely complex. Common tothese devices is their need for software, both for controlling the device, i.e. setting frequencies, settingfilters, and for processing the raw data stream.

This ”sw-receiver” is a flexible piece of software doing both ”control” and ”processing”. It supportsa number of SDR hardware devices, it allows setting and changing bandpass filters, it allows tuning upto an accuracy of 1 Hz, it lets the data pass through pretty tough filters, it shifts the selected band tobaseband and it supports a number of decoders. It is a device for experimenting, therefore, it containsa lot of buttons and selectors. (For all buttons, sliders and other selectors, there is a suitable defaultvalue, however.) As such it is an ideal vehicle for listening to frequencies from 100 Khz to up to 2 GHz(using appropriate devices).

The software of the whole SDR-J suite is (being) developed under Linux (currently Fedora 21), it iswritten in C++ using Qt (and Qwt) for the gui. The software builds upon many open source libraries(e.g. Qt, Qwt, fftw3, libusb-1.0, libftdi, libsamplerate, libsndfile, libportaudio, librtlsdr) while otherexisting software available under open source licenses, e.g. gmfsk and fldigi, served at least as source ofinspiration.

Thanks to the portability of C++, Qt (Qwt) and many libraries, thanks to their availability under anopen source license, and thanks to the excellent Mingw64 cross-compilation facilities that are availableunder Fedora, porting the software to Windows turned out to be surprisingly simple.

Differences with version 6 Although the version has a new major number, differences with theprevious version (i.e. 6.x) are limited. The major one is that we switched from QT4 to QT5. Thecurrent set of sources can be compiled under either Qt4.8 or Qt5, although compiling using Qt4 requiresadaptations in the ”.pro” file.

Since the GUI did not change between versions 6, 6.1 and 7, many of the pictures in this manualare made with version 6 or 6.1.

The main difference between version 7.0 and 7.1 is an architectural one and is as such invisible forthe user.

Supported Devices Current SDR hardware that is supported by available drivers:

• the Mirics SDRplay. The new Mirics SDRplay has a pretty wide frequency range it supports arange from 100k .. 2 Ghz. To support the use of an up- or downconverter (hardly needed), anoffset (In Mhz and Hz) can be specified (and dynamically being changed).

• the Mirics SDRplay remote. A small ”server” is available, running on e.g. a Raspberry PI 2, thatcontrols the SDRplay. A simple controller for connecting to the server is available. Server andcontroller communicate through the local WiFi.

• RT2832 based DAB DVB sticks. The frequency range supported by DABsticks varies, but usuallystarts in the higher segments of the short wave (the RT820 based ones start at app 25 Mhz).DABsticks can also be used with an up (or down) converter to extend the range of frequencies.There are plenty diagrams and offerings for upconverters, mapping 0 .. X Mhz to 100 .. 100 + XMhz. To support the use of an up- or downconverter, an offset (in Mhz and Hz) can be specified(and dynamically being changed).

• Linux Only: the ”classic” Elektor card as described in Elektor May 2007, including the preselectoras described in Elektor December 2009.

2

Page 3: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

• Linux Only: Interface software for the pmSDR is available. The pmSDR supports frequenciesup to 35 MHz, using the thid harmonic of the oscillator it supports - with less performance -frequencies up to 165 MHz. A soundcard is needed for the pmSDR, its output is analog.

• For use under Windows, a ”dll-handler” is available with which Winrad compatible dll’s for deviceswith soundcard input can be loaded. I am using this feature under Windows for both the pmSDRand the Elektor card.

• Linux Only: support for the Elad-s1 receiver, an SDR device with a frequency range of 0 .. 30Mhz, and a 14 bits Adc.

• an SDR9TR device. A device, homebuilt by Johan Maas1, connected by a network to the computerwhere the main program runs. Although unlikely that someone else has the same device, it is anice example of how to interface.

Furthermore, the software has the provision to dump the input as well as the intermediate samplestreaminto a file with the common ”.wav” format. Next to that, ”.wav” files can be used as input.

The particularities of the use of each of these devices is discussed later in this manual.

Decoders The sw-radio has ”on-board” a number of decoders:

• an ”analog” decoder for am, ssb and fm;

• an Rtty decoder;

• a Bpsk, Qpsk decoder;

• a CW decoder;

• a NavTex decoder (Amtor-B);

• a WeatherFax decoder;

• an MFSK decoder;

• a Domino decoder;

• an Olivia decoder;

• a Hell decoder;

• a Throb decoder;

• an experimental DRM decoder (new in version 7).

Settings for each of the decoders are discussed later in this manual.

Plugins Support software for devices as well as software for decoders is implemented through a pluginmechanism. Software is such that on the start of the program a list of available input plugins and alist of decoder plugins is assembled. For configuration purposes, i.e. telling the programs where to findthe different plugins, a small utility configure-sw is available.

1For info contact Johan Maas ”pa3gsb at gmail dot com”

3

Page 4: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

2 Installation of the software

The software is available in two flavours:

• for Windows, a zipped file exists that contains a folder (directory) with all executables. Unpackingthe zip file is (almost) sufficient for installation.

• for Linux, a ”.tgz” file exists with all sources: one has to create the executables.

2.1 Installation under Windows

The executables are (cross-)compiled for a 32 bits Windows environment, and are packaged with (al-most) all required dll’s2. The software runs on 32 and 64 bits machines.

Unpacking and installing After unpacking the zipped directory, a folder (directory) with the namewindows32-bin-sw is created. This folder (directory) contains (a.o) two executables, (sdr-j-swradio-7.xand configure-sw) as well as a number of dll’s that are required. Furthermore, the folder (directory)contains two subfolders:

1. input-plugins-sw, the folder (directory) where the input plugins are stored,

2. and decoder-plugins, the folder (directory) where the decoder plugins are stored.

Setting up devices Under Windows, several additional measures might have to be taken, dependingon devices for which support is required:

1. For support of the Mirics SDRplay, one has to install the Mirics driver software: Installationsoftware and libraries for the SDRplay can be obtained from www.SDRplay.com. Note that in thecurrent version there is direct support for the extIO-SDRplay.dll.

2. For using an RT2832-based DAB stick, one has to:

• download the rtl-sdr.dll. Dowloading the dll file is best done from the site of the developershttp://sdr.osmocom.org/trac/wiki/rtl-sdr. Pls ensure that you download the 32 bit version.Place the ”.dll” file in the windows32-bin-sw folder or adjust the searchpath.

• install an appropriate (user level) USB driver. One could well use the zadig program that isincluded in the distribution. Operation of Zadig is fairly simple: start the zadig program,after inserting the stick. Select through the ”options” button the right USB device, and havethe driver as suggested installed.

3. For using an Elad-s1 device, one has to install the Elad-s1 software from the elad site. Currently,there is ONLY support for Elad-s1 for Linux.

4. For support using the ”dll-handler”, one has to ensure that the required dll’s are available. Currentsupport by the ”dll-handler” is limited to device where a sound card is used to digitize the data.The dll-handler is thoroughly tested with the pmSDR and the elektor card.

2.2 Installation under Linux

Building the executables requires installing a number of libraries and running qmake. A description ofthe build procedures under Ubuntu and Fedora is given in section 6.

The build process will create a directory linux-bin containing the executable, and that will containtwo subdirectories input-plugins-sw and decoder-plugins for the various plugins.

2It is assumed that the windows you are running on already has dll’s like MSVCR100.DLL installed.

4

Page 5: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

2.3 Preparing for use

The defaults are chosen such that when one starts the sw-receiver by clicking on the icon in thewindows32-bin-sw folder for Windows or the linux-bin directory for Linux, the input plugins and thedecoder plugins will be found. Default values - used when the locations are not specified in the ”.ini”file - for their locations are local folders (directories) ”input-plugins-sw” and ”decoder-plugins”.

If one wants the program to be started from another location, the program needs to be informed onthe locations of these folders (directories). configure-sw will help in registering the paths towards theinput-plugin-sw and decoder-plugin-sw folders (directories) in the .ini file3.

Important: Note that the format of the ”.ini” file for version 7 differs slightly from the format forversion 6.0. Storage for settings for the various decoders and the various devices is now in separate”paragraphs”.

Important: Note that the format of the interface of the input plugins changed, using plugins fromprevious versions is - unfortunately - impossible.

The configurator program can be found in the .\windows32-bin for Windows and in the ./linux-bindirectory under Linux.

For locating a folder where device controller plugins reside, push the device button and select a folderthrough the dialog. For selecting a folder for decoder plugins, push the decoder button and select afolder through the dialog.

Save the selected folders by pressing the save button. The selected paths will be saved in the$(HOME)/.jsdr-sw.ini file.

3 The sw-receiver

The sw-receiver is a program that - as far as data processing is concerned - does not do much morethan reading data from a selected input device (either the soundcard, file or the usb), filtering the dataaccording to - possibly implied - specification, mixing the filtered data with data from a local oscillatorto shift it to a baseband signal and - after decimation of the signal (i.e. reducing the samplerate) passingthe data through a second bandfilter - handing that baseband signal to a selected decoder.

3For the sw-receiver, the ”.ini” file is $(HOME)/.jsdr-sw.ini.

5

Page 6: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

The GUI of the sw-receiver provides, apart from buttons, sliders and other selectors, two ”displays”.

• The top display shows the spectrum (either in spectrum form or as a waterfall) of the incomingdata;

• the second display shows the spectrum (either in spectum form or as a waterfall) of the selecteddata, data that is made available to the decoders, i.e. after the aforementioned processing steps.

Both displays show a ”needle” that indicates the point of the selected frequency on the display, the topone with the frequency, the bottom one gives the position, relative to that frequency.

3.1 Selecting a ”radio” device

Selecting a radio device is by making a selection on the list that will be displayed when pressing thebutton labeled 1 (indicated on the figure below). The list is built from available plugins on programstart. As soon as a selection is made, a subwindow (mirics-dongle in the figure) is filled with the partof the GUI relevant for the selected input device.

Selecting dll-handler will result in showing a file selection dialog window with which the ”.dll” file for

6

Page 7: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

the considered device can be selected. Note that other ”.dll”’s required for successful loading of theaforementioned ”.dll” should be in the ”search path”.

3.2 Selecting a decoder

Selecting a decoder is by making a selection on the list that will be displayed when pressing button 2(indicated on the figure below). The list is built from the available decoder plugins that are found onprogram start-up. As soon as a selection is made, a subwindow (displayed in the figure below) is filledwith part of the GUI relevant for the selected decoder.

3.3 Tuning

For tuning, one may use the keypad in the middle of the screen (labeled 3). Keying e.g. 14070 followedby pressing the KHz button or keying in a frequency with Hz accuracy, e.g. 14070000 followedby pressing the Hz button, will result in sending a request to the radio device to set the VFOon a frequency near 14070 KHz, and to set the needle in the top display on the right frequency. Thefrequency finally selected will be displayed4

For adjusting a frequency, there are several options

• pressing the ”-100”, ”-10”, ”-1”, ”+1”, ”+10” and ”+100” button will lead to a change in thefrequency of the amount in Hz mentioned.

• rotating the mousewheel (when the mouse is positioned in one of the two top displays) will causethe frequency to change a small amount. The amount is specified in the spinbox labeled 45.Default setting is 20 Hz, setting in the figure is 4 Hz.

• clicking the left button of the mouse, when the mouse is positioned in one of the two displays.

Finally, with the button ”middle” (labeled 5), the frequency setting will be such that the selectedfrequency is under the needle, approximately on the middle of the right half of the display.

4The VFO of the device may give a value slightly different from the requested value, what is shown is the valuereturned from the device. This happens a.o. with the Elektor card where in the higher range of frequencies, the deviationis significant.

5The value will be stored in the ”.ini” file, and used as initial setting the next time the program starts

7

Page 8: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

3.4 Start and stop

On program start, parameters are set for the data processing. As soon as all preconditions are met, i.e.a device is selected that will send data to the program, and a device is selected that will output thedata processed, the program will actually start data processing when the start button (labeled 6 in thefigure below) is pressed.

Stopping data processing is by pressing the pause button (labeled 8) the program will still be alive andpressing this button again will cause processing to be resumed.

Quitting the program is by pressing the quit button (labeled 7). Open files will be closed, and theprogram terminates.

3.5 I and Q

The signals, entering the system, are supposed to be I/Q signals. With the selector (labeled 9 in thefigure below) one can interchange the I and Q parts of the signal or just select one of them.

Furthermore, with the spinbox (labeled 13 in the figure), one can delay the I elements of the data streamzero or more elements (negative delay means delaying the Q elements).

Balancing the I/Q signals can be done by the second slider of the two top sliders (labeled 10 in thefigure). With the top one of these two sliders the attenuation of the incoming signal is controlled.Automatic gain control is achieved by the agc selector (labeled 11 in the figure), possible values are”off”, ”slow” and ”fast”. The signal value where the gain control will become effective is given inthe spinbox (labeled 12). Operation is that signals stronger than the treshold set by the spinbox areweakened.

3.6 Viewing Data

The default setting for the displays gives a plain spectrum view. Sometimes it can be helpful to lookat the signals as in a waterfall. For both displays, one can select the view, either a spectrum display or

8

Page 9: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

a waterfall display, by the buttons, labeled 14 and 15, in the figure below

3.7 Saving inputs and outputs

It might be interesting to save the signal as it is before any filtering is done, before decoding (i.e. afterfiltering, frequency shifting and decimating), and - at least in some cases - as the resulting audio signal.

The figure below shows the buttons for saving the signal.

The buttons are hf-dump, if-dump and lf-dump respectively (labeled 16, 17 and 18 in the above figure).Pressing a button will instantiate a file selection menu with which a filename for storing the output canbe selected. The labeling on the button will indicate that a file is being written by showing ”WRITING”as text. Pushing the button for a second time will stop the writing.

The files are written as ”.wav” files, with PCM samples on the frequency of the signal. I.e. an inputsignal on 96000 will lead to a ”.wav” file with PCM samples at a rate of 96000, an ”if” file with anintermediate rate of 12000 will have a sample-rate of 12000.

3.8 Passband selection

Selecting a passband, such that this band is filtered out and shifted to baseband that can be processedfurther, is one of the main functions of the sw-receiver front end.

To ease operation, a number of selections has been predefined, and one might select an ”am” profile,a ”usb” or ”lsb” profile directly using the selector labeled 19 in the figure below.

AM is up to 9 Khz (depending on the selected working-rate), USB and LSB are 2.5 Khz. ”DRM” givesthe full 12K field.

The same effect - and more - can be achieved with the two sliders labeled 20 in the figure above.

9

Page 10: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

These sliders control the passband selection,

• the width of the selected band is set by the top one of the two sliders,

• and the relative center of the selected band by the bottom one of the two sliders.

The width of the band is obviously constrained by the already mentioned working-rate, i.e. the sample-rate after decimating, that is used for decoding.

The working-rate itself, i.e. the sample-rate with which the data is sent to the decoders, can becontrolled by the selector, indicated in the figure below as label 21.

4 The Decoders

When selecting a decoder in the sw-radio a subscreen will show up, dedicated to that decoder. Thisscreen will contain buttons and sliders to select the appropriate running parameters for the specificinput. On selecting another decoder (or terminating the program) settings for some of the buttons andsliders will be stored, and used as initial values for the next invocation.

4.1 Analog decoder

The analog decoder supports the common analog modes, i.e. am, fm, usb, ssb. With selector, set to”lsb” in the picture below, one selects the mode. Note that when one selects a mode, e.g. ”lsb” or”usb”, this refers to a decoding mode, not to the setting of bandfilters.

In this particular example, we are listening to ”Nederlandstalig amateurnet”, on 3604 Khz in LSB mode,so the quick band select is set to ”lsb” and the decoding mode also to ”lsb”. Since the ”working rate”is still 12 Khz, the 2.5 KHz of the LSB only fills a fraction of the screen.

In case ”fm” is selected as mode for the decoding, a sequelch filter is switched on automatically, thefilter limit value can se set by the bottom one of the two sliders.

10

Page 11: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

All audio output can be send through a (simple) noise limiter, this is controlled by pushing thebutton filter. The strength of the noise limiting filter (a simple adaptive FIR filter) is set through theslider right to the button.

The Lcd numbers on the left of the screen give resp.

• the signal strength,

• the offset of the center frequency in case the pll decoder is used.

4.2 Psk decoder

The IF for the psk decoder is chosen to be 800 Hz. This means that for selecting a station at frequencyX, the sw-receiver should be tuned to X - 800. The red needle in the bottom screen indicates theposition of where the signal is decoded. Note that the Psk signal to be decoded is in the upper sideband.

Characteristic for the psk decoder is the dial display at the left size of the decoder-specific subscreen.When running, this display will show the phase angle between - perceived - subsequent Bpsk or Qpskbits. Ideally the values shown for Bpsk are 0 and 180 degrees. For Qpsk reception, the values are -ideally - multiples of 90 degrees.

The parameters to be controlled are:

• the afc, allowing the software to adapt the IF based on an dynamic estimation of the offset.

• normal or reverse interpretation of the incoming signal;

• the decoding mode: one of a selection of Bpsk and Qpsk modes.

• the threshold used to distinguish noise from signal. The scale used has no specific physical meaning.

• the strength of the filter used to separate the signal on the IF from other signals in the environment.The degree indicates the order of the Butterworth filter being used.

The two value displays indicate the actual IF and the signal quality respectively.It must be noted that the Bpsk is (much) easier to tune than the QPsk, the latter requires tuning

precision within a few Hz, while the former may be able to decode with a tuning error of 5 to 10Hz.

4.3 Rtty decoder

The working IF for the Rtty decoder is chosen to be 800 Hz, tuning to a station on frequency X impliessetting the receiving frequency on X - 800. The red needle in the screen indicates the position of where

11

Page 12: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

the signal is decoded.

Tuning should be such that the 800 Hz needle should be precisely in the middle between the two legsof the spectrum of the received rtty signal.

The decoder window shows 8 combo-boxes for setting decoder-specific parameters. In two columns,from top to bottom, from left to right:

• the shift, defaulting to 170 Hz. One of a number of alternatives can be selected.

• the baudrate, defaulting to 45 Hz.

• the parity bits, defaulting to 0.

• the MSB, i.e. Most Significant Bit first or last.

• the afc, defaulting to off. When set, the program will attempt to optimize the tuning which isuseful in the presence of a signal.

• the interpretation mode: normal or reverse, defaulting to normal.

• the wordlength in bits, defaulting for rtty to 5.

• the number of stopbits, defaulting to 1.

The four value displays indicate:

• the actual IF, when the afc is on one might look at the changes in this value and use that as anaid in tuning;

• a very rough estimate of the frequency error, which is being used to test some algorithms;

• the estimated baudrate;

• the estimated shift.

Note that values that are set are - on normal program termination - stored in the ”.ini” file, and usedas initial value next time the decoder is used.

12

Page 13: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

4.4 Cw decoder

Notice that the working IF for this decoder is chosen to be 800 Hz, tuning to a station that sends onfrequency X then requires setting the receiving frequency on X - 800. The red needle in the screenindicates the position of where the signal is decoded.

The cw decoder will attempt to guess the speed of the transmission, however, some user help isneeded. Setting an upper limit to this speed is with the selector left to the ”words per minute” display(labeled ”1”). It may be beneficial to adapt this setting:

• in case the setting is too high, everything might be considered a ”dash”,

• in case the setting is too low, everything might be considered a ”dot”.

The default value is around 30. In the picture, it is shown that the upper limit is set to 43, while the”measured value” is 35.

The squelch, the top one of the three spinboxes, is used to set a threshold in the signal, below whichit is considered noise.

The filterdegree, the bottom one of the three spinboxes, can be set, it is default set to 12, whichis a reasonable value for the type of filter (Butterworth). In this case its value is 8, so an 8-th orderButterworth filter is used to separate the signal from its environment. Higher order filters seem attractivebut they smoothen the transition between no-signal and signal.

The four boxes displaying values:

• the top two indicated the estimated length of the dot and the space.

• the bottom two indicate (clamped) levels for the peak of the signal and the estimated noise level.These value displays are merely for debugging purposes.

4.5 Mfsk decoder

As with the other decoders, the IF for the domino decoder is chosen to be 800Hz. This means that forselecting a station at frequency X, the sw-receiver should be tuned to X -800. The red needle in thescreen indicates the position of where the signal is decoded.

13

Page 14: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

The decoder provides 3 combo-boxes for setting parameter values:

• the afc, by default off;

• whether the incoming signal is to be interpreted normal or reverse w.r.t the base tone;

• the mfsk mode, by default set to mfsk16.

Furthermore, the decoder has a box with which a threshold value can be set, below which incomingsignal is to be considered noise.

The three value displays on the screen show:

• the - perceived - quality of the signal;

• the estimated baudrate;

• the IF, which only changes when the afc is set.

Dynamically tuning a mfsk transmission is pretty difficult, tuning should be accurate within a fewHz, and - due to the FEC decoding - it may take a while before one can see that tuning is correct.

4.6 Domino decoder

As with the other decoders, the IF for the domino decoder is chosen to be 800Hz. This means that forselecting a station at frequency X, the radio should be tuned to X -800. The red needle in the screenindicates the position of where the signal is decoded.

14

Page 15: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

Domino is by itself an easy mode, tuning is - within limits - not very critical. The various combo-boxes(from top to bottom):

• selecting the domino mode and speed;

• normal or reverse interpretation;

• with or without FEC;

• setting a squelch-level for the decoding.

The - perceived - quality of the signal is indicated in the value display.

4.7 Olivia decoder

The Olivia decoder is merely a wrapper around the ”standard” implementation of Pawel Jalocha, allrights are acknowledged. Olivia is not an easy mode, tuning, even to a prerecorded signal, turns out tobe pretty difficult. The red needle in the screen indicates the position of where the signal is decoded.

4.8 Amtor decoder

Navtex decoding uses an IF of 800 Hz, so the tuned frequency should be 800 Hz less than the sendingfrequency. The standard Navtex Frequency of 518 KHz therefore requires tuning to 517200 Hz.

The parameters, settable though combo-boxes, are:

• afc, default off;

15

Page 16: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

• normal or reverse interpretation of the incoming signal;

• strict FEC or non-strict FEC.

• message or general text. In case ”message” is chosen, the messages displayed are the propernavtex messages enclosed between ”ZCZC” and ”NNNN” sequences.

The value displays indicate:

• the actual IF (will obviously only change when afc is set).

• the strength of the signal.

4.9 Weatherfax decoder

The weatherfax decoder uses an IF of 1900 Hz, which implies that tuning to a weatherfax station at,say, 8040 Khz needs to be done at 8038100 Hz. The selection of predefined bandwidth settings has asetting ”fax”.

The default setting for this decoder is ”mode 576”, other modes can be selected by the mode selector.

4.10 Hell decoder

16

Page 17: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

Hell uses an IF of 800, with as implication that tuning to a station sending Hell on XXX Hz, actualtuning should be XXX-800.

The Hell decoder has four selectors that can be set:

• the Hell mode6, one of {”feldhell”, ”slowhell”, ”hellx5”, ”hellx9”, ”fskhell”, ”fskh105”, ”fskh245”,”fskh80”}.

• background selector (i.e. white letters on a black background or black letters on a white back-ground);

• width selector: full or halfwidth;

• rate corrector, justifying the number of pixels per line.

When decoding, a ”metrics”, telling more or less the quality of the signal, is displayed (in a scalefrom 0 .. 100).

4.11 Throb decoder

The throb decoder is a wrapper around the actual throb decoder which is from fldigi (copyrightsacknowledged).

The IF is, as usual, 800 Hz. Selectors are

• the mode, i.e. one of { ”throb1”, ”throb2”, ”throb4”, ”throbx1”, ”throbx4”};

• normal or inverse interpretation;

• the afc, by default off, and

• the threshold, i.e. noise floor.

To aid in tuning (pretty difficult), an additional waterfall screen has been created. The number displayson the screen further show the S2N ratio and the metrics of the signal.

6It must be noted that not all modes are thoroughly tested, due to a lack of testmaterial.

17

Page 18: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

4.12 DRM decoder

The DRM decoder is experimental and is - continuously - under development. In its current form itsupport sound decoding for the DRM modes A, B and C.

In its current form it is meant for (the very few, at least in this part of the world) drm broadcaststations that can be received.

The figure shows the reception of radio India (Khampur), the leftside of the subwindow shows astation label (in this case ”TEST MUSIC”), and it shows that the coding of the sound is ”AAC”.

For DRM reception tune in to a station, ensure that the intermediate rate selection is on 12000, andput the band selection to ”drm”.

The drm decoder will make an estimate of the frequency offset and compensate for it. Experienceshows that offset to a few hundreds of Hz are acceptable.No further controls are available, however, two settings are possible through the ”.ini” file. Bothsettings influence the performance. The number of symbols used to determine the robustness modeis given in ”searchLength”, with 15 as default. The effect is that 15 * 320 samples are used in thedetermination of the robustness mode.

”windowDepth” defines - indirectly - the size of the window used in equalization. Its value is 0 ..5, where ”0” defines a modest number of symbols to be used in the equalization, while ”5” ensures themaximal number of symbols is used in the equalization, which should improve the result at the expenseof much higher computing requirements. Default is ”2”.The four ”lights” on the right side of the small GUI indicate a level of synchronization, all four greenusually means there is a reasonable signal.

The numbers on the left side enclosed in boxes indicate compensation values for a time shift (theleft three boxes) and frequency (the three boxes on the right). Below that an indication of the strengthof the signal.

The spaghetti lines in the middle show the amplitudes used for the equalization. In general onecould say that the straighter the lines, the better the quality of the signal.

A separate document is available in which the implementation of the synchronizing part of the drmdecoder is described.

5 Input plugins

In the current distribution plugins are provided for input:

• the cardreader plugin,

• the elektor plugin,

18

Page 19: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

• the ELAD-s1 plugin,

• the pmSDR plugin,

• the filereader plugin,

• the SDRPlay plugin,

• the DABstick plugin,

• the dll-handler plugin.

5.1 The cardreader plugin

Even when no device is connected, it is possible to process data entering through the soundcard byselecting the cardReader plugin. Before the soundcard data can be used, two values have to be set:

• the sample-rate, here set (and defaulting) to 48000;

• the channel on the soundcard delivering the data.

Note that it is possible to (dynamically) change the sample-rate. However, one should not forget toselect a soundcard channel again after doing so and press the start button again.

5.2 The Elektor plugin

The additional sliders and settings for the Elektor card can be seen on the picture

19

Page 20: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

Under Linux the Elektor plugin uses the libusb-libftdi combination that is available under most (all?)Linux distributions.

The plugin assumes that the preselector as described in 2010 is also available. This preselectorsupports frequency ranges described in a file, the name of this file is FreqFile. It should be readable in the”current” directory, i.e. the directory in which execution takes place. This file is rather implementationspecific, it contains 4 tables, one for each of the buttons, particular to the preselector. Format of thetables is straightforward

(3 14 ((5555 50)

(5600 94)

(5642 98)

(5955 103)

(6100 107)

(6200 107)

(6400 111)

(6500 112)

(6600 113)

(6700 114)

(7000 116)

(7200 121)

(7500 122)

(8499 255))

This fragment indicates that the part of the table is for the third entry (segment from 5555 Khz to 8500Khz), the table has 14 entries, each entry indicating a pair (frequency, ”Voltage” setting for the DAconverter for the capacitor of the filter). The aforementioned selector has four filter circuits, the tablehas therefore four entries.

The button labeled ”manual” gives the possibility of selecting between a manual preselection or anautomatic preselection. The latter is available only if the file ”FreqFile” exists.

With the buttons f1 .. f8 one selects one of the bands of the card (when supported). Bands f4, f5,f6, f7 relate to the preselector. Selecting one of the bands manually ends automatic selection.

The attenuation (in dB’s) can be selected by one of the buttons 0, -10, -20.

The top one of the two sliders controls the setting of the voltage to the voltage controlled circuiton the preprocessor. It is far from linear. When selected automatic preselection, the slider will be setto a voltage, determined by the contents of the FreqFile.

The bottom one of the two sliders controls the setting of the Xtal, setting it influences the tuningaccuracy. The value of this slider is stored in the .ini file.

The Elektor card emits its data in analog form, a soundcard is needed for conversion. The selectoron the bottom is used to select the soundcard channel (here ”E-MU 0202”), the sample-rate can beselected by the selector above this one. Current setting is the default setting to 96000.

Note that it is possible to (dynamically) change the sample-rate by selecting one of the values onthe selector. However, one should not forget to select a channel again after doing so and pressing thestart button.Note that under Windows one might use the ”extIO-ElektorSDR.dll”.

5.3 The ELAD-s1 plugin

Elad-s1 requires a-priori selection of the samplerate. There are different library components for thedifferent samplerates. It is assumed that - for the sw-receiver - the selected sampling rate is 192000.

20

Page 21: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

The Elad plugin provides two buttons and one more selector:

• gain reduction button, default off;

• filter selector, default off;

• offset selector, if one uses the device as a backend.

5.4 The pmSDR plugin

The additional sliders and settings for using the pmSDR (Linux Only) can be seen in the picture below.

On the top row of the plugin screen one sees 5 buttons, that are used for selecting a filter on the pmSDRfor a given band. The picture shows that currently no filter is selected. Button labeled ’5’ switchesoff the filters, the other ones select a filter after which the filter range is displayed. Below one seens abutton labeled ”manual”, this button is used to select either manually a filter for the band covering thecurrent frequency, or having that dome automatically. Current setting indicates that the current stateis ”manual”, and that pressing the button will change it into ”auto”.

Next to this button, there is a ”mute” button. The sliders are not used in this version. Below thesliders there is a spinbox where one might specify an offset. This offset is subtracted from the specifiedfrequency before setting the oscillator of the pmSDR’s VFO. It is meant for using the set in combinationwith an up- or down converter.

The pmSDR emits its data in analog form, a soundcard is needed for conversion. The selector onthe bottom is used to select the channel (here ”E-MU 0202”), the sample-rate can be selected by theselector above this one. Current setting is the default setting to 96000.

Note that it is possible to (dynamically) change the sample-rate by selecting a value on the selector.However, one should not forget to select a channel again after doing so and pressing the start button

21

Page 22: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

again.Under Windows one may use the ”extIO-PMSDR.dll”.

5.5 The filereader plugin

When a filereader is selected as input plugin, a file dialog is opened and a file can be selected that willbe used as inputfile. There furthermore no settings for this plugin.

5.6 The SDRplay plugin

The additional sliders and settings for running with the Mirics SDRplay can be seen on the picture

Most shortwave signals, especially those in amateur bands, are small, from a few Hz to a few Khz.Since the samplerate of the SDRplay is generally too high to show a signal width a width of a few Hzon a small screen, decimation is applied to the signal. The rate of data sent to the computer is userselectable, in this example 192000, such that on the spectra showed one can see smaller signals. Samplesare filtered and decimated before handed over to the program.

The plugin itself has four fields that can be set

• the gain is used to set the gain of the stick,

• the KHz field can be used to set an offset for the vfo frequency in KHz, and the

• the Hz field can be used to set an additional offset for the vfo frequency in Hz.

• the selected rate for samples sent to the computer. In this example a rate of 192000 is selected(the figure above this selector tells the sample-rate used by the Mirics device). Note that afterchanging the rate during execution, the program will wait until the Start button is pressed again.Possible rates to be selected are 96000, 192000, 256000, 384000, 512000 and 768000. For eachselected rate, the software will find an inputrate for the Mirics device such that integer decimationsuffices.

22

Page 23: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

5.7 The ”remote” plugin

The plugin, when selected, allows a connection to be made to an external ”mini” server for the SDRplay.

Pressing the ”connect” button will start a conversation for finding the appropriate IP address for thehost of the server. Once the connecion is made, the frequency offset can be set, the gain reduction canbe set and the rate for the samples to enter can be set. (see also the ”mini-server” section).

5.8 The DABstick plugin

The additional sliders and settings for the DABstick plugin can be seen on the picture

The same kind of decimation as described in the paragraph on the Mirics SDRplay is used. As withthe Mirics SDRplay, samples are filtered and decimated before handed over to the program..

Under Windows one has to ensure that a ”rtlsdr.dll” is available. For this driver software, an USBdriver has to be installed, e.g. by Zadig7.

For Linux, however, one has to ensure the availability of librtlsdr. Ubuntu and Fedora have li-brtlsdr as a package. Extensive instructions for installing this shared library is available at e.g.www.osmocom.org.

The plugin itself has five fields that can be set

• the gain is used to set the gain of the stick,

• the ppm is used to set the oscillator offset in Parts per million, of the stick.

• the KHz field can be used to set an offset for the vfo frequency in KHz, and the

7On the web there are dozens of elaborated examples of installing

23

Page 24: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

• the Hz field can be used to set an additional offset for the vfo frequency in Hz.

• the rate for data sent to the computer. Rates that can be selected are 96000, 192000, 256000,384000, 512000 and 768000. When selecting a rate, an appropriate inputrate for the DABstickwill be selected, such that an integer decimation suffices. Note that after changing the rate duringexecution, the start button of the sw-receiver program is to be called again.

5.9 The dll-handler plugin

The dll-handler plugin provides a simplified interface to a subset of Winrad-compatible dll’s, currentlyconstrained to those for devices that deliver their data through a soundcard.

The dll-handler is implemented for both Windows and Linux. However, since dll’s are only availableunder Windows, its use is practically limited to Windows.

When selecting the dll-handler plugin, the user is presented a file dialog for selecting a devicesupporting plugin. Please recall that when a Winrad compatible ”.dll” is selected, other ”.dll”’s onwhich this ”.dll” is dependent, should be in the regular searchpath.

In case the ”.dll” has its own GUI for setting parameters, it will be shown. As an example, thefigure below shows that a ”.dll” for the pmSDR is loaded and the dll-handler reports that initializationof the hardware was successful.

6 The SDRplay ”mini-server”

A simple ”mini-server” for controlling the SDRplay was added. It controls the SDRplay, it decimatesthe samplestream to reach a value appropriate for the sw-receiver and it sends these samples over theinternet (in my case home-WiFi)

24

Page 25: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

It accepts connections from the ”remote” plugin. Normal use is to connect to the remote computer (inmy case an RPI 2 with arch Linux), then start the server and connect from the sw-receiver.

7 Installation under Linux

Unpacking the packed sources will create a directory systems. This directory contains a number ofdirectories, a.o.:

• linux-bin, a directory where the generated executables will be placed: the configure-sw and sdr-j-swreceiver-7.1 executables and two subdirectories input-plugins-sw and decoder-plugins-sw.

• sdr-j-swreceiver-7.x, a directory that will contain:

– configurator, a directory that contains the sources from which a simple configure program canbe generated. The directory contains a file configure-sw.pro which is the basis for generatingthe executable.

– swreceiver, where the sources for the sw-receiver proper are stored, which contains:

∗ src, containing (the) sources for the swradio,

∗ plugins, containing (the) sources for the plugins, both for input and for decoders. Theinput-plugins:

· cardreader, the plugin for only soundcrd input,

· dabstick,

· sw-elad-s1,

· elektor,

· extio, the plugin for the handling the external dll’s,

· mirics-sdrplay, the plugin for the SDRplay,

· remote-sdrplay, the plugin for the external SDRplay mini server.

· pmsdr, the plugin for the pmSDR support.

The directory contains a script ”create-for-linux” that can be used to generate the exe-cutables.The plugins for the decoders:

· amtor-decoder,

· analog-decoder,

· cw-decoder,

· domino-decoder,

· weatherfax-decoder,

· hell-decoder,

· mfsk-decoder,

· no-decoder,

· olivia-decoder,

· rtty-decoder,

· psk-decoder,

· throb-decoder,

· drm-decoder.

∗ includes, containing the include files for the sw-receiver, shared by the sw-receiver andthe plugins.

∗ the file sdr-j-radio-71.pro, which contains the data for qmake to generate a Makefile,

25

Page 26: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

∗ a file CMakeLists.txt, for use with cmake.

• servers, a directory containing a subdirectory wih the code for the sdrplay-server. Generatingthe executable is through a qmake/make sequence. It is assumed that when the regular SDRplayplugin is generated, all prerequisites are available.

Before actually creating the executables, some libraries (together with the corresponding includefiles) have to be in place and attention should be paid to prepare user-access to some of the supporteddevices.

Setup pmSDR If you want to use the pmSDR, create a group ”pmsdrusb” for users that shall beallowed to use the pmSDR device and add yourself to this group.

$ cd

$ su -c "groupad pmsdrusb"

$ su -c "usermod -aG pmsdrusb ‘whoami‘"

Next, we create the udev rules for the pmSDR as follows and place it at the right place.

$ cd

$ cat << EOF > 95-pmsdr.rules

#

# udev rules file for Microchip 18F4455 USB Micro (PMSDR)

#

SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="000c", GROUP="pmsdrusb", MODE:="0666"

EOF

$ su -c "mv 95-pmsdr.rules /etc/udev/rules.d"

Now log off and on again to finally become member of ’pmsdrusb’.” Do a check

id $USER

echo " "

echo "audio/pulse/pmsdrusb group check"

sudo more /etc/group | grep "($USER)"

sudo more /etc/group | grep "audio"

sudo more /etc/group | grep "pulse"

sudo more /etc/group | grep "pmsdrusb"

Setting up the DABstick library The dongle software is from the osmocom site. We load fromthe site sdr.ormocom.org the sources for the dongle handling8

$git clone git://git.osmocom.org/rtl-sdr.git

Before pulling a version, uninstall any previous version you might have.The software supports generation under both gnu autotools and cmake.

$cd rtl-sdr/

$mkdir build

$cd build

$cmake ../ -DINSTALL_UDEV_RULES=ON

$make

$sudo make install

$sudo ldconfig

8These instructions are from the osmocom site

26

Page 27: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

The addition to the cmake command ensures that non-root users are also allowed to access the dongle.Alternatively, one could use the gnu autotools

$cd rtl-sdr/

$autoreconf -i

$./configure

$make

$sudo make install

$sudo make install-udev-rules

$sudo ldconfig

However, recent Linux distributions contain a ”package” rtlsdr.

Setting up the Mirics software For the Mirics SDRplay one should install the shared library usingthe installer for libmirsdrapi-rsp.so which can be obtained from Mirics Ltd (www.sdrplay.com). Followthe instructions from Mirics.

Setting up the elad-s1 software The following script may be helpful for setting up the elad-s1libraries

#!/bin/bash

# Elad-S1-libfdms1 Fedora22 64 bit support ( Elad src ,Andrea Montefusco src+help, Jan Katwijk help)

# fM fecit 2015-09-17 B.C - MMLCCLXVII A.U.C.

# "Festina lente" "Vinum bonum laetificat cor hominis"

uname -a

id

#get libfdms1_1.0-1_amd64.deb + info from address

#Elad software distribution server http://sdr.eladit.com/FDM-S1%20Sampler/Linux/

wget http://sdr.eladit.com/FDM-S1%20Sampler/Linux/libfdms1_1.0-1_amd64.deb .

wget http://sdr.eladit.com/FDM-S1%20Sampler/Linux/ELAD%20FDM-S1%20Linux%20API%20Doc/example.c

wget http://sdr.eladit.com/FDM-S1%20Sampler/Linux/ELAD%20FDM-S1%20Linux%20API%20Doc/elad%20fdm-s1%20linux%20api%20doc%20v1.0_eng.pdf

# read API !

# from Ubuntu to Fedora : convert *.deb to *.rpm

sudo dnf install alien

sudo alien --scripts --to-rpm libfdms1_1.0-1_amd64.deb

# what is into *.rpm

rpm -iqpl libfdms1-1.0-2.x86_64.rpm

# install Elad-S1 control shareable library + S1 FPGA firmware

sudo rpm -ivh --force libfdms1-1.0-2.x86_64.rpm

# software link by hand

sudo ln -s /usr/local/lib64/libfdms1_hw_ctrl.so.1.0 /usr/local/lib64/libfdms1-hw-ctrl.so

# copy /usr/local/lib64/libfdms1* to /usr/local/lib as well if your app needs it to be there!

#sudo cp /usr/local/lib/64/libfdms1* /usr/local/lib

#sudo sudo ln -s /usr/local/lib/libfdms1_hw_ctrl.so.1.0 /usr/local/lib/libfdms1-hw-ctrl.so

sudo ldconfig

# inspect !

sudo ls -lsa /usr/local/lib64/libfdms1*

# check if LD_LIBRARY_PATH has /usr/local/lib64, if not add it to <your-home-dir>.bash_profile

#export LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib:$LD_LIBRARY_PATH safe REBOOT!

echo $LD_LIBRARY_PATH

#install Elad-S1 receiver USB udev rules

cat >> Elad-S1.rules <<EOT

SUBSYSTEM=="usb", ATTRS{idVendor}=="1721", ATTRS{idProduct}=="0610", MODE="0666"

EOT

sudo cp Elad-S1.rules /lib/udev/rules.d/

27

Page 28: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

sudo cat /lib/udev/rules.d/Elad-S1.rules

#reload udev rules , try: service udev restart , or udevadm control --reload-rules , ...safe REBOOT !

sudo udevadm control --reload-rules

#connect S1 to PC

Installing required packages How to install packages obviously depends on the Linux distribution.Most distributions have some form of packaging system with which loading is eased.

For Debian-based system, e.g. Ubuntu, one would use ”apt-get”. Ubuntu gives quite some problems,Ubuntu 14.04 does support Qt5 in its regular repositories, however, it does not provide a ”qwt” libraryfor it. Ubuntu 15.04 does support both Qt5 and qwt6 for Qt5. However, the qwt library provided doesrequire - for whatever reason - QT STATIC CONST to be defined. A script that runs on Ubuntu 15.04reads:

#!/bin/bash

#

echo "Preparing the environment for Ubuntu"

echo "ensure that the udev rules are adapted for the usb devices"

echo " "

echo "install packages"

sudo apt-get install gcc g++ \

qt5-default libqwt-qt5-dev \

libfftw3-3 libfftw3-dev \

alsa-base libasound2 libasound2-dev alsa-utils libasound2-plugins \

libportaudio2 portaudio19-dev \

libsndfile1 libsndfile1-dev \

libusb-1.0-0 libusb-1.0-0-dev \

librtlsdr0 librtlsdr-dev \

For Fedora, one would use ”yum”

echo "install packages"

sudo yum install gcc gcc-c++ \

qt qt-devel qt qwt qwt-devel \

fftw fftw-devel \

alsa-lib alsa-lib-devel alsa-tools portaudio portaudio-devel \

libsndfile libsndfile-devel libsamplerate libsamplerate-devel alsa-plugins-samplerate \

libusb1 libusb1-devel libftdi libftdi-devel

note that for the proper use of the DRM decoder an adapted faad library is required.Configuration for generating the library should be with ”–with-drm”. A rather importantobservation is in order: The current distribution uses qt-5 and the qwt-6.1.x library. Thereare incompatibilities with the 6.0.1 library: Naming some fields changes between 6.0.0,6.0.1 and 6.1.x, The fields ”SetMajorPen” and ”SetMinorPen” as used in the file scopes-qwt6/scope.cpp are named ”SetMajPen” resp. ”SetMinPen” in 6.0.1 (as used by Ubuntu)and ”setMajPen” resp. ”setMinPen” in 6.0.0 (as used by Debian). Please check in yoursystem what ”libqwt” is referring to. Please check in your system what ”qt” (and qt-devel) is referring to and ensure that qt-5 and qwt-6.1.x will be used or adapt the fieldnames in the ”.pro” file.

Preparing the ”.pro” file Creating a Make file can be done using the QMake utilities in the qtsystem. For creating such a Makefile, Qmake uses a ”.pro” file as input. This ”.pro” file contains thenames of the relevant files, and it contains the names of the various libraries that need to be used inthe linking process.

28

Page 29: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

For Fedora, Ubuntu and other distro’s, libraries are sometimes named differently and located differ-ently.

Compiling configure-sw The ”.pro” file for configure-sw - contained in the directory configurator -is rather straightforward.

Generating an executable is in the following steps:

$cd configurator

$qmake-qt5

$make

Replace ”qmake-qt5” with the name of the ”qmake” command for Qt5 on your distribution.The resulting executable configure-sw is - by default - placed in the linux-bin directory.

Compiling the sw-receiver The ”.pro” file for the sw-receiver is contained in the directory sdr-j-swreceiver/swreceiver. When all packages and libraries are in place, generating is by creating a Makefileand running make

$cd swreceiver

$qmake-qt5

$make

Replace ”qmake-qt5” by the name of the qmake command for Qt5 on your distribution.The resulting executable sdr-j-sw-receiver-7.1 is - by default - placed in the linux-bin directory.

Compiling the input-plugins The code for the input-plugins can be found in the directory plug-ins/input. For each of the plugins the procedure is:

$cd my-device

$qmake-qt5

$make

$cd ..

(where - obviously - ”my-device” should be renamed to the directory of choice.)Again, replace ”qmake-qt5” by the name of the qmake command for Qt5 on your distribution. A

small script, create-for-linux is in the directory plugins/input, that - when modified for the right nameof the ”qmake” command - is able to generate executables for the plugins.

By default, plugins for input devices are placed in ./linux-bin/input-plugin-sw.

Compiling the decoder plugins The code for the decoder-plugins is to be found in plugins/decoders.For creating executables for all decoders, there is a simple script, create-for-linux that needs to beadapted for the right name of the ”qmake” command for Qt5.

Otherwise, it is simple. For each decoder that one wants, the sequence of commands is

$cd xxx-decoder

$qmake-qt5

$make

$cd ..

where ”xxx” is to be replaced by the name of the desired decoder, and ”qmake-qt5” is replaced by thename of the ”qmake” command for Qt5. The default directory in which the resulting plugins are placedis ./linux-bin/decoder-plugins,

29

Page 30: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

8 The .ini file

For a number of sliders and configuration values, both for the main program as for the plugin, a valuecan be set (and maintained) in .ini files. On absence of such files, reasonable defaults are taken. The”.ini” file is named $(HOME)/.jsdr-sw.ini.

9 The abstract interfaces

The input-plugins as well as the decoder-plugins have a relative simple interface to the main programs.

9.1 Abstract interface to decoders

Each decoder implementation is required to implement this abstract interface faithfully.

#

//

// The abstract interface for the decoders.

// In this version of the sw radio, any decoder being used is

// loaded as a plugin

#ifndef __DECODER_INTERFACE

#define __DECODER_INTERFACE

#include <QtPlugin>

#include <QFrame>

#include "swradio-constants.h"

QT_BEGIN_NAMESPACE

class QSettings;

class QObject;

class QWidget;

QT_END_NAMESPACE

//

// All decoders implement a pure abstract interface.

//

class decoderInterface :public QObject {

Q_OBJECT

public:

virtual QWidget *createPluginWindow (int32_t, QSettings *) = 0;

virtual ~decoderInterface (void) = 0;

virtual void doDecode (DSPCOMPLEX) = 0;

virtual bool initforRate (int32_t) = 0;

virtual int32_t rateOut (void) = 0;

virtual int16_t detectorOffset (void) = 0;

signals:

void setDetectorMarker (int);

void outputSample (float, float);

};

QT_BEGIN_NAMESPACE

Q_DECLARE_INTERFACE(decoderInterface, "sw radio/1.0")

QT_END_NAMESPACE

#endif

• On start up, the createPluginWindow method is called, with as parameters, the initial sample-rate,i.e. the rate for the samples to be passed over to the decoder, and a reference to the QSettings

30

Page 31: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

object, in which preferred settings for sliders, comboboxes and spinboxes are stored and read from.

The function will create a QFrame and make the part of the GUI for that particular decodervisible.

• On termination (on initiative of the main program), the function ˜decoderInterface is called. Ingeneral this will be an empty function, overloaded by the destructor of the derived class.

• When changing the working-rate of the sw-receiver - and thus the rate with which the decoder iscalled - the decoder gets informed with initforRate.

• The decoder will be queried about the rate of the samples that will be sent back to the mainprogram to the soundcard. In most cases, this will be the working-rate of the sw-receiver, incase of real digital modes (e.g. drm) however, the rate for the soundsamples that are produced isunrelated to the rate of the input samples.

• The initial offset for the data when decoding is set by detectorOffset. During the decoding process,the decoder might adapt this offset.

• Actual decoding takes place through a call to doDecode, with as parameter the sample to bedecoded.

In order to operate, decoders need to implement some signals as well, such that the main program isinformed.

• The signal setDetectorMarker is used to adjust the setting of the detectormarker in the screen onthe GUI. E.g. for a decoder such as the psk decoder, the IF is set to 800 Hz and may vary whenselecting the afc, variations will be signalled through this signal.

• The sound samples are sent to the main program by splitting the complex values into their realconstituents: real and imag, and sending these through outputSample.

9.2 Abstract interface to input plugins

The abstract interface to be implemented by device controllers is also pretty straightforward. Pluginsfor input devices are required to implement this abstract interface facefully.

#

//

// The abstract interface for the input devices

// In this version of the sw radio, any decoder being used is

// loaded as a plugin

#ifndef RIG_INTERFACE

#define RIG_INTERFACE

#include <QtPlugin>

#include <QFrame>

#include <QObject>

#include "swradio-constants.h"

QT_BEGIN_NAMESPACE

class QSettings;

class QObject;

class QWidget;

QT_END_NAMESPACE

//

// Rig implementations should implement ALL of the

31

Page 32: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

// abstract functions of this interface

class rigInterface :public QObject {

Q_OBJECT

public:

virtual QWidget *createPluginWindow (int32_t, QSettings *) = 0;

virtual ~rigInterface (void) = 0;

virtual int32_t getRate (void) = 0;

virtual void setVFOFrequency (int32_t) = 0;

virtual int32_t getVFOFrequency (void) = 0;

virtual bool legalFrequency (int32_t) = 0;

virtual int32_t defaultFrequency (void) = 0;

virtual bool restartReader (void) = 0;

virtual void stopReader (void) = 0;

virtual int32_t Samples (void) = 0;

virtual int32_t getSamples (DSPCOMPLEX *, int32_t, uint8_t) = 0;

virtual void exit (void);

signals:

// The following signals originate from the Winrad Extio interface

void set_ExtFrequency (int);

void set_ExtLO (int);

void set_lockLO (void);

void set_unlockLO (void);

void set_stopHW (void);

void set_startHW (void);

void set_changeRate (int);

//

void samplesAvailable (int);

};

QT_BEGIN_NAMESPACE

Q_DECLARE_INTERFACE(rigInterface, "sw radio/1.0")

QT_END_NAMESPACE

#endif

A valid plugin for handling a device should implement all functions (though there is no need toimplement signals other than the ”samplesAvailable” signal).

• createPluginWindow is as with the decoder interface. It will set up the GUI for the control ofthe device and initialize some functions. For both the Mirics devices and for thee DABsticks theinitialization code will load the required functions from the shared object (dll or .so) for the device.Currently, the first parameter is unused, the second is, as with the decoder plugin, referring tothe ”.ini” file that may contain some preferred settings.

• ˜rigInterface, is the virtual destructor, needed in case a real destructor is created for the devicehandling class.

• getRate will tell the main program - when asked for - the rate with which the data is sent out,either through a soundcard or an own AD converter.

• Frequencies are handled by setVFOFrequency and getVFOFrequency. The VFO of the device -possibly adapted by a locally maintained offset - is set resp. given back.

• legalFrequency will limit the set of frequencies to those that are valid for the particular device. Ingeneral, frequencies are checked on legality before being passed on to the VFO of the device.

32

Page 33: SDR-J-SW-7 Software for SDR : The 32 bits sw-receiver · September 21, 2015 ©: 2015, Jan van ... The dll-handler is thoroughly tested with the pmSDR and the elektor card. 2.2 Installation

• defaultFrequency returns the frequency on which the device is to be set on start up.

• restartReader is used to start the data transfer, stopReader to stop it. restartReader will returntrue if the start up is successful, false otherwise.

• Samples, when called, returns the amount of data that is in the buffers, ready to be transferred9

using getSamples. This latter function, taking a buffer, a requested amount and a mode (orderingof I and Q values) as parameter, returning the actual amount of data in the buffer.

• exit, when called will be called prior to deleting the input handler.

The main program will connect adequate slots to all signals that can be sent. These signals mainlyfollow from the interfacing to Winrad compatible dll’s, but some are used otherwise as well.

• set ExtFrequency is used by the external device to request the main program to set its mainfrequency on the frequency, given as parameter.

• set ExtLO is used by the external device to inform the main program that the actual VFO is setto the value of the parameter.

• set lockLO is used by the external device to inform the main program that changes in VFOfrequency are not allowed until

• set unlockLO is called.

• set stopHW is called to ask the main program to stop the processing, while

• set startHW is called to ask the main program to (re)start processing.

• set changeRate is called to inform the main program that the device (or its controlling software)has changed the sample-rate of the incoming data.

• samplesAvailable is used to signal the main program that data is available, the main program willthen start processing the data.

10 Final remarks

The SDR-J software depends on libraries, made available through (L)GPL style licenses while some ofthe algorithms and code is based on ideas of others. In all cases attempts are made to indicate therightfull owner of the copyrights. The software itself is available ”as is”, under a GPL V2 license.

This software is essentially the output of an ongoing hobby project. It is - obviously - not finished,after all it is software, and it is most unlikely that it ever will be finished. Many experiments are stillwaiting to be done, many enhancements to be made. Contributions in any form are welcomed: userand error reports, suggestions for extensions or improvements, but also contributions to code, and inparticular contributions to or donations for new equipment.

9Note that on a running system the amount of samples in the buffer when getSamples is used will be larger than theamount returned by a preceding call of Samples

33