gpsd-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Clarifications about PPS SHM content


From: Martin Boissonneault
Subject: Re: Clarifications about PPS SHM content
Date: Tue, 24 Mar 2020 02:14:03 -0400
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0

Hi Gary,

On 2020-03-23 22:16, Gary E. Miller wrote:
Yo Martin!

On Mon, 23 Mar 2020 21:49:23 -0400
Martin Boissonneault <address@hidden> wrote:

Look closely at the graph of PPS jitter over time.  Compare it to
your cron jobs, and other jobs.  
I don't have much experience with Debian/Raspbian/Linux optimization
and process tracking. I struggled to find the cause of the time error
spike that was caused by systemd's timesyncd service.
Well, systemd(umb) says it all.  "Just Say No" (tm)

Well, to the defence of whoever put timesyncd there, the logic is sound: Get the time right before the system starts too much to prevent the time from jumping backwards because of no RTC or one that's too far off. But otherwise, it's in direct conflict with any other type of time synchronization. So, m'kay...


The primary purpose of that Raspberry Pi 3B+ (running Raspbian
Buster) is airplane tracking with dump1090-fa and dump978-fa
software-defined radio decoders, which receive their input over USB
from two FlightAware RTL-SDR FlightSticks.
They are much bigger than the newer SDRs and I doubt their marketing
that their LNA is better then the newer generic ones.

I have a Nooelec NESDR SMArtee for comparison, and the LNA does help me pull in more planes. I planted a FlightAware ADS-B filter (~980-1150MHz bandpass) in front of each, one is an orange SAW-less FlightStick (for 978MHz), the other the dark blue 1090MHz SAW-equipped one. Both are fed by small antennas with a good ground-plane a few feet away. And I did test with or without the filters, and they help. Oh, they are connected through extensions to a wall-powered USB2 hub, and I checked they have good power at the receiver. The receiver has been working well for over a year now! Rock-solid, not a single disconnection.

Of course, a mast-mounted LNA and antennas would be a game-changer for my setup! Think about why I have the NESDR SMArtee...


It is then redistributed
in 6 ways over RPi's Ethernet. This software-defined radio decoding
is USB and CPU intensive with a CPU utilization average of 37%.
That's not great for latency!
Yeah.  That may be your limiting factor Be sure you gpsd and ntpd are
running at high priority.

Just confirmed: NTPd has prio RT, and GPSd has prio 10 (is nice -10) with no task shown with more priority. The dump___-fa are prio 15 (nice -5). Then we have a whole bunch of prio 20 (nice 0) stuff, and the graphing stuff has very low priority (nice 19 I think).


In order to help, I recompiled the kernel with the following 
modifications from the original Raspbian kernel .config:

CONFIG_HZ_PERIODIC=y 	(was CONFIG_NO_HZ_COMMON=y)
CONFIG_HZ_250=y 	(was CONFIG_HZ_100=y)
CONFIG_HZ=250 		(was CONFIG_HZ=100)
Can you quantify how much that helped?

I tested that about a year ago, so I don't have the numbers. But I ran CONFIG_NO_HZ_COMMON=y (stock), then CONFIG_HZ_PERIODIC=y with 100Hz, 250Hz and 500Hz and 250Hz had the less jitter of the four configurations. I think it reached up 400ns. Considering the compile time on my Pi, I'm not much into ABx testing at this time ;-) If only I was in the mood to make cross-compile work on Ubuntu or desktop Raspbian... My laptop's i7-8750h 6-core HT CPU would do it in a flash!


I forgot to set /CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y/ but this 
governor is set somewhere else (and confirmed operating) in my Pi 
configurations.
Yeah, setting it as the kernel default is pointless.  Almost every
distro overrides that.

As does Raspbian if you don't disable a startup script: /etc/init.d/raspi-config
Magic: systemctl disable raspi-config, then some sysfsutils magic on top to make the performance governor start on startup.

I think the reason to set it in the kernel .config has to do with the timing calibration of the kernel, as the governor that is active on boot uses a different frequency before the OS configuration changes it (600MHz vs 1400MHz). I think there is a mechanism to fix this (a delay before lowering the frequency), but hard-setting it in the kernel ensures that the calibration will run with the frequency that will be used normally.


Chart your CPU and room temps.  See if you can stabilize your temps.

Send us the link to your ntpviz page.  
Here are the ntpviz graphs, where the LM0 temperature is the
temperature inside the case as read by the DS3231 RTC:
http://ve2mrx.dyndns.info:10180/ntp/day/ 
<http://ve2mrx.dyndns.info:10180/ntp/week/>
http://ve2mrx.dyndns.info:10180/ntp/week/ 
<http://ve2mrx.dyndns.info:10180/ntp/week/>
Pretty good, but not perfect, temp control.  Prolly no winto improve
that.  

I did spend lots of time to read, tweak, wait, repeat... And more recently, start over on Buster and document (almost) everything ;-) I'm happy with the results under the non-dedicated usage. I did spend much time ABx testing minpoll on the local servers, as a lower minpoll does not guarantee better mean or jitter.


Something swung your frequency hard at 23 Mar 12:00Z

Ha! Yes, I tested an offline boot, only to find out my RTC was off half an hour for some reason. Being an DS3231 RTC with battery backup, it shouldn't be off more than a few minute a year. No idea why it was that off, and looks like it's not set by NTPd 11 minute (mode?). Something more to look at!


Here, you have various aircraft-tracking-centric graphs from 
https://github.com/wiedehopf/graphs1090 with various OS metrics:
http://ve2mrx.dyndns.info:10180/graphs1090/
Nice.  Your disk I/O is a bit high for best timing.  Maybe buffer that
more?

Good idea! How about I do it right now? I changed vm.dirty_expire_centisecs to 2.5 minutes, vm.dirty_ratio = 40 and vm.dirty_background_ratio = 30. Do you think that's allright?


Last but not least, (http : //
ve2mrx.dyndns.info:10180/gpsd/gpsd.php).
Only showing a 2D fix, not optimal for timing.  Prolly good enough
considering your CPU and I/O issues.

Well, my u-Blox MAX-M8Q is configured for a static position (it is static). It's height is also configured from the 1-week long position averaging.

Should I turn the Fix mode to 3D and leave TMODE2 Time mode to 2-Fixed? I read somewhere in the past to set GNSSs to 2D for time service. Unfortunately, my memory is like the Internet, full of abandoned, unmaintained obsolete stuff ;-)

SELF-ISOLATE! SOCIAL DISTANCING IS (mostly) OUTDATED!
Sounds like a normal month to me.  I've been working from home for
years.

Me too! Same as usual, except for all the closed shops outside, and not eating with my 70yo mother Wednesdays. She's self-isolating too.


If I had the budget, the Pi would be in a double-box, where the inner 
one would be a sealed metal box, and the plastic outer one, actively 
temperature-stabilized with fans. I have the electronics skills, I
have the time, just not the budget... Hmm, maybe a paint can in a
concrete bucket could work? You need a non-thermally conductive
thermal mass... :-)
I just put the RasPi in a cardboard box with a small light bulb.  Then
toggle the light bulb on and off.  Pretty cheap.

Your temp change is so small that cpuheat may be enough to get it
solid.  No cost to that.

On my TODO list, there's cpuheat. My problem is summer with the big south-facing window during heat waves. In winter, there is no problem, it can generate it own heat, but in the summer with high ambient temps, it becomes HOT. I've put the plastic cover on the case for the winter (room temperature set to 18°C, door kept almost closed) but in the summer I only leave a piece of paper in place of the cover.

So, cpuheat for the winter, fans for summer ;-)


alone at home with a cat, getting bored because everything is closed,
so I started playing games again...
Sadly my dog died last year, so not even a pet here.  gpsd is my video
game of choice.

I'm sad to hear that. I understand how important animals can become in our lives! Me, I had a horse before my cat, up to 2016. Unfortunately, I had to leave her. I've had no news of my unicorn since. Don't tell my cat, but she's never going to replace what I had with my horse! There's nothing like an afternoon in the woods with a friend that happens to be the ultimate 4x4... I will miss those moments for a long time.

As for dogs, I lived with dogs all my childhood. But I never was their companion of choice, it was someone else in the house, but I still appreciated their presence. Maybe that's why I had a horse for 13 years... They think pretty much the same, except dogs run after a prey, and horses get run after as a prey ;-)


RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
	address@hidden  Tel:+1 541 382 8588

	    Veritas liberabit vos. -- Quid est veritas?
    "If you can't measure it, you can't improve it." - Lord Kelvin

Have a nice <period_of_day>,
Martin


reply via email to

[Prev in Thread] Current Thread [Next in Thread]