Clock synchronization method and device, terminal and computer readable storage medium

By determining the master-slave clock relationship and using wireless cellular modules and device-to-device communication, the problem of terminal clock synchronization in wireless network architecture is solved, and high-precision clock synchronization is achieved in the case of interruption and uninterrupted wireless cellular network, meeting the real-time requirements of industrial communication.

CN120417005APending Publication Date: 2025-08-01CHINA MOBILE COMM LTD RES INST +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410138550.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-31
Publication Date
2025-08-01

AI Technical Summary

Technical Problem

In wireless networking architecture, how industrial terminals can achieve high-precision clock synchronization has become an urgent problem, especially in the case of interruption of wireless cellular networks, it is difficult for the prior art to ensure clock synchronization between terminals.

Method used

By determining the master-slave clock relationship, the wireless cellular module is used as the master clock to perform clock synchronization when the wireless cellular network is not interrupted, and the device-to-device communication method is used to realize clock synchronization between terminals when the network is interrupted, including the base station determining terminal device information, pre-configuration information, and the direct communication method determine the master-slave clock relationship, and calculate the clock deviation for synchronization.

Benefits of technology

It realizes high-precision clock synchronization between terminals in the case of interruption and uninterrupted wireless cellular network, ensuring real-time and accuracy of industrial communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120417005A_ABST
    Figure CN120417005A_ABST
Patent Text Reader

Abstract

The invention discloses a clock synchronization method and device, a terminal and a computer readable storage medium, and the method comprises the steps: determining a master-slave clock relation which represents a relation between a master clock terminal and a slave clock terminal; a second terminal having the master-slave clock relation with the first terminal is determined, the first terminal serves as the slave clock terminal, and the second terminal serves as the master clock terminal; and performing clock synchronization with the second terminal.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of wireless technologies, and in particular, to a clock synchronization method and apparatus, a terminal, and a computer-readable storage medium. Background Art

[0002] With the rapid development of technologies in the industrial field, industries such as motion control, servo, and robotics have developed rapidly, thereby promoting the development of industrial real-time communication technologies. In industrial real-time communication technologies, due to the relatively strict requirements for data transmission timeliness, industrial terminals need to perform clock synchronization with high precision.

[0003] Previous industrial networking was a wired networking architecture, and industrial terminals were connected to other devices in a wired manner. With the gradual penetration of wireless communication technologies into the industrial field, industrial networking has evolved into a wireless networking architecture, and industrial terminals can be connected to other devices wirelessly. In a wireless networking architecture, it is necessary to clarify how industrial terminals achieve clock synchronization. Summary of the Invention

[0004] This application provides a clock synchronization method and apparatus, a terminal, a chip, a computer-readable storage medium, and a computer program product.

[0005] The clock synchronization method provided by this application includes:

[0006] Determine a master-slave clock relationship, where the master-slave clock relationship represents the relationship between a master clock terminal and a slave clock terminal;

[0007] Determine a second terminal having the master-slave clock relationship with the first terminal, where the first terminal serves as the slave clock terminal and the second terminal serves as the master clock terminal;

[0008] Synchronize the clock with the second terminal.

[0009] The clock synchronization apparatus provided by this application is applied to a first terminal and includes:

[0010] A first determination unit for determining a master-slave clock relationship, where the master-slave clock relationship represents the relationship between a master clock terminal and a slave clock terminal;

[0011] A second determination unit for determining a second terminal having the master-slave clock relationship with the first terminal, where the first terminal serves as the slave clock terminal and the second terminal serves as the master clock terminal;

[0012] A clock synchronization unit for synchronizing the clock with the second terminal.

[0013] The terminal provided by this application includes a processor and a memory. The memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to execute any of the above clock synchronization methods.

[0014] The chip provided by this application includes a processor, which is used to call and run a computer program from a memory, so that a device installed with the chip executes any of the above clock synchronization methods.

[0015] The computer-readable storage medium provided by this application is used to store a computer program, and the computer program enables a computer to execute any of the above clock synchronization methods.

[0016] The computer program product provided by this application includes computer program instructions, and the computer program instructions enable a computer to execute any of the above clock synchronization methods.

[0017] In the technical solution of this application, the first terminal determines that the master clock terminal corresponding to the first terminal as a slave clock terminal is the second terminal based on the master-slave clock relationship, and the first terminal synchronizes the clock with the second terminal, realizing clock synchronization between terminals in a wireless networking architecture. Even in the case of interruption of the wireless cellular network, clock synchronization between terminals can still be achieved through the technical solution of this application. Description of the Drawings

[0018] Figure 1 It is a schematic diagram of a TSN multi-master-slave clock timing architecture;

[0019] Figure 2 It is a flowchart of the clock synchronization method provided by an embodiment of this application Figure 1 ;

[0020] Figure 3 It is a schematic flowchart of the terminal determining the master clock provided by an embodiment of this application;

[0021] Figure 4 It is a schematic diagram of the wireless cellular network module as the master clock provided by an embodiment of this application;

[0022] Figure 5 It is a flowchart of the clock synchronization method provided by an embodiment of this application Figure 2 ;

[0023] Figure 6 It is a schematic diagram of the structure composition of the clock synchronization device provided by an embodiment of this application;

[0024] Figure 7 It is a schematic structural diagram of a terminal provided by an embodiment of this application;

[0025] Figure 8It is a schematic structural diagram of the chip according to an embodiment of the present application. Detailed implementation manners

[0026] Next, the technical solutions in the embodiments of the present application will be described with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.

[0027] It should be noted that the term "and / or" in this article is only a description of the association relationship between associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " in this article generally represents an "or" relationship between the front and rear associated objects. It should also be understood that the "indication" mentioned in the embodiments of the present application can be a direct indication, an indirect indication, or a representation of an association relationship. It should also be understood that the "correspondence" mentioned in the embodiments of the present application can represent a direct or indirect corresponding relationship between the two, can also represent an association relationship between the two, can also be an indication and being indicated, a configuration and being configured, and other relationships. It should also be understood that the "predefined" or "predefined rule" mentioned in the embodiments of the present application can be implemented by pre-saving corresponding codes, tables, or other means that can be used to indicate relevant information in the device. The present application does not limit its specific implementation manner.

[0028] To facilitate the understanding of the technical solutions in the embodiments of the present application, the related technologies in the embodiments of the present application are described below. The following related technologies can be arbitrarily combined with the technical solutions in the embodiments of the present application as optional solutions, and they all fall within the protection scope of the embodiments of the present application.

[0029] At the present stage, most industrial sites use wired networking. For example: Programmable Logic Controller (PLC) is connected southward to industrial terminal actuators in a wired manner, and data is transmitted between the PLC and the industrial terminal actuators through the industrial ether protocol; the industrial terminal actuators are connected southward to physical devices in a wired manner, and data is transmitted between the industrial terminal actuators and the physical devices through the industrial bus protocol. As wireless communication technology gradually penetrates into the industrial field, industrial sites have evolved into wireless networking. For example: PLCs are deployed on the edge cloud side, and industrial terminals are wirelessly connected to the PLCs.

[0030] In industrial real-time communication technology, due to the relatively strict requirements for data transmission real-time performance, industrial terminals need to perform clock synchronization with high precision. Most clock synchronization is based on master-slave clock synchronization, that is, the slave clock synchronizes with the master clock. For example, Time-Sensitive Networking (TSN) follows multi-master-slave clock synchronization. As Figure 1 shown, between the clock source (referred to as Grand Master) and the switch, the clock of the clock source is the master clock (Master Clock, abbreviated as M), and the clock of the switch is the slave clock (Slave Clock, abbreviated as S). Between the switch and the end node (EndNode), the clock of the switch is the master clock, and the clock of the end node is the slave clock. It should be emphasized that the master clock and the slave clock are relative. For example, the clock of device A is the master clock relative to the clock of device B, but the clock of device A is the slave clock relative to the clock of device C.

[0031] After the industrial field evolves from wired networking to wireless networking, it is necessary to clarify how industrial terminals achieve clock synchronization. For this reason, the following technical solutions of the embodiments of this application are proposed.

[0032] To facilitate the understanding of the technical solutions of the embodiments of this application, the technical solutions of this application are described in detail below through specific embodiments. The above related technologies can be arbitrarily combined with the technical solutions of the embodiments of this application as optional solutions, and they all belong to the protection scope of the embodiments of this application. The embodiments of this application include at least some of the following contents.

[0033] It should be noted that the terminal described in the embodiments of this application can be but is not limited to an industrial terminal, such as a controller, an input / output (IO) device, etc.

[0034] On the one hand, in the case where the wireless cellular network is not interrupted, the terminal's clock synchronization is achieved through the wireless cellular module as the master clock; on the other hand, in the case where the wireless cellular network is interrupted, the terminal's clock synchronization is achieved through the Device to Device (D2D) communication method. Here, the D2D communication method can also be described as the terminal direct communication method or the sidelink communication method.

[0035] It should be noted that the wireless cellular module described in the embodiments of this application can also be described as a wireless cellular device or a wireless cellular equipment or a wireless cellular terminal.

[0036] It should be noted that the master clock terminal described in the embodiments of this application refers to a terminal with a master clock; the slave clock terminal described in the embodiments of this application refers to a terminal with a slave clock. The relationship between the master clock terminal and the slave clock terminal is relative. For example: between terminal A and terminal B, terminal A is the master clock terminal and terminal B is the relative slave clock terminal, and terminal B synchronizes its clock to terminal A. Between terminal B and terminal C, terminal B is the master clock terminal and terminal C is the relative slave clock terminal, and terminal C synchronizes its clock to terminal B.

[0037] Figure 2 is a flowchart of the clock synchronization method provided by the embodiments of this application Figure 1 as Figure 2 shown, the clock synchronization method includes:

[0038] Step 201: The first terminal determines the master-slave clock relationship, which characterizes the relationship between the master clock terminal and the slave clock terminal.

[0039] Here, the first terminal can determine the master-slave clock relationship through the following solutions:

[0040] Solution 1: The first terminal receives the master-slave clock relationship sent by the base station, where the master-slave clock relationship is determined by the base station based on the device information of each terminal within the cell corresponding to the base station.

[0041] In the embodiments of this application, the base station can obtain the device information of the terminal in the following ways:

[0042] Method 1: The first terminal reports the terminal capability information of the first terminal to the base station. The terminal capability information of the first terminal includes the device information of the first terminal, and the device information of the first terminal includes one or more of the following: the device name of the first terminal, the device type of the first terminal, and the device location of the first terminal.

[0043] Exemplarily, when the terminal initially accesses the network, it can carry the device information of the terminal through the reported terminal capability information. Table 1 below gives the content of the terminal capability information. Among them, E-NR-Capability represents the terminal capability information. In addition to including the conventional terminal capability parameters, the terminal capability information also includes extended information (corresponding to nonCriticalExtension in Table 1), and the content of this extended information is the device information of the terminal (corresponding to UE-NR-industry UE-Capability in Table 1). Among them, the device information includes the device name (corresponding to name_Device in Table 1), the device type (corresponding to Type_Device in Table 1), and the device location (corresponding to position_Device in Table 1).

[0044]

[0045] Table 1

[0046] The above-mentioned first method can be understood as a method in which the terminal actively reports device information.

[0047] Second method: The first terminal receives a system broadcast message sent by the base station. The system broadcast message is used to request each terminal within the cell corresponding to the base station to report device information; based on the system broadcast message, the first terminal reports the device information of the first terminal to the base station. The device information of the first terminal includes one or more of the following: the device name of the first terminal, the device type of the first terminal, and the device location of the first terminal.

[0048] Here, the system broadcast message can be, for example, System Information Block 1 (SIB1).

[0049] Exemplarily, the base station sends SIB1 to each terminal inside the cell. In addition to including conventional system information, SIB1 also includes extended information (corresponding to nonCriticalExtension in Table 2), and the content of this extended information is a request for device information (corresponding to SIB1-industry UE-informationRequest in Table 2). Among them, the request for device information includes the requested device name (corresponding to name_Device in Table 2), device type (corresponding to Type_Device in Table 2), and device location (corresponding to position_Device in Table 2). Since the Physical Downlink Shared Channel (PDSCH) where SIB1 is located is scheduled by a Physical Downlink Control Channel (PDCCH) scrambled with a System Information - RadioNetwork Temporary Indentifier (SI-RNTI), the terminal performs PDCCH parsing through SI-RNTI, obtains the scheduling information of SIB1 according to the decoded PDCCH, receives SIB1 on the PDSCH according to the scheduling information of SIB1, and then obtains the request for device information from SIB1 and reports its own device information according to this request for device information.

[0050]

[0051] Table 2

[0052] The above-mentioned second method can be understood as a method for the base station to trigger the terminal to report device information.

[0053] The above master-slave clock relationship includes the clock relationships of one or more terminal groups. Among them, the clock relationship of a terminal group includes the clock relationships among the terminals within the terminal group.

[0054] Exemplarily, the base station receives the device information of multiple terminals, groups the multiple terminals according to the device names and / or device types of the multiple terminals, and obtains one or more terminal groups. For each terminal group, the base station determines the primary clock terminal within the terminal group according to the device locations of the terminals within the terminal group. For example: the base station can determine the terminal (hereinafter referred to as terminal 1 for ease of description) within the terminal group that is closest to the center position in the coverage area or closest to the base station as the primary clock terminal within the terminal group; the base station sends the indication information of the primary clock terminal and the device information of each terminal within the terminal group to terminal 1; terminal 1 determines the secondary clock terminal (hereinafter referred to as terminal 2 for ease of description) within the terminal group according to the information sent by the base station, and sends the indication information of the secondary clock terminal and the device information of each terminal within the terminal group to terminal 2; and so on, the clock terminal levels corresponding to each terminal within the terminal group can be determined. The clock of the primary clock terminal can be used as the master clock of the secondary clock terminal, and the clock of the secondary clock terminal can be used as the master clock of the tertiary clock terminal, and so on, the clock relationships among the terminals within the terminal group can be determined. It can be understood that the clock relationships among the terminals within a terminal group can form a tree structure.

[0055] It should be noted that different terminal groups can also correspond to different priorities. For example: the priority of the terminal group of the controller type is higher than the priority of the terminal groups of other types. The priority of the clock corresponding to the terminal group with a higher priority is also higher, or rather, the clock corresponding to the terminal group with a higher priority is preferentially used as the master clock.

[0056] Solution 2: The first terminal determines the master-slave clock relationship based on pre-configured information, where the pre-configured information is determined based on the device information of each terminal among multiple terminals during the network configuration process of the multiple terminals, and the multiple terminals include the first terminal. The device information here includes one or more of the following: device name, device type, and device location.

[0057] The above master-slave clock relationship includes the clock relationships of one or more terminal groups, and the clock relationship of a terminal group includes the clock relationships among the terminals within the terminal group.

[0058] Exemplarily, during the industrial network configuration process, multiple terminals participating in the network configuration can be grouped according to the device names and / or device types of each terminal among the multiple terminals, resulting in one or more terminal groups. For each terminal group, a primary clock terminal within the terminal group is determined according to the device locations of the terminals within the terminal group. For example, the terminal within the terminal group that is closest to the center position in the coverage area or closest to the base station can be determined as the primary clock terminal within the terminal group. Further, the secondary clock terminal within the terminal group is determined, and so on, and the clock terminal levels corresponding to each terminal within the terminal group can be determined. The clock of the primary clock terminal can be used as the master clock of the secondary clock terminal, the clock of the secondary clock terminal can be used as the master clock of the tertiary clock terminal, and so on, and the clock relationship between each terminal within the terminal group can be determined. It can be understood that the clock relationship between each terminal within a terminal group can form a tree structure.

[0059] It should be noted that different terminal groups can also correspond to different priorities. For example, the priority of a terminal group of the controller type is higher than the priority of other types of terminal groups. The priority of the clock corresponding to a terminal group with a higher priority is also higher, or rather, the clock corresponding to a terminal group with a higher priority is preferentially used as the master clock.

[0060] Solution 3: The first terminal sends a master clock request message to N terminals, where N is a positive integer; the first terminal receives master clock acceptance messages sent by M terminals among the N terminals, where M is a positive integer less than or equal to N; the first terminal selects one terminal from the M terminals as the master clock terminal of the first terminal, and determines the master-slave clock relationship based on the selected master clock terminal.

[0061] Exemplarily, terminals can establish a direct connection or a sidelink connection through a specified frequency band, so as to communicate between terminals through this direct connection or sidelink connection. As Figure 3As shown, UE1 corresponds to the first terminal, and the surrounding terminals correspond to N terminals. During the establishment of a direct connection or sidelink connection: 1) UE1 sends sidelink UE capability enquiry information to the surrounding terminals, and the main clock request information is carried in the sidelink UE capability enquiry; 2) After receiving the main clock request information, the surrounding terminals send sidelink UE capability information to UE1, and the information on whether to accept the main clock request, such as the main clock acceptance information or the main clock rejection information, is carried in the sidelink UE capability information; 3) UE1 randomly / selects a terminal (denoted as UE2) from all the terminals that return the main clock acceptance information based on a certain fixed principle (such as the terminal closest to UE1) as the main clock terminal of UE1; UE1 sends a sidelink measurement report to UE2, and the main clock confirmation information is carried in the sidelink measurement report. After receiving the main clock confirmation information, UE can only be the main clock terminal of UE1 and cannot be the main clock terminal of other terminals. By performing the above process once or multiple times, a clock synchronization path (which can have a single path or multiple paths) within the area can be finally formed. For two adjacent terminals on the clock synchronization path, one terminal is the main clock terminal, and the other terminal is the slave clock terminal relatively.

[0062] Step 202: The first terminal determines a second terminal having a master-slave clock relationship with the first terminal; the first terminal synchronizes the clock with the second terminal.

[0063] Here, in the master-slave clock relationship, the first terminal acts as the slave clock terminal, and the second terminal acts as the master clock terminal. The first terminal can synchronize the clock with the second terminal.

[0064] In the embodiment of the present application, the first terminal synchronizes the clock with the second terminal, which can be achieved through the following process:

[0065] 1) The first terminal sends a first message to the second terminal. The first message carries a first time, and the first time is the sending time of the first message on the side of the first terminal. The receiving time of the first message on the side of the second terminal is the second time;

[0066] 2) The first terminal receives a second message sent by the second terminal. The second message carries the second time and a third time, and the third time is the sending time of the second message on the side of the second terminal. The receiving time of the second message on the side of the first terminal is the fourth time;

[0067] 3) The first terminal calculates the clock deviation between the first terminal and the second terminal based on the first time, the second time, the third time, and the fourth time;

[0068] 4) The first terminal adjusts the clock of the first terminal based on the clock deviation between the first terminal and the second terminal, and the clock of the adjusted first terminal is synchronized with the clock of the second terminal.

[0069] Exemplarily, the first time is t1, the second time is t2, the third time is t3, the fourth time is t4, the path transmission delay between the first terminal and the second terminal is path_delay, and the clock deviation between the clock of the first terminal and the clock of the second terminal is clock_offset. Then the following formula holds:

[0070] t2 - t1 = path_delay + clock_offset;

[0071] t4 - t3 = path_delay - clock_offset;

[0072] Thus, it can be calculated that:

[0073] path_delay = (t4 - t3 + t2 - t1) / 2;

[0074] clock_offset = (t3 - t4 + t2 - t1) / 2;

[0075] Assume that the clock of the first terminal is clock_1 and the clock of the second terminal is clock_2. Then there is:

[0076] clock_1 + clock_offset = clock_2.

[0077] That is to say, adding the clock deviation to the clock of the first terminal can achieve clock synchronization with the second terminal.

[0078] As an implementation method, in the case of a wireless cellular network interruption, the first terminal achieves clock synchronization with the second terminal through the above solution.

[0079] As another implementation method, in the case of a non-interrupted wireless cellular network, the first terminal synchronizes the clock with the wireless cellular module.

[0080] Here, the first terminal synchronizes the clock with the wireless cellular module, which can be achieved through the following solution:

[0081] Solution A: The first terminal receives the clock information sent by the wireless cellular module; the first terminal synchronizes the clock with the wireless cellular module based on the clock information.

[0082] Solution B: The first terminal sends the third information to the wireless cellular module. The third information carries the fifth time, where the fifth time is the transmission time of the third information at the first terminal side, and the reception time of the third information at the wireless cellular module side is the sixth time. The first terminal receives the fourth information sent by the wireless cellular module. The fourth information carries the sixth time and the seventh time, where the seventh time is the transmission time of the fourth information at the wireless cellular module side, and the reception time of the fourth information at the first terminal side is the eighth time. The first terminal calculates the clock deviation between the first terminal and the wireless cellular module based on the fifth time, the sixth time, the seventh time, and the eighth time. The first terminal adjusts the clock of the first terminal based on the clock deviation between the first terminal and the wireless cellular module, and the adjusted clock of the first terminal is synchronized with the clock of the wireless cellular module.

[0083] Here, in a wireless environment, the first terminal can access the wireless cellular network through the wireless cellular module. On the premise that the wireless cellular network already has high-precision timing, the first terminal can achieve clock synchronization with the wireless cellular module as the master station.

[0084] Exemplarily, as Figure 4 shown, the clock of the wireless cellular network module is used as the master clock, and the clock of the industrial terminal is used as the slave clock. The method for the industrial terminal to synchronize the clock with the wireless cellular network module can be:

[0085] 1) The wireless cellular module directly sends its own clock information in a specific form (such as industrial Ethernet semantics or other forms) to the industrial terminal, and the industrial terminal synchronizes the clock according to this clock information.

[0086] 2) The industrial terminal sends Information 1 to the wireless cellular module. Information 1 carries t1, where t1 is the transmission time of Information 1 at the industrial terminal side, and the reception time of Information 1 at the wireless cellular module side is t2. The industrial terminal receives Information 2 sent by the wireless cellular module. Information 2 carries t2 and t3, where t3 is the transmission time of Information 2 at the wireless cellular module side, and the reception time of Information 2 at the industrial terminal side is t4. The industrial terminal calculates the clock deviation between the industrial terminal and the wireless cellular module based on t1, t2, t3, and t4 as clock_offset = (t3 - t4 + t2 - t1) / 2. The industrial terminal can achieve clock synchronization with the wireless cellular module by adding this clock deviation to its own clock.

[0087] On the one hand, the technical solution of the embodiment of the present application proposes an architecture for realizing the clock synchronization of the terminal by using the wireless cellular module as the master clock. On the other hand, after the wireless cellular network is interrupted, the terminal can establish the master-slave clock relationship through base station designation or configuration designation or during the direct communication between terminals, and then realize the clock synchronization between terminals through D2D based on this master-slave clock relationship.

[0088] Figure 5 Schematic flow diagram of the clock synchronization method provided by an embodiment of this application Figure 2 As shown in Figure 5 the clock synchronization method includes:

[0089] Step 501: UE B sends inter-UE coordination trigger information to UE A, carrying the transmission time t1 of this information.

[0090] Step 502: UE A records the reception time t2 of the inter-UE coordination trigger information and determines the preferred or non-preferred resources.

[0091] Step 503: UE A sends a Resource set report information to UE B, carrying the transmission time t3 and t2 of this information.

[0092] Step 504: UE B records the reception time t4 of the Resource set report information, performs clock synchronization based on the obtained time, and selects resources based on the Resource set report information.

[0093] Here, UE B can calculate the clock deviation between UE B and UE A as clock_offset = (t3 - t4 + t2 - t1) / 2 according to t1, t2, t3, and t4; UE B can achieve clock synchronization with UE A by adding this clock deviation to its own clock.

[0094] Step 505: After clock synchronization, UE B performs sidelink data transmission to UE A.

[0095] Figure 6 Schematic diagram of the structural composition of the clock synchronization device provided by an embodiment of this application, applied to a first terminal, as shown in Figure 6 the clock synchronization device includes:

[0096] The first determination unit 601 is configured to determine the master-slave clock relationship, where the master-slave clock relationship represents the relationship between the master clock terminal and the slave clock terminal;

[0097] The second determination unit 602 is configured to determine a second terminal having the master-slave clock relationship with the first terminal, where the first terminal serves as the slave clock terminal and the second terminal serves as the master clock terminal;

[0098] The clock synchronization unit 603 is configured to perform clock synchronization with the second terminal.

[0099] In an embodiment of this application, the device further includes: a communication unit 604.

[0100] In some embodiments, the communication unit 604 is configured to receive the master-slave clock relationship sent by the base station, where the master-slave clock relationship is determined by the base station based on the device information of each terminal within the cell corresponding to the base station. The first determination unit 601 is specifically configured to determine the master-slave clock relationship according to the master-slave clock relationship sent by the base station.

[0101] In some embodiments, the communication unit 604 is further configured to report the terminal capability information of the first terminal to the base station, where the terminal capability information of the first terminal includes the device information of the first terminal, and the device information of the first terminal includes one or more of the following: the device name of the first terminal, the device type of the first terminal, and the device location of the first terminal.

[0102] In some embodiments, the communication unit 604 is further configured to receive the system broadcast message sent by the base station, where the system broadcast message is used to request each terminal within the cell corresponding to the base station to report device information; and report the device information of the first terminal to the base station, where the device information of the first terminal includes one or more of the following: the device name of the first terminal, the device type of the first terminal, and the device location of the first terminal.

[0103] In some embodiments, the first determination unit 601 is specifically configured to determine the master-slave clock relationship based on pre-configured information, where the pre-configured information is determined based on the device information of each terminal among multiple terminals during the network configuration process of the multiple terminals, and the multiple terminals include the first terminal.

[0104] In some embodiments, the device information includes one or more of the following: device name, device type, and device location.

[0105] In some embodiments, the master-slave clock relationship includes the clock relationships of one or more terminal groups, and the clock relationship of a terminal group includes the clock relationships among the terminals within the terminal group.

[0106] In some embodiments, the communication unit 604 is configured to send master clock request information to N terminals, where N is a positive integer; receive master clock acceptance information sent by M terminals among the N terminals, where M is a positive integer less than or equal to N; select one terminal from the M terminals as the master clock terminal of the first terminal, and determine the master-slave clock relationship based on the selected master clock terminal.

[0107] In some embodiments, the communication unit 604 is further configured to send a first piece of information to the second terminal, where the first piece of information carries a first time, and the first time is the sending time of the first piece of information on the first terminal side, and the receiving time of the first piece of information on the second terminal side is a second time; receive a second piece of information sent by the second terminal, where the second piece of information carries the second time and a third time, and the third time is the sending time of the second piece of information on the second terminal side, and the receiving time of the second piece of information on the first terminal side is a fourth time;

[0108] The clock synchronization unit 603 is configured to calculate a clock deviation between the first terminal and the second terminal based on the first time, the second time, the third time, and the fourth time; adjust the clock of the first terminal based on the clock deviation between the first terminal and the second terminal, and the adjusted clock of the first terminal is synchronized with the clock of the second terminal.

[0109] In some embodiments, the clock synchronization unit 603 is specifically configured to perform clock synchronization with the second terminal when the wireless cellular network is interrupted; perform clock synchronization with the wireless cellular module when the wireless cellular network is not interrupted.

[0110] In some embodiments, the communication unit 604 is further configured to receive clock information sent by the wireless cellular module; the clock synchronization unit 603 is further configured to perform clock synchronization with the wireless cellular module based on the clock information.

[0111] In some embodiments, the communication unit 604 is further configured to send a third piece of information to the wireless cellular module, where the third piece of information carries a fifth time, and the fifth time is the sending time of the third piece of information on the first terminal side, and the receiving time of the third piece of information on the wireless cellular module side is a sixth time; receive a fourth piece of information sent by the wireless cellular module, where the fourth piece of information carries the sixth time and a seventh time, and the seventh time is the sending time of the fourth piece of information on the wireless cellular module side, and the receiving time of the fourth piece of information on the first terminal side is an eighth time;

[0112] The clock synchronization unit 603 is further configured to calculate a clock deviation between the first terminal and the wireless cellular module based on the fifth time, the sixth time, the seventh time, and the eighth time; adjust the clock of the first terminal based on the clock deviation between the first terminal and the wireless cellular module, and the adjusted clock of the first terminal is synchronized with the clock of the wireless cellular module.

[0113] Those skilled in the art should understand, Figure 6The implementation functions of the units in the clock synchronization device shown can be understood with reference to the relevant descriptions of the foregoing method. Figure 6 The functions of the units in the clock synchronization device shown can be implemented by a program running on a processor or by specific logic circuits.

[0114] Figure 7 It is a schematic structural diagram of a terminal provided by an embodiment of the present application. Figure 7 The terminal shown includes a processor 710, and the processor 710 can call and run a computer program from a memory to implement the method in the embodiment of the present application.

[0115] Optionally, as Figure 7 shown, the terminal may further include a memory 720. Among them, the processor 710 can call and run a computer program from the memory 720 to implement the method in the embodiment of the present application.

[0116] Among them, the memory 720 can be a separate device independent of the processor 710 or integrated in the processor 710.

[0117] Optionally, as Figure 7 shown, the terminal may further include a transceiver 730. The processor 710 can control the transceiver 730 to communicate with other devices. Specifically, it can send information or data to other devices or receive information or data sent by other devices.

[0118] Among them, the transceiver 730 can include a transmitter and a receiver. The transceiver 730 may further include an antenna, and the number of antennas can be one or more.

[0119] This terminal can implement the corresponding processes implemented by the network device in each method of the embodiment of the present application. For the sake of brevity, it will not be elaborated here.

[0120] Figure 8 It is a schematic structural diagram of a chip provided by an embodiment of the present application. Figure 8 The chip shown includes a processor 810, and the processor 810 can call and run a computer program from a memory to implement the method in the embodiment of the present application.

[0121] Optionally, as Figure 8 shown, the chip may further include a memory 820. Among them, the processor 810 can call and run a computer program from the memory 820 to implement the method in the embodiment of the present application.

[0122] Among them, the memory 820 can be a separate device independent of the processor 810 or integrated in the processor 810.

[0123] Optionally, the chip may further include an input interface 830. Among them, the processor 810 may control the input interface 830 to communicate with other devices or chips. Specifically, it may obtain information or data sent by other devices or chips.

[0124] Optionally, the chip may further include an output interface 840. Among them, the processor 810 may control the output interface 840 to communicate with other devices or chips. Specifically, it may output information or data to other devices or chips.

[0125] The chip may implement the corresponding processes implemented by the terminal in each method of the embodiments of the present application. For the sake of brevity, details are not described herein again.

[0126] It should be understood that the chip mentioned in the embodiments of the present application may also be referred to as a system-on-chip, system chip, chip system, or system-on-chip.

[0127] It should be understood that the processor in the embodiments of the present application may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method embodiments may be completed by the integrated logic circuit in the hardware of the processor or by instructions in software form. The above processor may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor, or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present application may be directly embodied as being executed and completed by the hardware decoding processor, or by a combination of the hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and combines its hardware to complete the steps of the above method.

[0128] It can be understood that the memory in the embodiments of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchlink dynamic random access memory (SLDRAM), and direct rambus random access memory (DR RAM). It should be noted that the memory of the systems and methods described herein is intended to include but not be limited to these and any other suitable types of memory.

[0129] It should be understood that the above memory is by way of example but not limitation. For example, the memory in the embodiments of the present application can also be a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDR SDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synch link dynamic random access memory (SLDRAM), and a direct rambus random access memory (DR RAM), etc. That is to say, the memory in the embodiments of the present application is intended to include but not be limited to these and any other suitable types of memory.

[0130] The embodiments of the present application also provide a computer-readable storage medium for storing a computer program. The computer-readable storage medium can be applied to the terminal in the embodiments of the present application, and the computer program enables the computer to execute the corresponding processes implemented by the terminal in the various methods of the embodiments of the present application. For the sake of brevity, it will not be elaborated here.

[0131] The embodiments of the present application also provide a computer program product including computer program instructions. The computer program product can be applied to the terminal in the embodiments of the present application, and the computer program instructions enable the computer to execute the corresponding processes implemented by the terminal in the various methods of the embodiments of the present application. For the sake of brevity, it will not be elaborated here.

[0132] The embodiments of the present application also provide a computer program. The computer program can be applied to the terminal in the embodiments of the present application. When the computer program runs on the computer, it enables the computer to execute the corresponding processes implemented by the terminal in the various methods of the embodiments of the present application. For the sake of brevity, it will not be elaborated here.

[0133] Those of ordinary skill in the art can realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.

[0134] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments, and will not be elaborated here.

[0135] In several embodiments provided by the present application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division, and there can be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be in an electrical, mechanical, or other form.

[0136] The unit described as a separation component may or may not be physically separated. The component shown as a unit may or may not be a physical unit, that is, it may be located in one place or may be distributed over multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0137] In addition, in each embodiment of the present application, each functional unit may be integrated in a processing unit, may exist physically alone for each unit, or two or more units may be integrated in one unit.

[0138] If the above function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art or part of this technical solution can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs that can store program codes.

[0139] The above is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present application can easily think of changes or substitutions, which should all be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A clock synchronization method, characterized in that Applied to a first terminal, the method includes: Determine a master-slave clock relationship, which characterizes the relationship between a master clock terminal and a slave clock terminal; Determine a second terminal having the master-slave clock relationship with the first terminal, where the first terminal serves as the slave clock terminal and the second terminal serves as the master clock terminal; Perform clock synchronization with the second terminal.

2. The method according to claim 1, wherein The determining the master-slave clock relationship includes: Receive the master-slave clock relationship sent by the base station, where the master-slave clock relationship is determined by the base station based on the device information of each terminal within the cell corresponding to the base station.

3. The method according to claim 2, characterized in that, Before receiving the master-slave clock relationship sent by the base station, the method further includes: Report the terminal capability information of the first terminal to the base station, where the terminal capability information of the first terminal includes the device information of the first terminal, and the device information of the first terminal includes one or more of the following: the device name of the first terminal, the device type of the first terminal, and the device location of the first terminal.

4. The method according to claim 2, wherein Before receiving the master-slave clock relationship sent by the base station, the method further includes: Receive a system broadcast message sent by the base station, where the system broadcast message is used to request each terminal within the cell corresponding to the base station to report device information; Report the device information of the first terminal to the base station, where the device information of the first terminal includes one or more of the following: the device name of the first terminal, the device type of the first terminal, and the device location of the first terminal.

5. The method according to claim 1, wherein The determining the master-slave clock relationship includes: Determine the master-slave clock relationship based on pre-configured information, where the pre-configured information is determined based on the device information of each terminal among multiple terminals during the network configuration process of the multiple terminals, and the multiple terminals include the first terminal.

6. The method according to claim 5, characterized in that The device information includes one or more of the following: device name, device type, and device location.

7. The method according to any one of claims 2 to 6, characterized in that The master-slave clock relationship includes the clock relationships of one or more terminal groups, and the clock relationship of a terminal group includes the clock relationships among the terminals within the terminal group.

8. The method according to claim 1, wherein The determining the master-slave clock relationship includes: Send master clock request information to N terminals, where N is a positive integer; Receive master clock acceptance information sent by M terminals among the N terminals, where M is a positive integer less than or equal to N; Select one terminal from the M terminals as the master clock terminal of the first terminal, and determine the master-slave clock relationship based on the selected master clock terminal.

9. The method according to any one of claims 1 to 6, characterized in that, The performing clock synchronization with the second terminal includes: Send a first message to the second terminal, where the first message carries a first time, the first time is the sending time of the first message on the side of the first terminal, and the receiving time of the first message on the side of the second terminal is a second time; Receive a second message sent by the second terminal, where the second message carries the second time and a third time, the third time is the sending time of the second message on the side of the second terminal, and the receiving time of the second message on the side of the first terminal is a fourth time; Calculate the clock deviation between the first terminal and the second terminal based on the first time, the second time, the third time, and the fourth time; Adjust the clock of the first terminal based on the clock deviation between the first terminal and the second terminal, and the adjusted clock of the first terminal is synchronized with the clock of the second terminal.

10. The method according to any one of claims 1 to 6, characterized in that Performing clock synchronization with the second terminal includes: performing clock synchronization with the second terminal in the case of interruption of the wireless cellular network; The method further includes: performing clock synchronization with the wireless cellular module in the case of non-interruption of the wireless cellular network.

11. The method according to claim 10, characterized in that, Performing clock synchronization with the wireless cellular module includes: Receiving clock information sent by the wireless cellular module; Performing clock synchronization with the wireless cellular module based on the clock information.

12. The method according to claim 10, wherein Performing clock synchronization with the wireless cellular module includes: Sending third information to the wireless cellular module, the third information carrying a fifth time, the fifth time being the sending time of the third information on the side of the first terminal, and the receiving time of the third information on the side of the wireless cellular module being a sixth time; Receiving fourth information sent by the wireless cellular module, the fourth information carrying the sixth time and a seventh time, the seventh time being the sending time of the fourth information on the side of the wireless cellular module, and the receiving time of the fourth information on the side of the first terminal being an eighth time; Calculate the clock deviation between the first terminal and the wireless cellular module based on the fifth time, the sixth time, the seventh time, and the eighth time; Adjust the clock of the first terminal based on the clock deviation between the first terminal and the wireless cellular module, and the adjusted clock of the first terminal is synchronized with the clock of the wireless cellular module.

13. A clock synchronization device, characterized in that, Applied to a first terminal, the device includes: A first determination unit, configured to determine a master-slave clock relationship, where the master-slave clock relationship characterizes the relationship between a master clock terminal and a slave clock terminal; A second determination unit, configured to determine a second terminal having the master-slave clock relationship with the first terminal, where the first terminal serves as the slave clock terminal and the second terminal serves as the master clock terminal; A clock synchronization unit, configured to perform clock synchronization with the second terminal.

14. A terminal, characterized in that, Includes: A processor and a memory, the memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to execute the method according to any one of claims 1 to 12.

15. A chip, characterized in that, Includes: a processor, configured to call and run a computer program from a memory, so that a device installed with the chip executes the method according to any one of claims 1 to 12.

16. A computer-readable storage medium, characterized in that, For storing a computer program, the computer program causes a computer to execute the method according to any one of claims 1 to 12.

17. A computer program product, characterized in that, Includes computer program instructions, and the computer program instructions cause a computer to execute the method according to any one of claims 1 to 12.