PTP/GPTP
In the car, vehicle time uses gptp to synchronize vehicle time. gptp is a simplified version of ptp. The specification definition comes from IEEE 802.1AS. Theoretically, it can achieve ns-level error. The comparison between different ptp versions and gptp is as follows:
-
GPTP synchronization principle
For gptp, all slave nodes are synchronized with the clock of the master (grandmaster); in the automotive field, master nodes are statically specified, and from the perspective of functional safety, MCUs with functional safety will be selected as master nodes. Therefore, gw (gateway) or tbox will generally be selected as the master, and the selection of gw or tbox will have an impact on the subsequent time management strategy of the entire vehicle.
The sync message (sync+follow up, hereinafter referred to as sync message) of the master node will use the second-layer message to spread throughout the clock tree. In gptp, the sync message uses the second-layer message, and the mac address is the specified broadcast mac address, but in fact the sync message is sent to the next hop node in the form of unicast. If the next node is Bridage, the correctionField (the time consumed by routing processing) will be re-corrected, and then the original information will be added to the sync message to route to the next hop node until it reaches the terminal node--End-Station. The sync message will contain master preciseOriginTimestamp, correctionField, etc. As shown in the following figure:
The slave node will adjust its clock frequency and offset according to the preciseOriginTimestamp and correctionField in the sync message. In order to eliminate the transmission delay on the bus, the slave node will send a delay measurement message. Since there is a gptp protocol stack in each hop on the vehicle, the clock synchronization measured in theory is unidirectional and accurate, as shown in the following figure:
Pdelay=((t(4)-t(1))-(t(3)-t(2)))/2
Pdelay measures only the transmission delay between two adjacent hops, so Pdelay will not penetrate the Bridge. From the above, we can see that compared with can tsync, gptp not only eliminates the transmission delay and processing delay when routing messages, but also the timestamp is added by hardware, so its clock synchronization accuracy is much greater than can tsync.
With the above foundation, we put all the gptp messages together, as shown below, and derive the formulas used by the slave node for amplitude modulation and phase modulation.
C Pdelay = ((t6-t3)-(t5-t4))/2 Gm = t1 + Pdelay + CorrectionField //Master clock time + cable transmission time + time spent on routing messages TimeOffset = t2 - Gm //Used for phase or amplitude modulation Ratio = (Gm-Gm_last) / (t2-t2_last) //Gm_last and t2_last can be earlier. FreqOffset = (1-Ratio)*1e9 //Used for frequency modulation
According to the specification, sync messages are generally sent every 125ms; and Pdelay messages are sent every 1s, or each sync message can trigger a Pdelay message. In general, the synchronization accuracy is configurable, and the local clock is adjusted only when the threshold is exceeded. The clock adjusted by gptp (gptp clock) is a clock tree endpoint at the same level as the network card clock source. It is generally abstracted into a device on Linux, that is, /dev/ptpx; when using hardware clock stamps, when the sampling point of network message sending or receiving arrives, the timestamp will be obtained from the gptp clock. The sampling points are shown in the figure below:
Additional: The above figure not only shows the sampling point, but also the latency. If you want to achieve ultra-high-precision clock synchronization, you need to compensate ingress_latency and egress_latency in the actual calculation.
The gptp message format is slightly complicated and will not be expanded here. From the perspective of understanding the gptp principle, you don't need to pay attention to the message format for the time being.
Previous article:On-board time fusion and UTC synchronization
Next article:Implementation principle of vehicle clock synchronization can_tsync
- Popular Resources
- Popular amplifiers
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Learn to use WiFi module to remotely burn programs to STM32/GD32 MCU in two minutes
- EEWORLD University Hall----Live Replay: Keysight High-Speed Bus PCIe5.0 Technology Development and Test Sharing
- CMSIS_RTOS_Tutorial self-translated Chinese version
- [Qinheng Trial] Run the ID reading routine
- [Recruitment] Huawei HiSilicon Semiconductor recruits chip R&D positions
- 【ufun learning】Part 2: Initial test demo example
- Problems with temperature acquisition based on stm32f446re
- MCU+MOS tube stepping subdivision drive control solution
- Do you know A2B, the automotive audio bus technology?
- Detailed explanation of MSP430F5529 system working mode