PTP (Precision Time Protocol) message processing method, time synchronization method and device and communication equipment
By introducing application processors and timers into communication devices, obtaining and updating time deviations, and reassembling PTP messages, the problem of insufficient clock synchronization accuracy in DS-TT in 5G systems is solved, and high-precision TSN node clock synchronization is achieved.
Patent Information
- Application Number
- CN202510574213.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-06
- Publication Date
- 2025-07-18
AI Technical Summary
In the prior art, DS-TT has a problem of low clock synchronization accuracy when processing PTP packets in 5G systems, resulting in insufficient clock synchronization accuracy of TSN nodes.
By introducing application processors and timers into communication devices, time deviations are acquired and updated, and PTP messages are reassembled to synchronize time-sensitive networks and mobile communication network clock domains.
Improve the clock synchronization accuracy of nodes in the time-sensitive network clock domain, ensuring high-precision clock synchronization of TSN nodes.
Smart Images

Figure CN120342536A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of communication technologies, and particularly to a method for processing PTP packets, a time synchronization method and apparatus, and a communication device. Background Art
[0002] Time Sensitive Network (TSN) is a set of standards formulated by the Time Sensitive Network Task Force of the IEEE 802.1 working group, mainly used for transmitting time-sensitive real-time data over Ethernet networks. In the integrated networking of 5G systems and TSN systems, the 5G system acts as a logical TSN bridge to achieve network integration. The TSN system sends timing information to TSN nodes through the 5G system to achieve clock synchronization of TSN nodes in the same clock domain. As Figure 1 shown, the UE, the 5G network, the DS-TT (Device Side TSN Translator), and the NW-TT (Network Side TSN Translator) together form the 5G system, i.e., 5GS. The TSN system accesses the 5G system through the DS-TT or the NW-TT, thereby realizing wireless transmission between the nodes of the TSN system; where Ni represents different interfaces between nodes in the 5G system, i = 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 30, 33, 52, the C-Plane is the control plane, mainly responsible for the control function of the network, and the U-Plane is the user plane, mainly responsible for the transmission of user data.
[0003] The DS-TT and the NW-TT are used to implement functions such as gPTP (generalized precision time protocol), timestamp, best clock algorithm, rate ratio, etc. required in IEEE 802.1AS, while the UE and the network in the 5G system do not participate in these processes at all. The UE and the network use SIB9 (System Information Block 9) messages to achieve time synchronization and maintain the clock synchronization of 5GS; both the DS-TT and the NW-TT have their own TSN clocks inside. The DS-TT and the NW-TT maintain TSN clock synchronization according to the processing of IEEE 802.1AS, and the DS-TT and the NW-TT are considered to be strictly synchronized according to the 5GS clock; the 5GS clock synchronization and the TSN clock synchronization are independent of each other and do not affect each other, but the DS-TT and the NW-TT can obtain the time of 5GS at the same time. For details, refer to Figure 2 .
[0004] In the existing solution, DS-TT needs to calculate the cumulative delay of PTP (Precision Time Protocol) packets in the 5G system. Since it is necessary to maintain two clock domains, namely the TSN domain and the 5G domain, and there are large errors when processing 5G time synchronization and PTP packets, the accuracy of clock synchronization of TSN nodes in the same clock domain is relatively low. Summary of the Invention
[0005] The technical problem to be solved by the present disclosure is to overcome the defect of relatively low clock synchronization accuracy in the prior art, and provide a method for processing PTP packets, a time synchronization method and device, and a communication device.
[0006] The present disclosure solves the above technical problem through the following technical solutions:
[0007] A first aspect of the present disclosure provides a method for processing PTP packets, which is applied to an application processor in a communication device. The communication device further includes a modem, a first timer, and a second timer. The PTP packets include synchronization packets and follow-up packets. The processing method includes the following steps:
[0008] In response to receiving a synchronization packet sent by a first node in the mobile communication network through the modem, obtain a first time and a second time respectively; wherein, the first time is the current time of the first timer, and the second time is the current time of the second timer;
[0009] Calculate a first time deviation based on the first time, the second time, and the time synchronization information in the follow-up packet received from the modem;
[0010] Update the current time of the second timer according to the first time deviation;
[0011] Update the accurate timestamps in the synchronization packet and the follow-up packet to the current time of the second timer, and update the correction parameter in the follow-up packet to the correction parameter of the application processor itself;
[0012] Send the synchronization packet and the follow-up packet to a second node in the time-sensitive network.
[0013] Optionally, the time synchronization information in the follow-up packet received from the modem includes an accurate timestamp, a correction parameter, the time when the follow-up packet enters the mobile communication network, and a frequency ratio. The step of calculating the first time deviation based on the first time, the second time, and the time synchronization information in the follow-up packet received from the modem specifically includes:
[0014] Determine a reference time according to the precise timestamp and the calibration parameter;
[0015] Calculate the propagation delay in the mobile communication network according to the difference between the first time and the time when the following message enters the mobile communication network;
[0016] Calculate the propagation delay in the time-sensitive network according to the propagation delay in the mobile communication network and the frequency ratio;
[0017] Calculate the current time of the master clock in the time-sensitive network according to the reference time and the propagation delay in the time-sensitive network;
[0018] Calculate a first time deviation according to the current time of the master clock in the time-sensitive network and the second time.
[0019] Optionally, before obtaining the first time, the following steps are further included:
[0020] Receive a second time deviation sent by the modem; wherein, the second time deviation is determined according to the SIB9 message received by the modem, the current time of the local reference clock after decoding the SIB9 message, and the current time of the first timer;
[0021] Update the current time of the first timer according to the second time deviation.
[0022] Optionally, the communication device further includes an IP packet hardware accelerator, and the processing method further includes: receiving, by the hardware accelerator, the synchronization message and the following message forwarded by the modem.
[0023] Optionally, the communication device further includes an Ethernet transmission module, and the processing method further includes:
[0024] Obtain the updated current times of the first timer and the second timer through the Ethernet transmission module;
[0025] Determine a target time from the two obtained times;
[0026] Set the timestamp of the PTP message to be sent according to the target time;
[0027] Send the PTP message to be sent.
[0028] The second aspect of the present disclosure provides a time synchronization method, which is applied to a modem in a communication device. The communication device further includes an application processor, a first timer, and a second timer. The time synchronization method includes the following steps:
[0029] Upon receiving the SIB9 message sent by a third node in the mobile communication network, obtain the current time of the local reference clock;
[0030] Upon completion of decoding the SIB9 message, obtain the current time of the local reference clock again and obtain the current time of the first timer;
[0031] Determine a second time deviation based on the time information in the SIB9 message, the difference between the current times of the local reference clock obtained twice, and the current time of the first timer;
[0032] Send the second time deviation to the application processor, where the second time deviation is used to update the current time of the first timer.
[0033] Optionally, the step of determining the second time deviation based on the time information in the SIB9 message, the difference between the current times of the local reference clock obtained twice, and the current time of the first timer specifically includes:
[0034] Compensate the time information in the SIB9 message to obtain a compensated time;
[0035] Subtract the difference between the current time of the first timer and the compensated time from the difference between the current times of the local reference clock obtained twice to obtain the second time deviation.
[0036] A third aspect of the present disclosure provides a processing device for PTP packets, which is applied to an application processor in a communication device. The communication device further includes a modem, a first timer, and a second timer. The PTP packets include synchronization packets and follow-up packets. The processing device includes:
[0037] A first acquisition module, configured to, upon receiving a synchronization packet sent by a first node in the mobile communication network through the modem, respectively acquire a first time and a second time; where the first time is the current time of the first timer, and the second time is the current time of the second timer;
[0038] A deviation calculation module, configured to calculate a first time deviation based on the first time, the second time, and the time synchronization information in the follow-up packet received from the modem;
[0039] A first update module, configured to update the current time of the second timer according to the first time deviation;
[0040] A second update module, configured to update the precise timestamps in the synchronization message and the follow-up message to the current time of the second timer, and update the correction parameter in the follow-up message to the correction parameter of the application processor itself;
[0041] A message sending module, configured to send the synchronization message and the follow-up message to a second node in the time-sensitive network.
[0042] Optionally, the time synchronization information in the follow-up message received from the modem includes a precise timestamp, a correction parameter, the time when the follow-up message enters the mobile communication network, and a frequency ratio. The deviation calculation module is specifically configured to determine a reference time according to the precise timestamp and the correction parameter; calculate the propagation delay in the mobile communication network according to the difference between the first time and the time when the follow-up message enters the mobile communication network; calculate the propagation delay in the time-sensitive network according to the propagation delay in the mobile communication network and the frequency ratio; calculate the current time of the master clock in the time-sensitive network according to the reference time and the propagation delay in the time-sensitive network; calculate a first time deviation according to the current time of the master clock in the time-sensitive network and the second time.
[0043] Optionally, the processing device further includes:
[0044] A deviation receiving module, configured to receive a second time deviation sent by the modem before obtaining the first time; wherein the second time deviation is determined according to the SIB9 message received by the modem, the current time of the local reference clock after decoding the SIB9 message, and the current time of the first timer;
[0045] A third update module, configured to update the current time of the first timer according to the second time deviation.
[0046] Optionally, the communication device further includes an IP packet hardware accelerator, and the processing device further includes a message receiving module, configured to receive the synchronization message and the follow-up message forwarded by the modem through the hardware accelerator.
[0047] Optionally, the communication device further includes an Ethernet transmission module, and the processing device further includes a message processing module, configured to obtain the updated current times of the first timer and the second timer through the Ethernet transmission module, determine a target time from the two obtained times, set a timestamp of a PTP message to be sent according to the target time, and send the PTP message to be sent.
[0048] The fourth aspect of the present disclosure provides a time synchronization device applied to a modem in a communication device. The communication device further includes an application processor, a first timer, and a second timer. The time synchronization device includes:
[0049] A second acquisition module, configured to acquire the current time of the local reference clock in response to receiving an SIB9 message sent by a third node in a mobile communication network.
[0050] A third acquisition module, configured to acquire the current time of the local reference clock again and acquire the current time of the first timer in response to completing the decoding of the SIB9 message.
[0051] A deviation determination module, configured to determine a second time deviation according to the time information in the SIB9 message, the difference between the current times of the local reference clock acquired twice, and the current time of the first timer.
[0052] A deviation sending module, configured to send the second time deviation to the application processor, where the second time deviation is used to update the current time of the first timer.
[0053] Optionally, the deviation determination module is specifically configured to compensate the time information in the SIB9 message to obtain a compensated time; and subtract the difference between the current time of the first timer and the compensated time from the difference between the current times of the local reference clock acquired twice to obtain a second time deviation.
[0054] The fifth aspect of the present disclosure provides a communication device, including an application processor, a modem, a first timer, and a second timer. The application processor is configured to execute the PTP packet processing method described in the first aspect, and / or, the modem is configured to execute the time synchronization method described in the second aspect.
[0055] The sixth aspect of the present disclosure provides a chip applied to a communication device. The chip is used to execute the PTP packet processing method described in the first aspect and / or the time synchronization method described in the second aspect.
[0056] The seventh aspect of the present disclosure provides a chip module applied to a communication device, including a chip. The chip is used to execute the PTP packet processing method described in the first aspect and / or the time synchronization method described in the second aspect.
[0057] The eighth aspect of the present disclosure provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the PTP packet processing method described in the first aspect and / or the time synchronization method described in the second aspect are implemented.
[0058] The ninth aspect of the present disclosure provides a computer program product, including a computer program, which when executed by a processor implements the steps of the PTP message processing method described in the first aspect and / or the time synchronization method described in the second aspect.
[0059] Based on the common knowledge in the art, the above optional conditions can be combined arbitrarily to obtain various preferred embodiments of the present disclosure.
[0060] The positive and progressive effects of the present disclosure are as follows: By synchronizing the time of the clock in the time-sensitive network clock domain, i.e., the second timer, reassembling the PTP message according to the synchronized time, and forwarding the PTP message to the second node in the time-sensitive network, the clock synchronization accuracy of the nodes in the time-sensitive network clock domain can be guaranteed.
[0061] Furthermore, the present disclosure can not only synchronize the time of the clock in the time-sensitive network clock domain, i.e., the second timer, but also synchronize the time of the clock in the mobile communication network clock domain, i.e., the first timer. Specifically, based on synchronizing the time of the first timer and then synchronizing the time of the second timer, the clock synchronization accuracy of the nodes in the time-sensitive network clock domain can be further guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] Figure 1 It is a schematic diagram of the integrated networking of a 5G system and a TSN system.
[0063] Figure 2 It is a schematic diagram of 5GS TSN clock synchronization.
[0064] Figure 3 It is a schematic diagram of the internal structure of a communication device provided by an embodiment of the present disclosure.
[0065] Figure 4 It is a schematic diagram of the internal structure of another communication device provided by an embodiment of the present disclosure.
[0066] Figure 5 It is a flowchart of a PTP message processing method provided by Embodiment 1 of the present disclosure.
[0067] Figure 6 It is a flowchart of step S102 provided by Embodiment 1 of the present disclosure.
[0068] Figure 7 It is a block diagram of the structure of a PTP message processing device provided by Embodiment 1 of the present disclosure.
[0069] Figure 8 It is a flowchart of a time synchronization method provided by Embodiment 2 of the present disclosure.
[0070] Figure 9 The structural block diagram of a time synchronization device provided in Embodiment 2 of the present disclosure. Specific implementation manners
[0071] The present disclosure will be further described below by way of embodiments, but the present disclosure is not limited to the scope of the described embodiments.
[0072] In the embodiments of the present disclosure, prefix words such as "first" and "second" are only used to distinguish different described objects, and have no limiting effect on the position, order, priority, quantity, content, etc. of the described objects. The use of ordinal words and other prefix words for distinguishing described objects in the embodiments of the present disclosure does not constitute a limitation on the described objects. The statement of the described objects refers to the description in the context of the claims or embodiments, and should not constitute an unnecessary limitation due to the use of such prefix words. In addition, in the description of this embodiment, unless otherwise specified, the meaning of "a plurality of" is two or more.
[0073] The communication device involved in the embodiments of the present disclosure is as Figure 3 shown, and includes an application processor, a modem, a first timer, and a second timer. Among them, an application processor (AP) is generally used to process data tasks on the communication device, control the user interface, process graphics and audio, and manage network communication. A modem is designed for long-distance transmission of digital signals for data communication on an analog channel with limited bandwidth. It generally consists of several parts such as baseband processing, modulation and demodulation, signal amplification and filtering, and equalization. Modulation is to combine a digital signal with an audio carrier to generate an audio signal (analog signal) suitable for transmission on a telephone line; demodulation is to recover the digital signal from the audio signal.
[0074] A first node of the mobile communication network sends PTP packets to a second node in the time-sensitive network through the modem and the application processor, so as to realize time synchronization of two network clock domains in the communication device. Among them, the first node of the mobile communication network can be NW-TT, and the second node in the time-sensitive network can be a TSN bridge, an EndStation, etc. The PTP packets include synchronization packets (Sync packets) and follow-up packets (Follow_Up packets). In specific implementations, the PTP packets can also include other types of packets. The first timer corresponds to the clock domain of the mobile communication network, and the second timer corresponds to the clock domain of the time-sensitive network.
[0075] The mobile communication network can be different generations of mobile communication networks. In the example where the mobile communication network is the fifth-generation mobile communication network, i.e., the 5G network, the communication device involved in this embodiment can implement the functions of UE and DS-TT defined in the 5G R16 standard.
[0076] In a specific implementation, as Figure 4 shown, the above communication device is provided with a time update processing unit and a reference clock. The time update processing unit can also be referred to as the time_update hardware processing unit, which can directly access the registers of the first timer and the second timer to obtain or update the current time of the two timers. Among them, the first timer, the second timer, and the time update processing unit all need Set in AON (Always-ON) hardware, that is, the clock needs to remain powered on. The first counter Figure 4 The clock sources of the first timer and the second timer are both the reference clock, and its frequency can be set according to the actual situation. In a specific example, the frequency of the reference clock is 100M, that is, the first timer and the second timer are incremented by 10ns each time, so as to implement the timing function.
[0077] In an optional implementation manner, as Figure 5 shown, the above communication device further includes a hardware accelerator, and the modem is used to forward the synchronization message and the follow-up message to the application processor through the hardware accelerator. Among them, the hardware accelerator can also be referred to as an IP Packet Accelerator. In this implementation manner, by using the hardware accelerator, the PTP message received by the modem is forwarded to the application processor, avoiding the additional residence time brought by software forwarding in terms of transmission delay.
[0078] Embodiment 1
[0079] Figure 5 FIG. is a schematic flowchart of a method for processing a PTP message provided in this embodiment. The method for processing a PTP message can be executed by a PTP message processing device. The PTP message processing device can be implemented in a software and / or hardware manner, and the PTP message processing device can be a part or all of the application processor in the above communication device. The method for processing a PTP message provided in this embodiment will be introduced below with the application processor in the above communication device as the execution subject.
[0080] As Figure 6 shown, the method for processing a PTP message provided in this embodiment may include the following steps S101 to S105:
[0081] Step S101, in response to receiving a synchronization message sent by a first node in a mobile communication network through a modem, respectively obtain a first time t1 and a second time t2; wherein, the first time t1 is the current time of the first timer, and the second time t2 is the current time of the second timer.
[0082] Step S102: Calculate a first time deviation based on the first time, the second time, and the time synchronization information in the follow-up message received from the modem.
[0083] Step S103: Update the current time of the second timer according to the first time deviation. Specifically, the current time of the second timer can be updated to the sum of the current time and the first time deviation.
[0084] Step S104: Update the accurate timestamps in both the synchronization message and the follow-up message to the current time of the second timer, and update the correction parameter in the follow-up message to the correction parameter of the application processor itself. The correction parameter of the application processor itself is calculated based on hardware, specifically the difference between the time when the follow-up message is received and the time when the follow-up message is forwarded, plus the hardware processing delay of the application processor.
[0085] Step S105: Send the synchronization message and the follow-up message to a second node in the time-sensitive network.
[0086] In this embodiment, by synchronizing the clock of the time-sensitive network clock domain, that is, the time of the second timer, reassembling the PTP message according to the synchronized time, and forwarding the PTP message to a second node in the time-sensitive network, the clock synchronization accuracy of the nodes in the time-sensitive network clock domain can be guaranteed.
[0087] In an optional embodiment, the time synchronization information in the follow-up message received from the modem includes an accurate timestamp, a correction parameter, the time when the follow-up message enters the mobile communication network, and a frequency ratio. In this embodiment, as Figure 7 shown, the above step S102 specifically includes:
[0088] Step S201: Determine a reference time according to the accurate timestamp and the correction parameter.
[0089] Step S202: Calculate the propagation delay in the mobile communication network according to the difference between the first time and the time when the follow-up message enters the mobile communication network.
[0090] Step S203: Calculate the propagation delay in the time-sensitive network according to the propagation delay in the mobile communication network and the frequency ratio.
[0091] Step S204: Calculate the current time of the master clock in the time-sensitive network according to the reference time and the propagation delay in the time-sensitive network.
[0092] Step S205: Calculate a first time deviation based on the current time of the master clock in the time-sensitive network and the second time.
[0093] In a specific example, the mobile communication network is a 5G network. The upstream node of the time-sensitive network sends synchronization messages and follow-up messages to the first node NW-TT in the 5G network. After NW-TT repackages the received synchronization messages and follow-up messages, it sends the repackaged synchronization messages and follow-up messages to the above application processor through the above modem. The application processor repackages the received synchronization messages and follow-up messages, and then sends the repackaged synchronization messages and follow-up messages to the downstream node of the time-sensitive network. The follow-up messages received by the application processor include preciseorigintimestamp, correctionfield, suffixfield, and rateratio_5G; among them, the preciseorigintimestamp field is used to represent the precise timestamp, the correctionfield field is used to represent the correction parameter, the suffixfield field is used to represent the time when the follow-up message enters the 5G network, and the rateratio_5G field is used to represent the frequency ratio of the master clock in the 5G network to the master clock in the TSN network. The reference time TSNtime_5G_NW-TT is (preciseorigintimestamp + correctionfield), the propagation delay in the 5G network is (t1 - suffixfield), the propagation delay in the TSN network is rateratio_5G * (t1 - suffixfield), the current time of the master clock in the TSN network is TSNtime_5G_NW-TT + rateratio_5G * (t1 - suffixfield), and subtracting the second time t2 from the current time of the master clock in the TSN network can obtain the first time deviation offset1, that is, offset1 = TSNtime_5G_NW-TT + rateratio_5G * (t1 - suffixfield) - t2.
[0094] This embodiment provides a specific method for calculating the first time deviation. The first time deviation is calculated based on the current time of the master clock in the TSN network and the current time of the clock in the TSN network clock domain of the communication device, that is, the second timer, so that the clock in the TSN network clock domain of the communication device can be synchronized with the master clock in the TSN network.
[0095] In an alternative embodiment, before obtaining the first time in step S101, the following steps S301 to S302 are further included:
[0096] Step S301: Receive the second time deviation sent by the modem; wherein, the second time deviation is determined according to the SIB9 message received by the modem, the current time of the local reference clock after decoding the SIB9 message, and the current time of the first timer.
[0097] Step S302: Update the current time of the first timer according to the second time deviation. Specifically, the current time of the first timer can be updated to the sum of the current time and the second time deviation.
[0098] Specifically, the modem receives the SIB9 information sent by the third node in the mobile communication network, and synchronizes the clock in the clock domain of the mobile communication network based on the SIB9 message. In a specific implementation, the third node in the mobile communication network can be a base station. In a specific example, the modem determines the second time deviation offset2 according to the following method: after receiving the SIB9 information, the modem records the current time t01 of the local reference clock, obtains its timestamp T1 after decoding the SIB9 information, then records the current time t02 of the local reference clock again at this time, and obtains the current time t03 of the first timer. Among them, the difference between the two time points of the local reference clock is t02 - t01, the difference between the two time points in the clock domain of the mobile communication network is t03 - T1, t01 corresponds to the moment when the modem receives T1, t03 corresponds to the time of the first timer at the moment of the local reference clock t02, and the second time deviation offset2 can be obtained according to the difference between (t02 - t01) and (t03 - T1). In a specific implementation, in order to further improve the synchronization accuracy, the timestamp T1 in the SIB9 message can also be compensated. For example, a preset value can be added to T1 to obtain T, and the second time deviation is calculated according to the following formula: offset2 = (t02 - t01) - (t03 - T). Among them, the preset value can be set according to the actual situation. For example, the preset value can be set using the data received by the communication device. In a specific example, the preset value can be set to TA / 2, where TA is the timing advance.
[0099] In this embodiment, not only can the clock of the time-sensitive network clock domain, that is, the time of the second timer, be synchronized, but also the clock of the mobile communication network clock domain, that is, the time of the first timer, can be synchronized. Specifically, on the basis of synchronizing the time of the first timer, the time of the second timer is synchronized, which can further ensure the clock synchronization accuracy of the nodes in the time-sensitive network clock domain. It should be noted that in the actual application of this embodiment, the clock synchronization error of the nodes in the time-sensitive network clock domain can reach a minimum of 20 ns.
[0100] In an optional implementation manner, as the master clock, the communication device may use the following steps S401 to S404 to send PTP packets to the slave clock:
[0101] Step S401: Obtain the updated current time of the first timer and the second timer through the Ethernet transmission module. In a specific implementation, the updated current time of both the first timer and the second timer may be a 64-bit timestamp.
[0102] Step S402: Determine the target time from the two obtained times. In a specific implementation, the target time may be determined according to whether the clock adopted by the slave clock is a clock in the mobile communication network clock domain or a clock in the time-sensitive network clock domain. If the clock adopted by the slave clock is a clock in the mobile communication network clock domain, the updated current time of the first timer is determined as the target time; if the clock adopted by the slave clock is a clock in the time-sensitive network clock domain, the updated current time of the second timer is determined as the target time.
[0103] Step S403: Set the timestamp of the PTP packet to be sent according to the target time. The PTP packet to be sent may be a synchronization packet, a follow-up packet, or other types of packets.
[0104] Step S404: Send the PTP packet to be sent.
[0105] This embodiment also provides a PTP packet processing device, which is applied to an application processor in a communication device. As Figure 8 shown, the processing device includes a first acquisition module 71, a deviation calculation module 72, a first update module 73, a second update module 74, and a packet sending module 75. The first acquisition module 71 is configured to respectively acquire a first time and a second time in response to receiving a synchronization packet sent by a first node in a mobile communication network through a modem; wherein, the first time is the current time of the first timer, and the second time is the current time of the second timer. The deviation calculation module 72 is configured to calculate a first time deviation based on the first time, the second time, and the time synchronization information in the follow-up packet received from the modem. The first update module 73 is configured to update the current time of the second timer according to the first time deviation. The second update module 74 is configured to update the accurate timestamps in both the synchronization packet and the follow-up packet to the current time of the second timer, and update the correction parameter in the follow-up packet to the correction parameter of the application processor itself. The packet sending module 75 is configured to send the synchronization packet and the follow-up packet to a second node in a time-sensitive network.
[0106] In an alternative embodiment, the time synchronization information in the following message received from the modem includes an accurate timestamp, a correction parameter, the time when the following message enters the mobile communication network, and a frequency ratio. The deviation calculation module is specifically configured to determine a reference time according to the accurate timestamp and the correction parameter; calculate the propagation delay in the mobile communication network according to the difference between the first time and the time when the following message enters the mobile communication network; calculate the propagation delay in the time-sensitive network according to the propagation delay in the mobile communication network and the frequency ratio; calculate the current time of the master clock in the time-sensitive network according to the reference time and the propagation delay in the time-sensitive network; and calculate a first time deviation according to the current time of the master clock in the time-sensitive network and the second time.
[0107] In an alternative embodiment, the processing device further includes a deviation receiving module and a third update module. The deviation receiving module is configured to receive a second time deviation sent by the modem before obtaining the first time; wherein, the second time deviation is determined according to the SIB9 message received by the modem, the current time of the local reference clock after decoding the SIB9 message, and the current time of the first timer. The third update module is configured to update the current time of the first timer according to the second time deviation.
[0108] In an alternative embodiment, the processing device further includes a message receiving module, configured to receive a synchronization message and a following message forwarded by the modem through the hardware accelerator.
[0109] In an alternative embodiment, the processing device further includes a message processing module, configured to obtain the updated current times of the first timer and the second timer through the Ethernet transmission module, determine a target time from the two obtained times, set a timestamp of a PTP message to be sent according to the target time, and send the PTP message to be sent.
[0110] It should be noted that the processing device for PTP messages in this embodiment may specifically be a separate chip, a chip module, or a communication device, or may also be a chip or a chip module integrated in a communication device.
[0111] Regarding each module / unit included in the processing device for PTP messages described in this embodiment, it may be a software module / unit, a hardware module / unit, or may also be partly a software module / unit and partly a hardware module / unit.
[0112] Embodiment 2
[0113] Figure 8Schematic flowchart of a time synchronization method provided in this embodiment. The time synchronization method can be executed by a time synchronization device, which can be implemented in software and / or hardware, and the time synchronization device can be part or all of the modem in the above communication device. The time synchronization method provided in this embodiment will be introduced below with the modem in the above communication device as the execution subject.
[0114] As Figure 9 shown, the time synchronization method provided in this embodiment may include the following steps S501 to S504:
[0115] Step S501, in response to receiving the SIB9 message sent by the third node in the mobile communication network, obtain the current time of the local reference clock. In a specific implementation, the third node in the mobile communication network can be a base station.
[0116] Step S502, in response to completing the decoding of the SIB9 message, obtain the current time of the local reference clock again and obtain the current time of the first timer.
[0117] Step S503, determine the second time deviation according to the time information in the SIB9 message, the difference between the current times of the local reference clock obtained twice, and the current time of the first timer.
[0118] Step S504, send the second time deviation to the application processor, where the second time deviation is used to update the current time of the first timer.
[0119] In a specific implementation, after receiving the SIB9 message, the modem records the current time t01 of the local reference clock. After decoding the SIB9 message, its timestamp T1 is obtained. At this time, the current time t02 of the local reference clock is recorded again, and the current time t03 of the first timer is obtained. Among them, the difference between the two time points of the local reference clock is t02 - t01, the difference between the two time points in the mobile communication network clock domain is t03 - T1, t01 corresponds to the moment when the modem receives T1, t03 corresponds to the time of the first timer at the moment of the local reference clock t02, and the second time deviation offset2 can be obtained according to the difference between (t02 - t01) and (t03 - T1).
[0120] In this embodiment, the modem synchronizes the time of the clock in the mobile communication network clock domain, that is, the time of the first timer, by sending the second time deviation to the application processor.
[0121] In order to further improve the synchronization accuracy, in an alternative embodiment, step S503 specifically includes: compensating the time information in the SIB9 message to obtain the compensated time, and subtracting the difference between the current time of the first timer and the compensated time from the difference between the current times of the local reference clock obtained twice to obtain the second time deviation. For example, the compensated time T can be obtained by adding a preset value to the time stamp T1 in the SIB9 message, and the second time deviation can be calculated according to the following formula: offset2 = (t02 - t01) - (t03 - T). Among them, the preset value can be set according to the actual situation. For example, the preset value can be set using the data received by the communication device. In a specific example, the preset value can be set to TA / 2, where TA is the timing advance.
[0122] This embodiment also provides a time synchronization device, which is applied to a modem in a communication device, as shown. The time synchronization device includes a second acquisition module 91, a third acquisition module 92, a deviation determination module 93, and a deviation sending module 94. The second acquisition module 91 is configured to acquire the current time of the local reference clock in response to receiving the SIB9 message sent by a third node in the mobile communication network. The third acquisition module 92 is configured to acquire the current time of the local reference clock again and acquire the current time of the first timer in response to completing the decoding of the SIB9 message. The deviation determination module 93 is configured to determine the second time deviation according to the time information in the SIB9 message, the difference between the current times of the local reference clock obtained twice, and the current time of the first timer. The deviation sending module 94 is configured to send the second time deviation to the application processor, where the second time deviation is used to update the current time of the first timer.
[0123] In an alternative embodiment, the deviation determination module is specifically configured to compensate the time information in the SIB9 message to obtain the compensated time; and subtract the difference between the current time of the first timer and the compensated time from the difference between the current times of the local reference clock obtained twice to obtain the second time deviation.
[0124] It should be noted that the time synchronization device in this embodiment may specifically be a separate chip, chip module or communication device, or may also be a chip or chip module integrated in the communication device.
[0125] Regarding each module / unit included in the time synchronization device described in this embodiment, it may be a software module / unit, a hardware module / unit, or may also be partly a software module / unit and partly a hardware module / unit.
[0126] Embodiment 3
[0127] This embodiment provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the PTP packet processing method in Embodiment 1 and / or the steps of the time synchronization method in Embodiment 2 are implemented.
[0128] Among them, more specific examples of the readable storage medium may include, but are not limited to: portable disks, hard disks, random access memories, read-only memories, erasable programmable read-only memories, optical storage devices, magnetic storage devices, or any suitable combination of the above.
[0129] In a possible implementation, the present disclosure may also be implemented in the form of a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps of the PTP packet processing method in Embodiment 1 and / or the steps of the time synchronization method in Embodiment 2 are implemented.
[0130] Among them, the computer program for executing the present disclosure can be written in any combination of one or more programming languages. The computer program can be executed entirely on the electronic device, partially on the electronic device, executed as an independent software package, partially on the electronic device and partially on a remote device, or entirely on a remote device.
[0131] Although the specific implementation manners of the present disclosure have been described above, those skilled in the art should understand that this is only an example. The protection scope of the present disclosure is defined by the appended claims. Without departing from the principles and essence of the present disclosure, those skilled in the art can make various changes or modifications to these implementation manners, but these changes and modifications all fall within the protection scope of the present disclosure.
Claims
1. A method for processing PTP packets, characterized in that An application processor applied in a communication device, the communication device further including a modem, a first timer and a second timer, the PTP packets including a synchronization packet and a follow-up packet, the processing method including the following steps: In response to receiving the synchronization packet sent by a first node in a mobile communication network through the modem, respectively obtain a first time and a second time; wherein, the first time is the current time of the first timer, and the second time is the current time of the second timer; Calculate a first time deviation based on the first time, the second time, and the time synchronization information in the follow-up packet received from the modem; Update the current time of the second timer according to the first time deviation; Update the accurate timestamps in both the synchronization packet and the follow-up packet to the current time of the second timer, and update the correction parameter in the follow-up packet to the correction parameter of the application processor itself; Send the synchronization packet and the follow-up packet to a second node in a time-sensitive network.
2. The processing method according to claim 1, wherein, The time synchronization information in the follow-up packet received from the modem includes an accurate timestamp, a correction parameter, the time when the follow-up packet enters the mobile communication network, and a frequency ratio. The step of calculating the first time deviation based on the first time, the second time, and the time synchronization information in the follow-up packet received from the modem specifically includes: determining a reference time according to the accurate timestamp and the correction parameter; Calculate the propagation delay in the mobile communication network according to the difference between the first time and the time when the follow-up packet enters the mobile communication network; Calculate the propagation delay in the time-sensitive network according to the propagation delay in the mobile communication network and the frequency ratio; Calculate the current time of the master clock in the time-sensitive network according to the reference time and the propagation delay in the time-sensitive network; Calculate the first time deviation according to the current time of the master clock in the time-sensitive network and the second time.
3. The processing method according to claim 1, characterized in that, Before obtaining the first time, the following steps are further included: Receive a second time deviation sent by the modem; wherein, the second time deviation is determined according to the SIB9 message received by the modem, the current time of the local reference clock after decoding the SIB9 message, and the current time of the first timer; Update the current time of the first timer according to the second time deviation.
4. The processing method according to claim 1, characterized in that The communication device further includes an IP packet hardware accelerator, and the processing method further includes: Receive the synchronization packet and the follow-up packet forwarded by the modem through the hardware accelerator.
5. The processing method according to any one of claims 1-4, characterized in that The communication device further includes an Ethernet transmission module, and the processing method further includes: Obtain the updated current times of the first timer and the second timer through the Ethernet transmission module; Determine a target time from the two obtained times; Set the timestamp of the PTP packet to be sent according to the target time; Send the PTP packet to be sent.
6. A time synchronization method, characterized in that, A modem applied to a communication device, the communication device further including an application processor, a first timer, and a second timer, the time synchronization method including the following steps: In response to receiving an SIB9 message sent by a third node in a mobile communication network, obtain the current time of a local reference clock; In response to completing the decoding of the SIB9 message, obtain the current time of the local reference clock again and obtain the current time of the first timer; Determine a second time deviation according to the time information in the SIB9 message, the difference between the current times of the local reference clock obtained twice, and the current time of the first timer; Send the second time deviation to the application processor, where the second time deviation is used to update the current time of the first timer.
7. The time synchronization method according to claim 6, wherein The step of determining the second time deviation according to the time information in the SIB9 message, the difference between the current times of the local reference clock obtained twice, and the current time of the first timer specifically includes: Compensate the time information in the SIB9 message to obtain a compensated time; Subtract the difference between the current time of the first timer and the compensated time from the difference between the current times of the local reference clock obtained twice to obtain a second time deviation.
8. A processing device for PTP packets, characterized in that, An application processor applied to a communication device, the communication device further including a modem, a first timer, and a second timer, the PTP packet including a synchronization packet and a follow-up packet, the processing device including: A first obtaining module, configured to, in response to receiving a synchronization packet sent by a first node in a mobile communication network through the modem, obtain a first time and a second time respectively; where the first time is the current time of the first timer, and the second time is the current time of the second timer; A deviation calculation module, configured to calculate a first time deviation based on the first time, the second time, and time synchronization information in the follow-up packet received from the modem; A first update module, configured to update the current time of the second timer according to the first time deviation; A second update module, configured to update the accurate timestamps in the synchronization packet and the follow-up packet to the current time of the second timer, and update the correction parameter in the follow-up packet to the correction parameter of the application processor itself; A packet sending module, configured to send the synchronization packet and the follow-up packet to a second node in a time-sensitive network.
9. A time synchronization device, characterized in that, A modem applied to a communication device, the communication device further including an application processor, a first timer, and a second timer, the time synchronization device including: A second obtaining module, configured to, in response to receiving an SIB9 message sent by a third node in a mobile communication network, obtain the current time of a local reference clock; A third obtaining module, configured to, in response to completing the decoding of the SIB9 message, obtain the current time of the local reference clock again and obtain the current time of the first timer; A deviation determination module, configured to determine a second time deviation according to the time information in the SIB9 message, the difference between the current times of the local reference clock obtained twice, and the current time of the first timer; A deviation sending module, configured to send the second time deviation to the application processor, where the second time deviation is used to update the current time of the first timer.
10. A communication device, characterized in that, Comprising an application processor, a modem, a first timer, and a second timer, the application processor is configured to execute the PTP packet processing method according to any one of claims 1-5, and / or the modem is configured to execute the time synchronization method according to any one of claims 6-7.
11. A chip, applied to a communication device, characterized in that, The chip is used to execute the PTP packet processing method according to any one of claims 1-5 and / or the time synchronization method according to any one of claims 6-7.
12. A chip module, applied to a communication device, characterized in that Comprising a chip, the chip is used to execute the PTP packet processing method according to any one of claims 1-5 and / or the time synchronization method according to any one of claims 6-7.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the PTP packet processing method according to any one of claims 1-5 and / or the time synchronization method according to any one of claims 6-7.
14. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the PTP packet processing method according to any one of claims 1-5 and / or the time synchronization method according to any one of claims 6-7.