FlightAware Discussions

How-to Feed Plane Plotter Site directly from Raspberry Pi

#21

Nope didn’t work :frowning: still the same error.

I just copied and overwrite coaa.h to the ppup folder.

Here is the log:
gcc -O2 -g -Wall -W pkg-config --cflags librtlsdr -c ppup1090.c
gcc -O2 -g -Wall -W pkg-config --cflags librtlsdr -c anet.c
gcc -O2 -g -Wall -W pkg-config --cflags librtlsdr -c interactive.c
gcc -O2 -g -Wall -W pkg-config --cflags librtlsdr -c mode_ac.c
gcc -O2 -g -Wall -W pkg-config --cflags librtlsdr -c mode_s.c
gcc -O2 -g -Wall -W pkg-config --cflags librtlsdr -c net_io.c
gcc -g -o ppup1090 ppup1090.o anet.o interactive.o mode_ac.o mode_s.o net_io.o coaa1090.obj pkg-config --libs librtlsdr -lpthread -lm

pi@piaware:~/ppup $ ./ppup1090
Error 0xFFFFFFFE initialising uploader

#22

Can you show the (regno and authcode redacted) output of:

cat coaa.h

Or you can just check yourself if the contents look correct.

I’m not sure what else it might be but that file seems like the most likely culprit.

#23

This is the inside of coaa.h (I changed my real numbers to ‘x’)

//coaa.h configuration file for John Leo Navarro 2019-03-12 15:35:49
#define USER_REGNO xxx
#define USER_AUTHCODE xxxxxxxxx
#define USER_LATITUDE xxxxxxxxx
#define USER_LONGITUDE xxxxxxxxxx

#24

Yeah i’m trying to reproduce the error but the only way i find to do that is to have bad data it coaa.h

For example if the #define USER_REGNO is only 3 digits, i get the same error.
Maybe the file they sent you is just faulty?

To double check that, can you try with the following in coaa.h:

#define USER_REGNO 234333
#define USER_AUTHCODE 23443543543
#define USER_LATITUDE 50.0
#define USER_LONGITUDE 10.0

It will not really allow you to upload data but it is just for testing.
(The application will start without error for me.)
To recompile you can use this command:

make -f makeppup1090 -B
1 Like
#25

Your Test Code Works!!! hahahaha guess your right, its a problem on my coaa.h, not my fault though since they (COAA) are the one who created my coaa.h file :rofl:

I might request a new one tho, thank you for your help!

3 Likes
#26

Remember you have to wait one minute to see output or upload.

#27

An alternate (and better) method to start ppup1090 at boot is to create ppup1090.service file and enable it, so that ppup1090 is started by systemd instead of rc.local.

This method has following advantages:

  1. It makes starting of ppup1090 to wait till dump1090-fa, or dump1090-mutability starts.
  2. The user can control & monitor ppup1090 by systemctl commands.

The systemd method given below completely replaces following item of Post #1:
"(3) Make ppup1090 to auto-start at boot"

NOTE:
If you have already implemented rc.local startup of Post #1, and want to switch to systemd startup given below, first disable the rc.local startup by following steps:

(1) Open file rc.local to edit

sudo nano /etc/rc.local

(2) From the file opened, delete following line:

/home/pi/ppup/ppup-maint.sh &

(3) Save (Ctrl+o) and Close (Ctrl+x)

(4) Reboot RPi
sudo reboot

.

STEP BY STEP METHOD FOR STARTUP BY SYSTEMD

1 - Create system user ppup1090 which will start the service automatically at boot.

sudo useradd --system ppup1090  

.

2 - Create a blank file ppup1090.service in folder /lib/systemd/system/ppup1090.service

sudo nano /lib/systemd/system/ppup1090.service 

.

3 - Copy-paste following code in this blank file

Note-1: following 2 versions of code are identical, except for the line starting with After=

Note-2: Noted that systemd-journal continously runs & generates plane upload log. To overcome this and reduce cpu & memory usage, I have added --quiet at end of the line ExecStart=/home/pi/ppup/ppup1090.

`
.

IF USING DUMP1090-FA

Applies to:

  • Piaware SD Card image (which has dump1090-fa pre-installed).
  • Raspbian image with dump1090-fa package install.
# planeplotter uploader service for systemd
# create in /lib/systemd/system/
# then install in /etc/systemd/system/default.target.wants/ 
# by command: sudo systemctl enable ppup1090.service

[Unit]
Description=PlanePlotter Raspberry Pi uploader
Wants=network-online.target
After=dump1090-fa.service network-online.target time-sync.target

[Service]
User=ppup1090
RuntimeDirectory=ppup
ExecStart=/home/pi/ppup/ppup1090 --quiet
ExecReload=/bin/kill -HUP $MAINPID
Type=simple
Restart=on-failure
RestartSec=30
# exit code 4 means login failed
# exit code 6 means startup failed
RestartPreventExitStatus=4 6

[Install]
WantedBy=default.target

Save (Ctrl+o) and close (Ctrl+x)

.

IF USING DUMP1090-MUTABILITY

Applies to:

  • Raspbian image with dump1090-mutability ver 1.15~dev package install
  • PI24 image (which has dump1090-mutability ver 1.14 pre-installed)
# planeplotter uploader service for systemd
# create in /lib/systemd/system/
# then install in /etc/systemd/system/default.target.wants/ 
# by command: sudo systemctl enable ppup1090.service

[Unit]
Description=PlanePlotter Raspberry Pi uploader
Wants=network-online.target
After=dump1090-mutability.service network-online.target time-sync.target

[Service]
User=ppup1090
RuntimeDirectory=ppup
ExecStart=/home/pi/ppup/ppup1090 --quiet
ExecReload=/bin/kill -HUP $MAINPID
Type=simple
Restart=on-failure
RestartSec=30
# exit code 4 means login failed
# exit code 6 means startup failed
RestartPreventExitStatus=4 6

[Install]
WantedBy=default.target

Save (Ctrl+o) and close (Ctrl+x)

.

4 - Enable service by following command

sudo systemctl enable ppup1090.service  

sudo systemctl restart ppup1090

.

5 - Check status after few minutes

pi@raspberrypi:~ $ sudo systemctl status ppup1090
● ppup1090.service - PlanePlotter Raspberry Pi uploader
   Loaded: loaded (/lib/systemd/system/ppup1090.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2019-03-17 04:36:59 EDT; 5min ago
 Main PID: 860 (ppup1090)
   CGroup: /system.slice/ppup1090.service
           └─860 /home/pi/ppup/ppup1090 --quiet

Mar 17 04:36:59 raspberrypi systemd[1]: Started PlanePlotter Raspberry Pi uploader.

.

6 - Commands to control & monitor

sudo systemctl restart ppup1090   

sudo systemctl stop ppup1090   

sudo systemctl status ppup1090  

.

3 Likes
#28

Thanks for this great posting; it sure helped me get everything running, feeding both FA and Planeplotter. I am using piaware 3.7.1, dump1090-fa and dump978-fa, 2 dongles, and the systemd start method. Works great after boot. Except for one problem. I know this is an old thread but maybe someone can help.

Periodically, every few days, or several times a day, something happens and dump1090 gets an error talking to the dongle (I believe). Piaware seems to recover by restarting dump1090-fa and faup1090 and all is well for FA. (yes, this may indicate a different problem that should not be happening anyway. Could be power related with 2 dongles, but I am using a current official Pi power supply, and a Pi2b.)

The problem is that when dump1090-fa restarts, it breaks the connection to ppup1090. ppup1090 continues to run, but is not really talking to the PlanePlotter servers any more. Manually restarting ppup1090 seems to restore the connections and all is well.

Is there a good way to restart ppup1090 (after a short delay) when dump1090-fa is restarted, using systemd methods? Or better to just make a script to start dump1090-fa, sleep, then start ppup1090, and call that in the dump1090-fa.service file instead of starting dump1090 and ppup1090 alone, each in their own service files?

For reference, here is the syslog when the restarts and ppup1090 failure occurs:

May 24 16:02:01 piaware CRON[13913]: (root) CMD (bash graphs1090.sh 6h >/dev/null 2>&1)
May 24 16:03:01 piaware CRON[14097]: (root) CMD (bash graphs1090.sh 24h >/dev/null 2>&1)
May 24 16:03:14 piaware dump1090-fa[8117]: cb transfer status: 1, canceling...
May 24 16:03:14 piaware dump1090-fa[8117]: rtlsdr: rtlsdr_read_async returned unexpectedly, probably lost the USB device, bailing out
May 24 16:03:14 piaware dump1090-fa[8117]: Fri May 24 16:03:14 2019 EDT  Waiting for receive thread termination
May 24 16:03:14 piaware dump1090-fa[8117]: Reattaching kernel driver failed!
May 24 16:03:14 piaware dump1090-fa[8117]: Fri May 24 16:03:14 2019 EDT  Abnormal exit.
May 24 16:03:14 piaware kernel: [102376.436831] dvb_usb_rtl28xxu 1-1.4:1.0: chip type detection failed -71
May 24 16:03:14 piaware kernel: [102376.436885] dvb_usb_rtl28xxu: probe of 1-1.4:1.0 failed with error -71
May 24 16:03:14 piaware rc.local[495]: Fri May 24 16:03:14 2019 Lost connection to localhost:30005
May 24 16:03:14 piaware systemd[1]: dump1090-fa.service: Main process exited, code=exited, status=1/FAILURE
May 24 16:03:14 piaware rc.local[495]: Fri May 24 16:03:14 2019 Reconnecting in 30.0 seconds
May 24 16:03:14 piaware rc.local[495]: Fri May 24 16:03:14 2019 Beast-format results connection with ::1:30104: connection lost
May 24 16:03:14 piaware systemd[1]: dump1090-fa.service: Unit entered failed state.
May 24 16:03:14 piaware systemd[1]: dump1090-fa.service: Failed with result 'exit-code'.
May 24 16:03:15 piaware kernel: [102376.586948] usb 1-1.4: USB disconnect, device number 9
May 24 16:03:15 piaware kernel: [102376.883371] usb 1-1.4: new high-speed USB device number 10 using dwc_otg
May 24 16:03:15 piaware kernel: [102377.025337] usb 1-1.4: New USB device found, idVendor=0bda, idProduct=2832, bcdDevice= 1.00
May 24 16:03:15 piaware kernel: [102377.025356] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
May 24 16:03:15 piaware kernel: [102377.025364] usb 1-1.4: Product: RTL2832UFA
May 24 16:03:15 piaware kernel: [102377.025372] usb 1-1.4: Manufacturer: Realtek
May 24 16:03:15 piaware kernel: [102377.025379] usb 1-1.4: SerialNumber: 00001090
May 24 16:03:15 piaware kernel: [102377.034201] usb 1-1.4: dvb_usb_v2: found a 'Realtek RTL2832U reference design' in warm state
May 24 16:03:15 piaware kernel: [102377.088939] usb 1-1.4: dvb_usb_v2: will pass the complete MPEG2 transport stream to the software demuxer
May 24 16:03:15 piaware kernel: [102377.088984] dvbdev: DVB: registering new adapter (Realtek RTL2832U reference design)
May 24 16:03:15 piaware kernel: [102377.098407] i2c i2c-3: Added multiplexed i2c bus 4
May 24 16:03:15 piaware kernel: [102377.098425] rtl2832 3-0010: Realtek RTL2832 successfully attached
May 24 16:03:15 piaware kernel: [102377.098539] usb 1-1.4: DVB: registering adapter 0 frontend 0 (Realtek RTL2832 (DVB-T))...
May 24 16:03:15 piaware kernel: [102377.099763] r820t 4-001a: creating new instance
May 24 16:03:15 piaware kernel: [102377.111261] r820t 4-001a: Rafael Micro r820t successfully identified