Radarcape:Acarsdec: Difference between revisions
imported>Dl4mea |
imported>Dl4mea |
||
Line 142: | Line 142: | ||
</source> | </source> | ||
This will take some time. | This will take some time. | ||
=acarsdec on the Radarcape (new but incomplete)= | =acarsdec on the Radarcape (new but incomplete)= |
Revision as of 10:49, 8 September 2016
acarsdec on the Radarcape
acarsdec is a software which uses a DVB-T stick in order to decode up to 4 channels ACARS signals within a 1MHz band segment. The Radarcape's front panel extension port may be used to plug such a DVB-T stick.
The decoding process requires some mathematical functions and obtains plenty of processing resources. Due to that it is not guaranteed to run on a heavily loaded Radarcape and/or together with Mode-AC or FR24 feeder. You may need to disable some features.
Installation requires some skills in handling a console but at the end is easy.
The original places where to find the used components are
- OsmoSDR and librtlsdr
- Acarsdec
- How to blacklist kernel modules
- ARM Cortex-A Processors and GCC Command Lines
You may need to use the command lsb_release -a in order to distinguish which Linux distribution is running on your Radarcape.
Installation on an Angstrom distribution based Radarcape (may work)
Prepare Installation (Angstrom)
First, you need to install build tools on the Radarcape.
opkg update
opkg install packagegroup-core-buildessential
opkg install cmake
opkg install libusb-1.0-dev
opkg install libsndfile-dev
sync
This will take some time.
If problems appear somehow around something that is led_aging or so, mind this link https://www.mail-archive.com/[email protected]/msg15617.html
Install librtlsdr (Angstrom)
Download one of the packaged releases: Look for the eventually greyed .tar.gz text, cut & paste the link of it and fetch it with wget on your Radarcape (in this case it is version 0.5.3, which was current while writing this descrition):
wget --no-check-certificate https://github.com/steve-m/librtlsdr/archive/v0.5.3.tar.gz
Untar/unpack it. Note that the filename eventually may differ for your download
tar xvf v0.5.3.tar.gz
As described here, navigate to ' Building with cmake: ' and follow these steps. You don't need sudo, as you are already root user on your Radarcape. The first command 'cd' must be adopted to what you have got as folder when unpacking your archive in the latest step.
cd librtlsdr-0.5.3
mkdir build
cd build
cmake ../
make
make install
ldconfig
Install acarsdec (Angstrom)
acarsdec source package can be found on sourceforge. There is a nice green button with the latest version, click on it and then look for the ' direct link ', which you should cut & paste, edit and execute with wget like shown below.
But before, with a simple cd, go back into your root folder. After uncompressing the archive, change to the folder that became created by tar
cd
wget http://downloads.sourceforge.net/project/acarsdec/acarsdec/3.0/acarsdec-3.0.tar.gz
tar xvf acarsdec-3.0.tar.gz
cd acarsdec-3.0
Now it comes... the complicated part is that ALSA lib is not necessary for the build here. Remove -D WITH_ALSA from the CFLAGS line. Next, I found that with different compiler options the CPU load is about one third of the original ones.
original: CFLAGS= -g -Ofast -ftree-vectorize -funroll-loops -pthread -D WITH_RTL -D WITH_SNDFILE -D WITH_ALSA
modified: CFLAGS= -g -O3 -flto -funroll-loops -ffast-math -pthread -D WITH_RTL -D WITH_SNDFILE
You then should see some output like this:
root@beaglebone:~/acarsdec-3.0# make
cc -O3 -flto -ffast-math -funroll-loops -pthread -D WITH_RTL -D WITH_SNDFILE -c -o acarsdec.o acarsdec.c
cc -O3 -flto -ffast-math -funroll-loops -pthread -D WITH_RTL -D WITH_SNDFILE -c -o acars.o acars.c
cc -O3 -flto -ffast-math -funroll-loops -pthread -D WITH_RTL -D WITH_SNDFILE -c -o msk.o msk.c
cc -O3 -flto -ffast-math -funroll-loops -pthread -D WITH_RTL -D WITH_SNDFILE -c -o rtl.o rtl.c
cc -O3 -flto -ffast-math -funroll-loops -pthread -D WITH_RTL -D WITH_SNDFILE -c -o output.o output.c
cc -O3 -flto -ffast-math -funroll-loops -pthread -D WITH_RTL -D WITH_SNDFILE -c -o soundfile.o soundfile.c
cc -O3 -flto -ffast-math -funroll-loops -pthread -D WITH_RTL -D WITH_SNDFILE -c -o alsa.o alsa.c
cc acarsdec.o acars.o msk.o rtl.o output.o soundfile.o alsa.o -o acarsdec -lm -pthread -lrtlsdr -lsndfile -lasound
In order to execute it for the first, time you need to set LD_LIBRARY_PATH. For later restarts, this one time write /usr/local/lib into /etc/ld.so.conf, which will be active after the next reboot. (see: [1])
echo "/usr/local/lib" > /etc/ld.so.conf
ldconfig
export LD_LIBRARY_PATH=/usr/local/lib
Execute acarsdec. My stick has +79ppm offset and the gain is fixed to 40dB. With the 3 channels that are active within the decodeable 1MHz segment here, the CPU load is just 35%. That fits to a running Radarcape, if not too busy with Mode-AC. In case of doubts, open another ssh terminal and execute htop command there.
The command needs to be modified for networking according to its original description if you like to send decoded messages to other computers.
./acarsdec -o1 -v -p 79 -g 400 -r 0 131.525 131.725 131.825
And now you will see its output.
Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Tuner gain : 40.200000
Set center freq. to 131850000Hz
Exact sample rate is: 1000000.026491 Hz
Decoding 3 channels
#2 too many parity errors
#3 (L:-21 E:0) 02/01/2000 04:25:07 .OY-KBH SK0610 2 B9 M36A /EKCH.TI2/040EKCHAC5B3
#1 (L:-20 E:0) 02/01/2000 04:25:12 .D-AILA LH03RV R 1L M74A 02467226782VUYY93,EBB*14GK0
#2 parity error(s): 2
#2 crc error
#2 not able to fix errors
#3 (L:-21 E:0) 02/01/2000 04:25:14 .OY-KBH SK0610 2 _d S88A
#1 (L:-25 E:0) 02/01/2000 04:25:17 .G-BNWM BA0155 2 Q0 S09A
#1 (L:-20 E:0) 02/01/2000 04:25:18 .D-AILA LH03RV R _d S35A
#1 (L:-19 E:0) 02/01/2000 04:25:21 .D-AILA LH03RV R _d S36A
#2 (L:-28 E:0) 02/01/2000 04:25:22 .D-AICC DE03FC X _d S58A
#2 (L: -3 E:0) 02/01/2000 04:25:29 .PH-TFC OR0717 E Q0 S11A
#3 (L:-22 E:0) 02/01/2000 04:25:29 .OY-KBH SK0610 2 _d S89A
Installation on a Debian distribution based Radarcape (obsolete)
Prepare Installation (obsolete)
First, you need to install build tools on the Radarcape.
apt-get update
apt-get upgrade
apt-get install build-essential
apt-get install cmake
apt-get install libusb-1.0-0-dev
apt-get install libsndfile1-dev
sync
This will take some time.
acarsdec on the Radarcape (new but incomplete)
acarsdec is a software which uses a DVB-T stick in order to decode up to 4 channel with ACARS signals within a 1MHz band segment. The front panel extension port of the Radarcape may be used to plug such a DVB-T stick.
The decoding process requires some mathematical functions and obtains plenty of processing resources. Due to that it is not guaranteed to run on a heavily loaded Radarcape and/or together with Mode-AC or FR24 feeder. You may need to disable some features.
Also, this is only valid for Radarcape with Debian, not for those still on Angstrom. Angstrom is outdated. Check the System Status page of your Radarcape for this information.
Installation requires some skills in handling a console but at the end is easy.
The original places where to find the used components are
Installation on a Debian distribution based Radarcape
Prepare Installation
First, you need to install build tools on the Radarcape. You may need to enter one line after the other separately.
apt-get update
apt-get upgrade -y
apt-get install -y build-essential cmake git libusb-1.0-0-dev
sync
This will take some time.
Install librtlsdr
Install rtl-sdr library. You need to blacklist the kernel DVB-T stick driver before using this new driver.
echo blacklist dvb_usb_rtl28xxu >> /etc/modprobe.d/fbdev-blacklist.conf
Then you are ready to build and install the library.
git clone git://git.osmocom.org/rtl-sdr.git
cd rtl-sdr
mkdir build
cd build
cmake ../ -DINSTALL_UDEV_RULES=ON
make
make install
ldconfig # Francis Breame reports that this is required
cd ..
cp -v rtl-sdr.rules /etc/udev/rules.d/
sync
After this step, reboot your Radarcape without DVB-T stick connected. Wait a few 10 seconds, plug your stick and check with command dmesg if the stick became recognized correctly:
Next, check with the command rtl_test if it works:
root@rc66:~# rtl_test
Found 1 device(s):
0: Realtek, RTL2838UHIDIR, SN: 00000001
Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Supported gain values (29): 0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7 20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6
[R82XX] PLL not locked!
Sampling at 2048000 S/s.
Info: This tool will continuously read from the device, and report if
samples get lost. If you observe no further output, everything is fine.
Reading samples in async mode...
lost at least 232 bytes
One 'lost' message is ok during startup, but there should none appear later.
Install acarsdec
With a simple cd command, go back into your root folder.
acarsdec source package can be found on sourceforge. There is a green button with the latest version, click on it and then look for the ' direct link ', which you should cut & paste, edit and execute with wget like shown below.After uncompressing the archive, change to the folder that became created by tar.
Note that at the time of writing version 3.2 was latest, it might be different sometimes later.
cd
wget http://downloads.sourceforge.net/project/acarsdec/acarsdec/3.2/acarsdec-3.2.tar.gz
tar xvf acarsdec-3.2.tar.gz
cd acarsdec-3.2
Now it comes... the complicated part is that ALSA lib is not necessary for the build here, and it seems that the Angstrom distribution that is used on the Radarcape has a different library structure.
That means you need to edit the Makefile:
- comment out all lines with CFLAGS with a # sign in the first column.
- insert a new CFLAGS line
CFLAGS= -g -O3 -flto -mcpu=cortex-a8 -mfpu=vfpv3 -ffast-math -funroll-loops -pthread -D WITH_RTL -D WITH_SNDFILE
- in the line showing LDLIBS, remove -lasound, so it looks like
modified: LDLIBS= -lm -pthread -lrtlsdr
Start compilation with the command make
You then should see some output like this:
root@radarcape:~/acarsdec-3.2# make
cc -g -O3 -flto -mcpu=cortex-a8 -mfpu=vfpv3 -ffast-math -funroll-loops -pthread -D WITH_RTL -D WITH_SNDFILE -c -o acarsdec.o acarsdec.c
cc -g -O3 -flto -mcpu=cortex-a8 -mfpu=vfpv3 -ffast-math -funroll-loops -pthread -D WITH_RTL -D WITH_SNDFILE -c -o acars.o acars.c
cc -g -O3 -flto -mcpu=cortex-a8 -mfpu=vfpv3 -ffast-math -funroll-loops -pthread -D WITH_RTL -D WITH_SNDFILE -c -o msk.o msk.c
cc -g -O3 -flto -mcpu=cortex-a8 -mfpu=vfpv3 -ffast-math -funroll-loops -pthread -D WITH_RTL -D WITH_SNDFILE -c -o rtl.o rtl.c
cc -g -O3 -flto -mcpu=cortex-a8 -mfpu=vfpv3 -ffast-math -funroll-loops -pthread -D WITH_RTL -D WITH_SNDFILE -c -o air.o air.c
cc -g -O3 -flto -mcpu=cortex-a8 -mfpu=vfpv3 -ffast-math -funroll-loops -pthread -D WITH_RTL -D WITH_SNDFILE -c -o output.o output.c
cc -g -O3 -flto -mcpu=cortex-a8 -mfpu=vfpv3 -ffast-math -funroll-loops -pthread -D WITH_RTL -D WITH_SNDFILE -c -o alsa.o alsa.c
cc acarsdec.o acars.o msk.o rtl.o air.o output.o alsa.o -o acarsdec -lm -pthread -lrtlsdr
Execute acarsdec. It might be good if you don't see messages from specific frequency to leave them out from decoding. The command also needs to be modified for networking according to its original description if you like to send decoded messages to other computers.
./acarsdec -o1 -v -p 79 -g 400 -r 0 131.725
And now you will see its output.
root@radarcape:~/acarsdec-3.2# ./acarsdec -o1 -v -p 79 -g 400 -r 0 131.525 131.725 131.825
Found 1 device(s):
0: Realtek, RTL2838UHIDIR, SN: 00000001
Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Tuner gain : 40.200000
Set center freq. to 131750000Hz
Exact sample rate is: 2500000.107620 Hz
Decoding 1 channels
#1 (L:-32 E:0) 08/09/2016 10:34:58 .A6-EDU EK0015 2 Q0 S76A
#1 (L:-38 E:0) 08/09/2016 10:34:59 .PH-BXK KL1652 G 10 M67A ETA93A08103456KLM1652 LIPZEHA
#1 too many parity errors
#1 (L:-33 E:0) 08/09/2016 10:35:06 .A6-EDU EK0015 2 Q0 S76A