From 2b099cfa0615eeb8c2c946052c960a73ea53cd14 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Tue, 18 Mar 2014 18:25:13 +0100 Subject: [PATCH] Increase default first step threshold to 20 us. Most PHC drivers implement stepping (ADJ_SETOFFSET) by reading the clock, adjusting the value by the offset and writing it back. This is not perfectly accurate and if the operation is slow (e.g. due to PCIe latencies), the error can be in microseconds. Increase the default first step threshold from 100 nanoseconds to 20 microseconds to step only when the initial offset is larger than the error in the step. Signed-off-by: Miroslav Lichvar --- default.cfg | 2 +- gPTP.cfg | 2 +- phc2sys.8 | 4 ++-- phc2sys.c | 2 +- ptp4l.8 | 2 +- servo.c | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/default.cfg b/default.cfg index 7038b69..9f01eda 100644 --- a/default.cfg +++ b/default.cfg @@ -49,7 +49,7 @@ pi_integral_scale 0.0 pi_integral_exponent 0.4 pi_integral_norm_max 0.3 step_threshold 0.0 -first_step_threshold 0.0000001 +first_step_threshold 0.00002 max_frequency 900000000 clock_servo pi sanity_freq_limit 200000000 diff --git a/gPTP.cfg b/gPTP.cfg index fac2aa0..4d0a38c 100644 --- a/gPTP.cfg +++ b/gPTP.cfg @@ -49,7 +49,7 @@ pi_integral_scale 0.0 pi_integral_exponent 0.4 pi_integral_norm_max 0.3 step_threshold 0.0 -first_step_threshold 0.0000001 +first_step_threshold 0.00002 max_frequency 900000000 clock_servo pi sanity_freq_limit 200000000 diff --git a/phc2sys.8 b/phc2sys.8 index 8688e48..fa3ae20 100644 --- a/phc2sys.8 +++ b/phc2sys.8 @@ -106,7 +106,7 @@ Specify the integral constant of the PI controller. The default is 0.3. Specify the step threshold of the servo. It is the maximum offset that the servo corrects by changing the clock frequency instead of stepping the clock. The clock is stepped on start regardless of the option if the offset is -larger than 100 nanoseconds (unless the +larger than 20 microseconds (unless the .BI \-F option is used). It's specified in seconds. The value of 0.0 disables stepping after the start. The default is 0.0. @@ -115,7 +115,7 @@ after the start. The default is 0.0. Specify the step threshold applied only on the first update. It is the maximum offset that is corrected by adjusting clock. It's specified in seconds. The value of 0.0 disables stepping on start. -The default is 0.0000001 (100 nanoseconds). +The default is 0.00002 (20 microseconds). .TP .BI \-R " update-rate" Specify the slave clock update rate when running in the direct synchronization diff --git a/phc2sys.c b/phc2sys.c index 6221515..5ecb602 100644 --- a/phc2sys.c +++ b/phc2sys.c @@ -565,7 +565,7 @@ static void usage(char *progname) " -P [kp] proportional constant (0.7)\n" " -I [ki] integration constant (0.3)\n" " -S [step] step threshold (disabled)\n" - " -F [step] step threshold only on start (0.0000001)\n" + " -F [step] step threshold only on start (0.00002)\n" " -R [rate] slave clock update rate in HZ (1.0)\n" " -N [num] number of master clock readings per update (5)\n" " -O [offset] slave-master time offset (0)\n" diff --git a/ptp4l.8 b/ptp4l.8 index edc7045..cbca9bc 100644 --- a/ptp4l.8 +++ b/ptp4l.8 @@ -355,7 +355,7 @@ The maximum offset the servo will correct by changing the clock frequency instead of stepping the clock. This is only applied on the first update. It's specified in seconds. When set to 0.0, the servo won't step the clock on start. -The default is 0.0000001 (100 nanoseconds). +The default is 0.00002 (20 microseconds). This option used to be called (and can still be set by) .BR pi_f_offset_const . .TP diff --git a/servo.c b/servo.c index 41e5c9f..6986e41 100644 --- a/servo.c +++ b/servo.c @@ -25,7 +25,7 @@ #define NSEC_PER_SEC 1000000000 double servo_step_threshold = 0.0; -double servo_first_step_threshold = 0.0000001; /* 100 nanoseconds */ +double servo_first_step_threshold = 0.00002; /* 20 microseconds */ int servo_max_frequency = 900000000; struct servo *servo_create(enum servo_type type, int fadj, int max_ppb, int sw_ts)