![]() |
flexPTP 1.0
An IEEE 1588 PTP implementation designed for microcontrollers
|
The flexPTP requires a clock servo to calculate how to tune the clock in steady state. A proper servo must define the following four functions:
PTP_SERVO_INIT()
)PTP_SERVO_DEINIT()
)PTP_SERVO_RESET()
)PtpServoAuxInput
object). (refer to PTP_SERVO_RUN()
)Clock servo functions must be passed to the flexPTP core by filling the servo-related macros in the flexptp_config.h
configuration file.
Here we want to highlight that a servo init function is not constrained to only initialize the core of a controller. The developer is highly encouraged to include e.g. logging or debug functionality also in the controller.
Currently, the library ships with two (plus one) different, predefined servos.
CMake: set(FLEXPTP_SERVO "PID")
A simple PID-controller is implemented in the following sources: pid_controller.c, pid_controller.h
Parameters and default values (all parameters are unit-less):
Name | Value |
---|---|
K_P | 0.238 |
K_I | 0 |
K_D | 3.0 |
Custom parameter values can be set in the flexptp_options.h
by redefining each macro.
This servo defines the following CLI commands:
To use this servo, set the servo definition macros the following way:
CMake: set(FLEXPTP_SERVO "KALMAN")
The library offers a robust Kalman-filter-based servo as well defined in the following sources: kalman_filter.c, kalman_filter.h. This implementation is based on the paper Performance Analysis of Kalman-Filter-Based Clock Synchronization in IEEE 1588 Networks by Giada Giorgi and Claudio Narduzzi.
The controller can be tuned along three parameters ( \(\sigma_{\theta}\), \(\sigma_{\gamma}\), \(\sigma_{C(t)}\)) that are described in the paper.
Parameters and default values:
Name | Value | Unit |
---|---|---|
SIGMA_THETA_SQUARED | 1E-16 | \(s^2\) |
SIGMA_GAMMA_SQUARED | 1E-12 | \(s^2\) |
SIGMA_CT_SQUARED | 1E-10 | \(s^2\) |
Custom parameter values can be set in the flexptp_options.h
by redefining each macro.
This servo defines the following CLI commands:
To use this servo, set the servo definition macros the following way:
CMake: set(FLEXPTP_SERVO "DEBUG")
This servo can be used to monitor and manually tune the hardware clock. It produces a verbose, colorized logging of the clock state.
This servo defines the following CLI commands:
To use this servo, set the servo definition macros the following way: