SDR-J-DAB 0.99 (revised) Software for SDR: the … · SDR-J-DAB 0.99 (revised) Software for SDR:...

10
SDR-J-DAB 0.99 (revised) * Software for SDR: the DAB receiver Jan van Katwijk Lazy Chair Computing The Netherlands [email protected] October 1, 2015 * ©: 2015, Jan van Katwijk, Lazy Chair Computing 1

Transcript of SDR-J-DAB 0.99 (revised) Software for SDR: the … · SDR-J-DAB 0.99 (revised) Software for SDR:...

Page 1: SDR-J-DAB 0.99 (revised) Software for SDR: the … · SDR-J-DAB 0.99 (revised) Software for SDR: the DAB receiver Jan van Katwijk ... cross compilation suite - to Windows. Di erences

SDR-J-DAB 0.99 (revised)∗

Software for SDR: the DAB receiver

Jan van KatwijkLazy Chair Computing

The [email protected]

October 1, 2015

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

1

Page 2: SDR-J-DAB 0.99 (revised) Software for SDR: the … · SDR-J-DAB 0.99 (revised) Software for SDR: the DAB receiver Jan van Katwijk ... cross compilation suite - to Windows. Di erences

1 Introduction

The DAB program is a software program for decoding DAB and DAB+. The program runsunder Windows and Linux, it is developed under Linux and cross compiled - using the Mingw64cross compilation suite - to Windows.

Differences between version 0.99 and previous versions The software now uses theQt5 library, rather than the Qt4 library that was used in the previous versions.

Other modifications to the DAB software, when compared to the previous versions, relateto performance. Several parts of the DAB software were rewritten and the GUI was adapted,such that the DAB program is less resource hungry when running and is compiled for (andwill run on) 32 bits windows.

Since the program now runs on 32 bits windows, it was possible to create an interface to”extIO XXX” supported devices. As the front page shows, the SDRplay works fine throughthe ”extIO-SDRplay” interface. It was also tested with the ”extIO-RTL.dll” as shown below.

Furthermore, the user interface is reduced in size, also shown in the picture, and finally, thanksto Stefan Poeschel, the problems with the interface with the faad library were solved.

As stated, the software now supports ”extIO-XXX” dll’s, next to that, the embeddedsupport for the SDRplay and the RT2832 based sticks in the Windows version is still available.

For the Linux version the configuration file now can be told to include or exclude thesedevices.

Other Platforms The software runs successfully under Windows 7 and Linux. It is devel-oped under Linux (Fedora 21) and is cross compiled for Windows. An attempt is underwayto see whether the software will run on a Raspberry. It will definitely not run on a RaspberryA or B. On an RPI 2 (under Arch Linux) the software was successfully compiled and showssome signs of life, when running however, one of the cores shows a load of 100% and too manyinput samples are lost. The next attempt will be to redistribute the load over more processorcores, but there are no garantees.

2

Page 3: SDR-J-DAB 0.99 (revised) Software for SDR: the … · SDR-J-DAB 0.99 (revised) Software for SDR: the DAB receiver Jan van Katwijk ... cross compilation suite - to Windows. Di erences

2 Installation

The DABreceiver software comes - as usual - in two flavors: for Windows there is a singlezipped folder containing the executable of DAB program as well as some of the required dlls.For Linux, sources are available and one has to create the executables.

2.1 Installation under Windows

Just unpack the zipped file. A folder windows32-bin-dab will be created that contains theexecutables and (almost) all required ”.dll”’s. The name of the executable is ”sdr-j-dabreceiver-0.99.exe”.

The extIO SDRplay.dll can - together with the SDRplay API - be installed from ”www.sdrplay.com”,the extIO RTL.dll is found in a variety of places. It is the responsibility of the user to ensurethat the appropriate dll’s are loaded.

Note that we need an outputrate of 2048000 IQ samples/second, so it is imperative thatthe device delivers through the extIO XXX.dll a sufficient amount of samples. For the ex-tIO SDRplay, samples are converted from 2000000 Samples/second to the required rate1. Forthe extop RTL.dll, the samples are converted from a rate 2.4M to the required rate. A devicethat delivers a rate lower than 1900000 samples/second will not be accepted.

2.2 Installation under Linux

For developing executables under Linux, the packed sources are available. A brief descriptionof building for Linux is given in section 4 of this manual.

3 Running the DABreceiver

Starting the program is by clicking on its icon or using a command line in a command windowwith the (path)name of the program.

Starting the program will set it in an idle state. Before processing can start, one has toselect a device through clicking on an entry on the appropriate combobox. Supported devicesare:

• no device. No input device will be selected, input will consist of nothing;

• ”.raw” file input. A file selection menu is displayed for selecting a file with extension”.raw”. The raw bytes in this file will be the input. Such a file could have been generatedby previous versions of the DABreceiver software. Current ”dumping” creates an ”.sdr”file.

• ”.sdr” file input. A file selection menu is displayed for selecting an input file. Notethat only ”.sdr” files (i.e. with ”wav” files with the correct samplerate (2048000) and 2channels) will be accepted.

1Note that signals from the dll are ignored, it is assumed that the default setting is taken

3

Page 4: SDR-J-DAB 0.99 (revised) Software for SDR: the … · SDR-J-DAB 0.99 (revised) Software for SDR: the DAB receiver Jan van Katwijk ... cross compilation suite - to Windows. Di erences

• rtl tcp. Input can be taken from an rtl tcp server. The feature obviously requires a fastconnection to the server. It was tested using a wired connection with the server runningon an RPI2, and the client on my regular laptop.

• Windows only: extio. A file selection menu will show up on which an appropriate ex-tIO XXX.dll can be selected.

• SDRplay. A Mirics SDRplay as input device is assumed to be connected to an USB port.Output of the SDRplay device - and thus program input - consists of a raw stream of 10bit integer values, mapped onto complex I/Q samples by the software.

• DABstick. A DAB-stick as input device is assumed to be connected to an USB port.DAB-stick output - and thus program input - consists of a raw byte stream, mappedonto complex I/Q samples by the software.

If/when a device is selected a small window will appear with settings specific to the device,i.e. gain, offsets etc.

The DAB program uses an ”.ini” file, $(HOME)/.jsdr-dab.ini for obtaining some stateinformation from previous sessions and for some general configuration data. Absence of the”.ini” file (as will be the case in most cases on a first invocation of the program) will not harmthe program, just some (seemingly) suitable default values will be chosen and - after normalprogram termination - the ”.ini” file will be created.

It is common practice to just start the programs and quit it to obtain an ”.ini” files withdefault values.

4

Page 5: SDR-J-DAB 0.99 (revised) Software for SDR: the … · SDR-J-DAB 0.99 (revised) Software for SDR: the DAB receiver Jan van Katwijk ... cross compilation suite - to Windows. Di erences

After having selected a device (selector labeled ”1”), the user of the DABreceiver may selecta Mode (selector labeled ”4”), a band (selector labeled ”3”), and a channel (selector labeled”2”). The channels map onto the standardized frequencies for the DAB channels in the selectedband.

Mode is by default set to Mode ”1”, band to ”III”.Actual running of the program will start after pressing the ”START” button (labeled ”5”).

When started, the DABreceiver will to try to synchronize with the incoming data: this maytake (quite) some time, depending on the quality of the received signal. In general, as soonas there is time synchronization, one will see dots of the signal will show in the black screen.The more the collection of dots resembles a large ’X’, the better the quality of the signal. Theexecution of the program can be stopped by pressing the ”QUIT” button (labeled ”6”)

When synchronized, the program will try to identify the name of the ensemble and thenames of the programs encoded within the ensemble. As soon as correct data is found, thenames of the stations covered by the ensemble will be displayed (labeled ”8”).

Selecting a particular station in the list is by clicking with the mouse on it. Decoding willstart and might lead to sound output.

An output channel is selected using button labeled ”9”. Saving the intermediate outputcan be done by pressing button labeled ”12” for MP2 output or button labeled ”13” for AACoutput. In either case a file selection menu will appear with which a file can be selected.Pressing the button again will close the file.

The resulting audio (48000 Hz, stereo) can be saved in a file by pressing button labeled”10”. The input - transformed to a samplerate of 2048000 - can be saved into an ”.sdr” file bypressing button labeled ”11”. Again, pressing the button for the second time will cause closingthe file.

Pressing button ”7” will cause the software to resynchronize.The slider below the black colored block can be used to enlarge the figure shown on the

black ”scope”.To the right of the black scope, two numbers show. The first one is the estimated length -

in samples - of a frame, this should be 196608. The second one is 2048000, the samplerate.The two numbers shown above the button panel show the ”small” frequency offset resp. the

”large” frequency offset. When synchronized, the ”large” freqency offset will remain constant,the ”small” frequency offset might change continuously, depending on the reception conditions.Especially when the count of the framelength deviates from the 196608 what is should be, thesystem will ”see” a VFO offset and will compensate that. (Especially for users of the DABstick:

5

Page 6: SDR-J-DAB 0.99 (revised) Software for SDR: the … · SDR-J-DAB 0.99 (revised) Software for SDR: the DAB receiver Jan van Katwijk ... cross compilation suite - to Windows. Di erences

the offset can be quite large due to an offset in the oscillator. One is advised to correct thisusing the ”ppm” selector for the device.)

The numbers on the bottom line left indicate:

• the estimated SNR, an SNR of 15 and more is good.

• the success rate of FIC decoding, 100 is good,

• the success rate of AAC (or for ”old” DAB mp2) decoding, 100 is good.

Information on the received program is in the top lines of the GUI.

The ”.ini” file Many of the settings for the DABreceiver will be read from the ”.ini” file onprogram startup. If no ”.ini” file exists (yet), suitable defaults for the various sliders and selec-tors are chosen. The default location for the ”.ini” file for the DABreceiver is $(HOME)/.jsdr-dab.ini2. The file contains entries

[General]

Concurrent=1

autoCorrector=1

band=BAND III

channel=11C

device=xxx

iqDisplaysize=512

Concurrent is not settable through the GUI, it tells to run the MPEG decoder in a differentthread (value 1) or in the same thread as the rest of the dab decoding (value 0). On a machinewith many computing cores, there is a slight gain in efficiency when concurrent execution isselected.

iqDisplaySize indicates the number of points used to create the X on the scope. This sizecannot be altered throug the GUI.

autoCorrector is a boolean value (0 : false, 1 : true). When set the program tries to detectthe correct coarse offset for the selected frequency. When not set, the GUI selectors have tobe used for course synchronization. This setting, default set to 1, cannot be altered throughthe GUI.

The ”.ini” file will also contain settings for the selected devices (not shown here).

4 Building the executables under Linux

Unpacking the sources of the distribution is in a single directory systems with as subdirectory(a.o) sdr-j-dabreceiver-0.993. This directory contains sbdirectories

• src, where the sources are kept, and

• includes, where the include files reside.

2Calling the program with -i filename will make the file filename the ”.ini” file3In this distribution sources of all programs are packaged in a single ”.tgz” file

6

Page 7: SDR-J-DAB 0.99 (revised) Software for SDR: the … · SDR-J-DAB 0.99 (revised) Software for SDR: the DAB receiver Jan van Katwijk ... cross compilation suite - to Windows. Di erences

The directory contains (a.o) a file CMakeLists.txt and a file sdr-j-dabreceiver-099.pro. Theformer contains data for using cmake as generating device, the latter contains data for QMakeas generating device.

Required packages and Libraries One needs, next to the GNU compiler suite (g++),

• Qt5.x

• Qwt 6.x.x. The sources, developed under Fedora, are based on Qwt 6.1.0. Note thatinstalling a qwt-6 library that is cooperating with Qt5 turned out to be virtually impossibleunder Ubuntu-14.04 (LTS). The regular repositories provide a qwt-6 that is compatiblewith Qt4.

• libusb-1.0,

• libportaudio. Ubuntu 14.04 LTS still supports libportaudio-1.18, as stan-dard package. Replace this with 1.19, which is easy using a packagehandler.

• libsndfile,

• libfftw3f, we use floats in this version,

• libfaad,

For these packages, one needs both the library and the development package.

Ubuntu For Ubuntu (15.04) a validity check is given in the shell script below

#!/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 \

libfaad2 libfaad-dev

Different versions of Ubuntu use different naming schemes and pathnames for qwtand Qt.

7

Page 8: SDR-J-DAB 0.99 (revised) Software for SDR: the … · SDR-J-DAB 0.99 (revised) Software for SDR: the DAB receiver Jan van Katwijk ... cross compilation suite - to Windows. Di erences

Fedora For Fedora, depending on the distribution, the following script might help

#!/bin/bash

#

echo "Preparing the environment for Fedora"

echo " "

echo "install packages"

sudo yum install gcc gcc-c++ \

qt qt-devel 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 \

rtlsdr rtlsdr-devel \

faad2-devel

Note that Fedora (at least recent versions) provide for a package rtlsdr in their repositories.

Mirics SDRplay Mirics Ltd provides on its SDRplay site www.sdrplay.com an installer forlibmirsdrapi-rsp.so. The library will be installed in /usr/local/lib.

librtlsdr In most cases librtlsdr is indeed available and can be installed through the mecha-nisms available with the Linux distribution. In case the library is not available, a descriptionof the library and how to build it is to be found on the osmocom site

http://sdr.osmocom.org/trac/wiki/rtl-sdr

Note that, under Ubuntu 14.04 the kerneldriver dvb usb rtl28xxu needs to be put on the black-list. An option is to compile the sources with ”DETACH KERNEL DRIVER” defined.

Qmake and CMake The current distribution was built using qmake-qt5 as generator forMakefiles. qmake will use the .pro file as basis.

Next to a ”.pro” file, a CMakeLists.txt is available for use with CMake.Both the ”CmakeLists.txt” and the ”.pro” file provides options to include or exclude sup-

port for devices. Iff support for a device is included, it is assumed that the supporting libraryand include file(s) for that device are available.

Compiling the sources under Arch Linux on an RPI2 was without any problem (well,as states earlier, for successful running the software on this machine some reworking of thesoftware still has to be done). Other Linux distributions most likely will provide the full setof packages required for building, probably on other locations, in which case the ”.pro” resp.or CMakeLists.txt files may need to be adapted to the particularities of the different Linuxdistributions.

When all libraries (including the corresponding ”include” files) are in place, for use withqmake, one executes

qmake-qt4

make

8

Page 9: SDR-J-DAB 0.99 (revised) Software for SDR: the … · SDR-J-DAB 0.99 (revised) Software for SDR: the DAB receiver Jan van Katwijk ... cross compilation suite - to Windows. Di erences

to generate the executable, which will be put in the directory mentioned as value of the DESTvariable.

In case CMake is used for building an executable, one creates an empty directory ”build”and calls ”cmake ..”.

mkdir build

cd build

cmake ..

make

sudo make install

The executable will then be created and installed in ../../linux-bin.It it obviously wise to ensure rights for reading and writing usb port and soundcards before

running the program. One may use the instructions given on the aforementioned osmocompage, installation instructions for the Mirics dongle or SDRplay.

Selecting devices when building Device support to be compiled in can be selected bycommenting out or uncommenting. In the sdr-j-dabreceiver-0.99.pro file, the lines

CONFIG += dabstick

CONFIG += sdrplay

#CONFIG += dongle

CONFIG += rtl_tcp

indicate that by default support for these devices is compiled into the executable. Commentingout a line before building will ensure that the software support for that particular device willnot be included in the executable.

The CMake file contains a section

######################################################################

# R E A D T H I S

#####################################################################

# adjust to your likings

# if you want to use the SSE support on your machine, uncomment

# set(NO_SSE_SUPPORT true)

#

# if you want support for any of these devices, uncomment the line

set(SDRPLAY true)

set(DABSTICK true)

# set(DONGLE true)

# set(RTLTCP true)

########################################################################

for the same purpose. The default setting is that the support for the rtl tcp entry is notincluded, while support for the SDRplay and the DABSTICK is.

9

Page 10: SDR-J-DAB 0.99 (revised) Software for SDR: the … · SDR-J-DAB 0.99 (revised) Software for SDR: the DAB receiver Jan van Katwijk ... cross compilation suite - to Windows. Di erences

5 Final remarks

The SDR-J software uses a number of libraries, made available through (L)GPL style licensesand parts of the code is based on ideas of others. In all cases attempts are made to indicatethe rightfull owner of the copyrights. The software itself is available as is, under a GPL V2license.

The SDR-J set of software is essentially the result of a hobby project. It is - obviously -not finished, after all it is software and it is most likely that it never will be finished. Manyenhancements (and experiments) are still waiting to be done.

Contributions in any form are always welcome. For suggestions for extensions, contributionsto code, or preferably donations for further development contact the author.

10