Portable, PTP-based Clock Synchronization Implementation for Microcontroller-based Systems and its Performance Evaluation
András Wiesner, Tamás Kovácsházy · 2021
Networked embedded systems are built from nodes utilizing Linux with its diverse network protocol stacks or on network-enabled Microcontrollers (MCU) with embedded operating systems like FreeRTOS with limited networking support. Clock synchronization in the form of IEEE 1588 (Precision Time Protocol, PTP) is also a common requirement in networked embedded systems today. Linux and other high-end embedded operating systems have kernel and application support for PTP, for example, Linux has the PTP Hardware Clock (PHC) kernel infrastructure and linuxptp user-space implementation for this. However, PTP support on embedded operating systems for MCUs is not common; and therefore, portable, good quality, open-source implementations are needed. This paper introduces our PTP based clock synchronization implementation and evaluates its baseline performance on the Texas Instruments TM4C1294 Tiva C network-enabled Cortex-M4F MCU using the Texas Instrument’s Connected LaunchPad development board as a hardware environment. Our implementation is built upon FreeRTOS embedded operating system and the LwIP embedded TCP/IP stack, two software components also widely applied by other network-enabled MCU manufacturers in their software packages (such as ST on the STM32F4/F7/H7 line). The implementation abstracts PTP packet timestamping, PPS signal generation, and external HW event timestamping, hopefully guaranteeing good portability. After presenting the software and hardware architecture of our system we also report our initial performance evaluation methodology and results.