Radarcape:Acarsdec: Difference between revisions
imported>Dl4mea |
imported>Dl4mea |
||
Line 26: | Line 26: | ||
</source> | </source> | ||
This will take some time. | 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 https://www.mail-archive.com/[email protected]/msg15617.html] | |||
===Install librtlsdr=== | ===Install librtlsdr=== |
Revision as of 17:21, 19 September 2014
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
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
Prepare Installation
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
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
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/2.4/acarsdec-2.4.tar.gz
tar xvf acarsdec-2.4.tar.gz
cd acarsdec-2.4
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:
- remove -D WITH_ALSA from the CFLAGS line. Next, I found that with some other 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<br>
modified: CFLAGS= -flto -O3 -ffast-math -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=neon -D WITH_RTL -D WITH_SNDFILE
- add the library librt to the linker libraries:
original: LDLIBS= -lm -pthread -lrtlsdr -lsndfile -lasound
modified: LDLIBS= -lm -pthread -lrtlsdr -lsndfile -lasound -lrt
For your convenience, I've put a modified MakefileRC onto my server, fetch that and execute it with make
wget http://www.modesbeast.com/resources/MakefileRC
make -f MakefileRC
You then should see some output like this:
root@radarcape:~/acarsdec-2.4#make -f MakefileRC
cc -flto -O3 -ffast-math -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=neon -D WITH_RTL -D WITH_SNDFILE -c -o main.o main.c
cc -flto -O3 -ffast-math -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=neon -D WITH_RTL -D WITH_SNDFILE -c -o acars.o acars.c
cc -flto -O3 -ffast-math -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=neon -D WITH_RTL -D WITH_SNDFILE -c -o msk.o msk.c
cc -flto -O3 -ffast-math -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=neon -D WITH_RTL -D WITH_SNDFILE -c -o rtl.o rtl.c
cc -flto -O3 -ffast-math -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=neon -D WITH_RTL -D WITH_SNDFILE -c -o output.o output.c
cc -flto -O3 -ffast-math -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=neon -D WITH_RTL -D WITH_SNDFILE -c -o soundfile.o soundfile.c
cc -flto -O3 -ffast-math -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=neon -D WITH_RTL -D WITH_SNDFILE -c -o alsa.o alsa.c
cc main.o acars.o msk.o rtl.o output.o soundfile.o alsa.o -o acarsdec -lm -pthread -lrtlsdr -lsndfile -lasound -lrt
root@radarcape:~/acarsdec-2.4#
In order to execute it for the first, time you should set LD_LIBRARY_PATH. For later restarts, 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
Prepare Installation
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.
Install librtlsdr
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
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/2.4/acarsdec-2.4.tar.gz
tar xvf acarsdec-2.4.tar.gz
cd acarsdec-2.4
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:
- remove -D WITH_ALSA from the CFLAGS line. Next, I found that with some other 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<br>
modified: CFLAGS= -flto -O3 -ffast-math -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=neon -D WITH_RTL -D WITH_SNDFILE
- add the library librt to the linker libraries:
original: LDLIBS= -lm -pthread -lrtlsdr -lsndfile -lasound
modified: LDLIBS= -lm -pthread -lrtlsdr -lsndfile -lasound -lrt
For your convenience, I've put a modified MakefileRC onto my server, fetch that and execute it with make
wget http://www.modesbeast.com/resources/MakefileRC
make -f MakefileRC
You then should see some output like this:
root@radarcape:~/acarsdec-2.4#make -f MakefileRC
cc -flto -O3 -ffast-math -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=neon -D WITH_RTL -D WITH_SNDFILE -c -o main.o main.c
cc -flto -O3 -ffast-math -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=neon -D WITH_RTL -D WITH_SNDFILE -c -o acars.o acars.c
cc -flto -O3 -ffast-math -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=neon -D WITH_RTL -D WITH_SNDFILE -c -o msk.o msk.c
cc -flto -O3 -ffast-math -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=neon -D WITH_RTL -D WITH_SNDFILE -c -o rtl.o rtl.c
cc -flto -O3 -ffast-math -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=neon -D WITH_RTL -D WITH_SNDFILE -c -o output.o output.c
cc -flto -O3 -ffast-math -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=neon -D WITH_RTL -D WITH_SNDFILE -c -o soundfile.o soundfile.c
cc -flto -O3 -ffast-math -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=neon -D WITH_RTL -D WITH_SNDFILE -c -o alsa.o alsa.c
cc main.o acars.o msk.o rtl.o output.o soundfile.o alsa.o -o acarsdec -lm -pthread -lrtlsdr -lsndfile -lasound -lrt
root@radarcape:~/acarsdec-2.4#
In order to execute it for the first, time you should set LD_LIBRARY_PATH. For later restarts, one time write /usr/local/lib into /etc/ld.so.conf, which will be active after the next reboot. (see: [2])
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