A synchronous communication system and method

By configuring a comparison controller in the communication device and performing clock correction based on the comparison results of preset parameters and count values, the problem of low clock synchronization accuracy and efficiency in the communication network is solved, and more efficient clock synchronization is achieved.

CN118869131BActive Publication Date: 2025-01-24ZHUHAI BORUI JINGXIN INTEGRATED CIRCUIT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411332255.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-24
Publication Date
2025-01-24
Estimated Expiration
2044-09-24

AI Technical Summary

Technical Problem

In communication networks, due to factors such as production process, crystal oscillator frequency and external electromagnetic interference, it is difficult for each communication device to count the clock signal consistently, resulting in low clock synchronization accuracy and efficiency.

Method used

By configuring the comparative controller in the communication device, after receiving the synchronization signal, the preset parameter and counting value are compared, and the count value is corrected according to the results and the preset parameters to achieve clock synchronization. The ratio of the preset value to the preset parameter is proportional to the clock frequency ratio of the communication device.

Benefits of technology

It improves the accuracy and efficiency of clock synchronization, simplifies the clock synchronization processing process, reduces resource occupation, and reduces dependence on the communication network.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118869131B_ABST
    Figure CN118869131B_ABST
Patent Text Reader

Abstract

The present application discloses a synchronous communication system and method. The method includes comparing a preset parameter and a first count value and obtaining a comparison result when a first communication device receives a synchronization signal sent by a second communication device; the synchronization signal is generated when the count of the received clock signal by the second communication device reaches a preset value, and the first count value is obtained according to the count of the clock signal received by the first communication device; the first communication device corrects the first count value of the first communication device according to the comparison result and the preset parameter to synchronize the clocks of the first communication device and the second communication device; wherein the ratio of the preset value to the preset parameter is proportional to the ratio of the clock frequency of the second communication device to the clock frequency of the first communication device. The present application can effectively improve the accuracy and efficiency of clock synchronization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a synchronous communication system and method. Background Art

[0002] Each communication device in a communication network has its own clock. When transmitting messages in the communication network, the communication devices in the network are required to have a strictly unified clock. Therefore, clock synchronization between various communication devices is very important.

[0003] The communication devices in the network include master communication devices and slave communication devices. The master communication device periodically sends clock synchronization messages to the slave communication device for time calibration to update the local time of the slave communication device, thereby achieving clock synchronization between communication devices in the communication network. Due to factors such as manufacturing process, crystal oscillator frequency, external electromagnetic interference, etc., it is difficult for each communication device to keep the same count of the clock signal at the same time, and as time goes by, the deviation may become larger and larger, resulting in large differences in the clocks of communication devices in the communication network.

[0004] Therefore, it is necessary to propose a new technical solution to solve the above technical problems. Summary of the invention

[0005] The embodiments of the present application provide a synchronous communication system and method, which can effectively improve the accuracy and efficiency of clock synchronization.

[0006] In a first aspect, an embodiment of the present application provides a synchronous communication system, comprising: at least one first communication device;

[0007] The first communication device is configured to: when receiving a synchronization signal sent by the second communication device, compare a preset parameter with a first count value and obtain a comparison result, and correct the first count value of the first communication device according to the comparison result and the preset parameter to synchronize the clocks of the first communication device and the second communication device, the synchronization signal is generated when the count of the received clock signal by the second communication device reaches a preset value, and the first count value is obtained according to the count of the clock signal received by the first communication device;

[0008] The ratio of the preset value to the preset parameter is proportional to the ratio of the clock frequency of the second communication device to the clock frequency of the first communication device.

[0009] In some implementations, the first communication device includes a first counter, a first register, and a first comparison controller, and the first comparison controller is connected to the first counter and the first register, respectively;

[0010] The first register is configured to: store the preset parameters of the first communication device;

[0011] The first counter is configured to: count the number of pulses of the received clock signal to obtain the first count value;

[0012] The first comparison controller is configured to: receive a synchronization signal sent by the second communication device; obtain the preset parameter from the first register, and obtain the first count value from the first counter; compare the preset parameter with the first count value to obtain a comparison result, and correct the first count value of the first communication device according to the comparison result and the preset parameter to synchronize the clocks of the first communication device and the second communication device.

[0013] In some implementations, the first comparison controller is further configured to:

[0014] If the comparison result is that the first count value is less than the preset parameter, controlling the first counter to replace the first count value with the preset parameter;

[0015] If the comparison result is that the first count value is greater than the preset parameter, the first counter is controlled to pause counting and resume counting after waiting for a preset time; the preset time is determined according to the first count value and the preset parameter.

[0016] In some embodiments, the preset parameter includes a first cardinality value of the first communication device, the preset value includes a second cardinality value of the second communication device, the ratio of the second cardinality value to the first cardinality value is proportional to the ratio of the preset value to the preset parameter, the synchronization signal includes a first synchronization signal, and the first synchronization signal is generated when the count of the clock signal by the second communication device reaches the second cardinality value, and the preset duration includes a first preset duration, and the first preset duration is equal to the difference between the first count value and the first cardinality value.

[0017] In some implementations, the first communication device further includes a first operator, the first operator is connected to the first register and the first comparison controller respectively, the preset parameter includes a synchronization value, and the preset value includes a second period value of the second communication device;

[0018] The first operator is configured to: determine the synchronization value according to a first base value, a first period value and a first synchronization number of the first communication device;

[0019] Among them, the ratio of the second period value to the first period value is proportional to the ratio of the preset value to the preset parameter, the synchronization signal includes a second synchronization signal, the second synchronization signal is generated when the count of the clock signal by the second communication device reaches the second period value, and the preset duration includes a second preset duration, and the second preset duration is equal to the difference between the first count value and the synchronization value.

[0020] In some implementations, the synchronization value is equal to the sum of a multiplication result and the first base value, and the multiplication result is the product of the first period value and the first synchronization number.

[0021] In some implementations, the synchronization value is equal to a sum of a multiplication result, a first preset calibration value of the first communication device for the clock signal, and the first base value, and the multiplication result is the product of the first period value and the first synchronization number.

[0022] In a second aspect, the present application further provides a synchronous communication system, comprising: at least one first communication device and a second communication device, wherein the second communication device is connected to the at least one first communication device;

[0023] The second communication device is configured to: generate a synchronization signal when the count of the received clock signal reaches a preset value, and the synchronization signal is generated when the count of the received clock signal reaches a preset value;

[0024] The first communication device is configured to: when receiving the synchronization signal sent by the second communication device, compare a preset parameter with a first count value and obtain a comparison result, and correct the first count value of the first communication device according to the comparison result and the preset parameter to synchronize the clocks of the first communication device and the second communication device, wherein the first count value is obtained by counting the clock signal received by the first communication device;

[0025] The ratio of the preset value to the preset parameter is proportional to the ratio of the clock frequency of the second communication device to the clock frequency of the first communication device.

[0026] In a third aspect, the present application also provides a synchronous communication method, comprising the steps of:

[0027] When the first communication device receives a synchronization signal sent by the second communication device, the preset parameter and the first count value are compared to obtain a comparison result; the synchronization signal is generated when the count of the received clock signal by the second communication device reaches a preset value, and the first count value is obtained according to the count of the clock signal received by the first communication device;

[0028] The first communication device corrects the first count value of the first communication device according to the comparison result and the preset parameter, so as to synchronize the clocks of the first communication device and the second communication device;

[0029] The ratio of the preset value to the preset parameter is proportional to the ratio of the clock frequency of the second communication device to the clock frequency of the first communication device.

[0030] In some implementations, the first communication device correcting the first count value of the first communication device according to the comparison result and the preset parameter comprises the following steps:

[0031] If the comparison result is that the first count value is less than the preset parameter, the first communication device replaces the first count value with the preset parameter;

[0032] If the comparison result is that the first count value is greater than the preset parameter, the first communication device suspends counting and waits for a preset time before resuming counting; the preset time is determined according to the first count value and the preset parameter.

[0033] The embodiment of the present application provides a synchronous communication system and method, wherein the first communication device of the present application is configured to compare a preset parameter with a first count value obtained by counting the received clock signal and obtain a comparison result when receiving a synchronization signal sent by a second communication device, and to correct the first count value of the first communication device according to the comparison result and the preset parameter so as to synchronize the clocks of the first communication device and the second communication device, wherein the synchronization signal is generated when the count of the second communication device reaches a preset value; wherein the ratio of the preset value to the preset parameter is proportional to the ratio of the clock frequency of the second communication device to the clock frequency of the first communication device. The present application can effectively improve the accuracy and efficiency of clock synchronization. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 A schematic diagram of a structure of a synchronous communication system in an embodiment of the present application;

[0035] Figure 2 A schematic diagram of another structure of a synchronous communication system in an embodiment of the present application;

[0036] Figure 3 A schematic diagram of another structure of a synchronous communication system in an embodiment of the present application;

[0037] Figure 4 A schematic diagram of another structure of a synchronous communication system in an embodiment of the present application;

[0038] Figure 5A flowchart of a synchronous communication method in an embodiment of the present application. DETAILED DESCRIPTION

[0039] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application. The described technical solutions are only used to explain and illustrate the ideas of the present application and should not be regarded as limiting the scope of protection of the present application.

[0040] The terms "first", "second" and similar words do not indicate any order, quantity or importance, but are only used to distinguish different technical features. The term "plurality" and similar words mean two or more, unless otherwise clearly defined.

[0041] The various embodiments provided in this application are similar, and features in different embodiments may be combined with each other.

[0042] A communication network is composed of multiple communication devices, which may be chips or chiplets or dies or processor cores or electronic devices. Each communication device has its own system counter. In order to communicate normally, the time of multiple communication devices in the communication network needs to be consistent. For example, multiple chips in multi-core interconnection need clock synchronization. Among them, the counting synchronization of clock signals is achieved between two chips through synchronization request (SYNCREQ), synchronization response (SYNCACK) and cache coherent interconnect protocol (CCIX). However, this synchronization method makes the synchronization time accuracy greatly affected by CCIX. Once CCIX has network delay, the synchronization accuracy will be reduced. In addition, this synchronization method requires multiple handshake communications for clock synchronization, which is complicated and occupies software resources.

[0043] In order to improve the above problems, a synchronous communication system and a synchronous communication method are described below.

[0044] See also Figure 1 , Figure 1 A schematic diagram of a structure of a synchronous communication system provided in an embodiment of the present application, wherein, Figure 1 As shown, the synchronous communication system includes: at least one first communication device 100;

[0045] The first communication device 100 is configured to: when receiving a synchronization signal Sync sent by the second communication device 200, compare a preset parameter with a first count value and obtain a comparison result, and correct the first count value of the first communication device 100 according to the comparison result and the preset parameter, so that the clocks of the first communication device 100 and the second communication device 200 are synchronized, the synchronization signal Sync is generated when the count of the received clock signal Clk by the second communication device 200 reaches a preset value, and the first count value is obtained according to the count of the clock signal Clk received by the first communication device 100;

[0046] The ratio of the preset value to the preset parameter is proportional to the ratio of the clock frequency of the second communication device 200 to the clock frequency of the first communication device 100 .

[0047] In an embodiment of the present application, the synchronous communication system includes at least one first communication device 100 and one second communication device 200, and the first communication device 100 and the second communication device 200 can be chips or core particles (Chiplets) or wafers (Die) or processor cores or electronic devices. Among them, the second communication device 200 is a communication device that actively sends a synchronization signal Sync, such as a master communication device, and the first communication device 100 is a communication device that passively receives a synchronization signal Sync, such as a slave communication device. The second communication device 200 establishes a connection with at least one first communication device 100, and the first communication device 100 and the second communication device 200 can both receive a clock signal Clk, and the first communication device 100 and the second communication device 200 can both count the number of pulses or the number of pulses of the received clock signal Clk to obtain a count value, and calculate the time according to the count value and the clock frequency for counting the connected clock signal Clk, for example, the first communication device 100 counts to obtain a first count value, and the second communication device 200 counts to obtain a second count value. It should be noted that the counting frequency of the clock signal Clk of the first communication device 100 is the first clock frequency, and the counting frequency of the clock signal Clk of the second communication device 200 is the second clock frequency. The second clock frequency is divided by the first clock frequency to obtain the ratio of the clock frequency of the second communication device 200 to the clock frequency of the first communication device 100.

[0048] The second communication device 200 counts the clock signal Clk to obtain a second count value. When the second count value of the second communication device 200 reaches a preset value, the second communication device 200 generates a synchronization signal Sync and sends the synchronization signal Sync to at least one first communication device 100. Figure 1As shown, when the first communication device 100 receives the synchronization signal Sync sent by the second communication device 200, the first communication device 100 compares the first count value with the preset parameter to obtain a comparison result, and then the first communication device 100 corrects the count value of the first communication device 100 according to the comparison result and the preset parameter. Since the ratio of the preset value to the preset parameter is proportional to the ratio of the clock frequency of the second communication device 200 to the clock frequency of the first communication device 100, the time is calculated according to the count value and the clock frequency for counting the connected clock signal Clk. Therefore, the first communication device 100 corrects the count value of the first communication device 100 according to the comparison result and the preset parameter, so that the first communication device 100 can correct its own time, so that the clocks of the first communication device 100 and the second communication device 200 are synchronized.

[0049] In the present application, the synchronization signal Sync generated by the second communication device 200 when the count reaches a preset value triggers the first communication device 100 to correct the count value of the first communication device 100 according to the comparison result and the preset parameters. There is no need for multiple handshakes between the first communication device 100 and the second communication device 200 through synchronization messages for clock synchronization, which simplifies the clock synchronization processing flow, reduces resource usage, reduces dependence on the communication network, and effectively improves the accuracy and efficiency of clock synchronization.

[0050] In some embodiments, Figure 2 As shown, the first communication device 100 includes a first counter 120, a first register 110 and a first comparison controller 130, and the first comparison controller 130 is connected to the first counter 120 and the first register 110 respectively;

[0051] The first register 110 is configured to: store the preset parameters of the first communication device 100;

[0052] The first counter 120 is configured to: count the number of pulses of the received clock signal Clk to obtain the first count value;

[0053] The first comparison controller 130 is configured to: receive the synchronization signal Sync sent by the second communication device 200; obtain the preset parameter from the first register 110, and obtain the first count value from the first counter 120; compare the preset parameter with the first count value to obtain a comparison result, and correct the first count value of the first communication device 100 according to the comparison result and the preset parameter to synchronize the clocks of the first communication device 100 and the second communication device 200.

[0054] In the embodiments of the present application, Figure 2As shown, the second communication device 200 includes a second counter 220, a second register 210 and a second comparison controller 230, and the second comparison controller 230 is connected to the second counter 220 and the second register 210 respectively. Among them, the second register 210 is used to save the preset value of the second communication device 200. The second counter 220 includes a port for receiving a clock signal Clk and a port for receiving a reset signal. When the second counter 220 receives the clock signal Clk, it counts the number of pulses of the received clock signal Clk in real time to obtain and save the second count value. When the second counter 220 receives the reset signal, the second count value saved by the second counter 220 is cleared. One port of the second comparison controller 230 is used to retrieve the second count value stored in the second counter 220, and another input port of the second comparison controller 230 is used to retrieve the preset value stored in the second register 210. In this way, the second comparison controller 230 compares the preset value obtained from the second register 210 with the second count value obtained from the second counter 220 to obtain a comparison result. When the second count value obtained from the second counter 220 is less than the preset value obtained from the second register 210, the second communication device 200 continues to count. When the second count value obtained from the second counter 220 is equal to the preset value obtained from the second register 210, the second comparison controller 230 generates a synchronization signal Sync and sends the synchronization signal Sync to the first communication device 100 through the communication port of the second comparison controller 230.

[0055] like Figure 2As shown, the first communication device 100 includes a first counter 120, a first register 110 and a first comparison controller 130, and the first comparison controller 130 is connected to the first counter 120 and the first register 110 respectively. Among them, the first register 110 is used to save the preset parameters of the first communication device 100. The first counter 120 includes a port for receiving a clock signal Clk and a port for receiving a reset signal. When the first counter 120 receives the clock signal Clk, it counts the number of pulses of the received clock signal Clk in real time to obtain a first count value and save it. When the first counter 120 receives the reset signal, the first count value saved by the first counter 120 is cleared. A communication port of the first comparison controller 130 is used to receive the synchronization signal Sync sent by the second communication device 200, a port of the first comparison controller 130 is used to retrieve the first count value stored in the first counter 120, and another port of the first comparison controller 130 is used to retrieve the preset parameters stored in the first register 110. In this way, the first comparison controller 130 compares the preset parameters obtained from the first register 110 with the first count value obtained from the first counter 120 to obtain a comparison result. The first comparison controller 130 can generate a control signal based on the comparison result and the preset parameters and send it to the first counter 120. In this way, the first comparison controller 130 corrects the count value of the first communication device 100 according to the control signal.

[0056] In some embodiments, the first comparison controller 130 is further configured to:

[0057] If the comparison result is that the first count value is less than the preset parameter, controlling the first counter 120 to replace the first count value with the preset parameter;

[0058] If the comparison result is that the first count value is greater than the preset parameter, the first counter 120 is controlled to suspend counting and resume counting after waiting for a preset time; the preset time is determined according to the first count value and the preset parameter.

[0059] In the embodiments of the present application, Figure 2As shown, when the comparison result is that the first count value is less than the preset parameter, the first comparison controller 130 controls the first counter 120 to replace the first count value of the first communication device 100 with the preset parameter saved by the first register 110. When the comparison result is that the first count value is greater than the preset parameter, the first comparison controller 130 controls the first counter 120 to suspend counting, and controls the first counter 120 to resume counting after waiting for a preset time, and the preset time is determined according to the first count value and the preset parameter. When the comparison result is that the first count value is equal to the preset parameter, the first comparison controller 130 does not need to perform correction processing on the first count value of the first counter 120.

[0060] In some embodiments, the preset parameter includes a first cardinality value of the first communication device 100, the preset value includes a second cardinality value of the second communication device 200, the ratio of the second cardinality value to the first cardinality value is proportional to the ratio of the preset value to the preset parameter, the synchronization signal Sync includes a first synchronization signal, and the first synchronization signal is generated when the count of the clock signal Clk by the second communication device 200 reaches the second cardinality value, and the preset duration includes a first preset duration, and the first preset duration is equal to the difference between the first count value and the first cardinality value.

[0061] In the embodiments of the present application, Figure 2 As shown, the first register 110 is used to store the first radix value of the first communication device 100, and the second register 210 is used to store the second radix value of the second communication device 200. In some embodiments, the first register 110 may include a first sub-register a, and the second register 210 may also include a first sub-register a, the first sub-register a of the first register 110 is used to store the first radix value of the first communication device 100, and the first sub-register a of the second register 210 is used to store the second radix value of the second communication device 200.

[0062] The second comparison controller 230 of the second communication device 200 generates a first synchronization signal when the second count value of the second counter 220 reaches the second base value stored in the second register 210 (or the first subregister a of the second register 210), and sends the first synchronization signal to the communication port of the first comparison controller 130 of the first communication device 100. The first comparison controller 130 of the first communication device 100 compares the first base value obtained from the first register 110 (or the first subregister a of the first register 110) with the first count value obtained from the first counter 120 to obtain a first comparison result.

[0063] When the first comparison result is that the first count value is less than the first base value, the first comparison controller 130 controls the first counter 120 to replace the first count value of the first communication device 100 with the first base value stored in the first register 110 (or the first subregister a of the first register 110). In this way, the ratio of the second base value to the first base value can be proportional to the ratio of the second clock frequency f2 of the second communication device 200 to the first clock frequency f1 of the first communication device 100 (i.e., f2 / f1), so that the first communication device 100 and the second communication device 200 maintain synchronous counting in a linear relationship, thereby allowing the first communication device 100 and the second communication device 200 to maintain clock synchronization.

[0064] When the first comparison result is that the first count value is greater than the first base value, the first comparison controller 130 controls the first counter 120 to suspend counting, and controls the first counter 120 to resume counting after waiting for a preset time, and the preset time is determined according to the first count value and the first base value. Since the count value of the first counter 120 can only increase in one direction, if the first count value is greater than the first base value, it indicates that the first clock frequency of the first counter 120 of the first communication device 100 is faster than the second clock frequency of the second counter 220 of the second communication device 200 as a reference, therefore, the first counter 120 is controlled to suspend counting and resume counting after waiting for the first preset time, so that the first communication device 100 and the second communication device 200 maintain clock synchronization. When the first comparison result is that the first count value is equal to the first base value, it indicates that the first communication device 100 and the second communication device 200 have maintained clock synchronization at this time, therefore, the first comparison controller 130 does not need to perform correction processing on the first count value of the first counter 120.

[0065] In some embodiments, the first communication device 100 further includes a first operator 140, the first operator 140 is connected to the first register 110 and the first comparison controller 130 respectively, the preset parameter includes a synchronization value, and the preset value includes a second period value of the second communication device 200;

[0066] The first operator 140 is configured to: determine the synchronization value according to the first base value, the first period value and the first synchronization number of the first communication device 100;

[0067] Among them, the ratio of the second period value to the first period value is proportional to the ratio of the preset value to the preset parameter, the synchronization signal Sync includes a second synchronization signal, and the second synchronization signal is generated when the count of the clock signal Clk by the second communication device 200 reaches the second period value, and the preset duration includes a second preset duration, and the second preset duration is equal to the difference between the first count value and the synchronization value.

[0068] In the embodiments of the present application, Figure 3 As shown, the first register 110 is used to store the first cardinality value, the first cycle value and the first synchronization number of the first communication device 100, and the second register 210 is used to store the second cardinality value, the second cycle value and the second synchronization number of the second communication device 200, and the second cycle value is greater than the second cardinality value. The first communication device 100 may also include a first operator 140, and the second communication device 200 may include or not include a second operator 240. The first operator 140 of the first communication device 100 is connected to the first register 110 and the first comparison controller 130 respectively.

[0069] In some embodiments, Figure 4 As shown, the first register 110 may include a first sub-register a, a second sub-register b and a third sub-register c, and the second register 210 may also include a first sub-register a, a second sub-register b and a third sub-register c. The first sub-register a of the first register 110 is used to store the first base value of the first communication device 100, and the first sub-register a of the second register 210 is used to store the second base value of the second communication device 200. The second sub-register b of the first register 110 is used to store the first period value of the first communication device 100, and the second sub-register b of the second register 210 is used to store the second period value of the second communication device 200. The third sub-register c of the first register 110 is used to store the first synchronization number of the first communication device 100, and the third sub-register c of the second register 210 is used to store the synchronization number of the second communication device 200. The first operator 140 of the first communication device 100 is connected to the first sub-register a of the first register 110, the second sub-register b of the first register 110, the third sub-register c of the first register 110 and the first comparison controller 130 respectively.

[0070] like Figure 3 As shown, the second comparison controller 230 of the second communication device 200 generates a second synchronization signal when the second count value of the second counter 220 reaches the second period value stored in the second register 210, and sends the second synchronization signal to the communication port of the first comparison controller 130 of the first communication device 100, and the first operator 140 calculates the synchronization value by obtaining the first count value, the first period value and the first synchronization number of the first communication device 100 from the first register 110.

[0071] like Figure 4As shown, the second comparison controller 230 of the second communication device 200 generates a second synchronization signal when the second count value of the second counter 220 reaches the second period value stored in the second subregister b of the second register 210, and sends the second synchronization signal to the communication port of the first comparison controller 130 of the first communication device 100, and the first operator 140 calculates the synchronization value by obtaining the first count value of the first communication device 100 from the first subregister a of the first register 110, the first period value obtained from the second subregister b of the first register 110, and the first synchronization number obtained from the third subregister c of the first register 110.

[0072] like Figure 3 or Figure 4 As shown, the first comparison controller 130 compares the synchronization value obtained from the first operator 140 with the first count value obtained from the first counter 120 to obtain a second comparison result. When the second comparison result is that the first count value is less than the synchronization value, the first comparison controller 130 controls the first counter 120 to replace the first count value of the first communication device 100 with the synchronization value obtained from the first operator 140, so that the ratio of the second clock frequency f2 of the second communication device 200 to the first clock frequency f1 of the first communication device 100 (i.e., f2 / f1) can be proportional to the ratio of the second base value to the first base value, and the ratio is proportional to the ratio of the second period value to the first period value, so that the first communication device 100 and the second communication device 200 maintain synchronous counting in a linear relationship, thereby allowing the first communication device 100 and the second communication device 200 to maintain clock synchronization.

[0073] When the second comparison result is that the first count value is greater than the synchronization value, the first comparison controller 130 controls the first counter 120 to suspend counting, and controls the first counter 120 to resume counting after waiting for a preset time, and the preset time is determined according to the first count value and the synchronization value. Since the count value of the first counter 120 can only increase in one direction, if the first count value is greater than the synchronization value, it indicates that the first clock frequency of the first counter 120 of the first communication device 100 is faster than the second clock frequency of the second counter 220 of the second communication device 200 as a reference, therefore, the first counter 120 is controlled to suspend counting and resume counting after waiting for the second preset time, so that the first communication device 100 and the second communication device 200 maintain clock synchronization. When the second comparison result is that the first count value is equal to the synchronization value, it indicates that the first communication device 100 and the second communication device 200 have maintained clock synchronization at this time, therefore, the first comparison controller 130 does not need to perform correction processing on the first count value of the first counter 120.

[0074] It should be noted that the structures of the first communication device 100 and the second communication device 200 may be the same or different. In the embodiment of the present application, the structures of the first communication device 100 and the second communication device 200 are preferably the same. In this way, the second communication device and the first communication device 100 can exchange identities, that is, the second communication device 200 can be used as a master device for sending a synchronization signal Sync, and the first communication device 100 can be used as a slave device for receiving the synchronization signal Sync. Of course, the second communication device 200 can also be a slave device for receiving the synchronization signal Sync, and the first communication device 100 can be used as a master device for sending a synchronization signal Sync.

[0075] In some embodiments, the synchronization value is equal to the sum of the product result and the first base value, and the product result is the product of the first period value and the first synchronization number. In the embodiment of the present application, the synchronization value = the first base value + the first period value × the first synchronization number.

[0076] In some embodiments, the synchronization value is equal to the sum of the product result, the first preset calibration value of the first communication device 100 for the clock signal Clk and the first base value, and the product result is the product of the first period value and the first synchronization number. In the embodiment of the present application, the synchronization value = the first base value + the first preset calibration value + the first period value × the first synchronization number. After the first communication device 100 receives the synchronization signal Sync sent by the second communication device 200 and completes a clock synchronization with the second communication device 200 for the clock signal Clk, the first synchronization number will be accumulated once.

[0077] In the embodiment of the present application, the first period value, the second period value, the first base value, the second base value and the first preset calibration value are all preset values, and after the first communication device 100 and the second communication device 200 determine the master-slave mode, the ratio between the second period value and the first period value and the ratio between the second base value and the first base value can be adaptively set according to the frequency multiple relationship between the first clock frequency of the first counter 120 in the first communication device 100 and the second clock frequency of the second counter 220 in the second communication device 200 (i.e., the ratio of the clock frequency of the second communication device 200 to the clock frequency of the first communication device 100). The first preset calibration value can be calculated by measuring the time difference between the first communication device 100 and the second communication device 200 for the received clock signal Clk for multiple times.

[0078] Exemplarily, when the clock frequencies of the master chip A and the slave chip B are different and the frequency multiple relationship (i.e., the ratio of the clock frequency of the second communication device 200 to the clock frequency of the first communication device 100 = f2 / f1), for example, the clock frequency of the master chip A is 1ns and counts once (1Hz), and the clock frequency of the slave chip B is 2ns and counts once (0.5Hz). Assume that when the second counter 220 of the master chip A counts 1000 times (the second base value stored in the second register 210 is configured as 1000), it triggers the generation and sending of the first synchronization signal, and the first base value stored in the first register 110 of the slave chip B should be configured as 500 times, that is, the ratio between the second base value and the first base value is 2:1. Similarly, the second period value stored in the second register 210 of the master chip A and the first period value stored in the first register 110 of the slave chip B are also in a ratio of 2:1. In this way, a linear relationship is maintained between the master chip and the slave chip, so that the first counter 120 in the slave chip B can count to 500 times, so as to achieve clock synchronization between the slave chip B and the master chip A.

[0079] In some embodiments, in addition to storing period values ​​(the first period value and the second period value, respectively), base values ​​(the first base value and the second base value, respectively), and synchronization times (the first synchronization times and the second synchronization times, respectively), the above-mentioned first register 110 and the second register 210 can also store clock frequencies (the first clock frequency and the second clock frequency, respectively), preset calibration values, abnormal thresholds, master-slave mode flags (the master mode flag and the slave mode flag, respectively), and synchronization enable flags. The first register 110 of the first communication device 100 of the present application can set a clock frequency subregister different from the first to third subregisters c to store the first clock frequency, a calibration subregister to store the first preset calibration value, a threshold subregister to store the abnormal threshold, a master-slave mode subregister to store the slave mode flag, and a synchronization enable subregister to store the synchronization enable flag.

[0080] Please refer to Figures 1 to 4 As shown, the embodiment of the present application further provides a synchronous communication system, including: at least one first communication device 100 and a second communication device 200, wherein the second communication device 200 is connected to the at least one first communication device 100;

[0081] The second communication device 200 is configured to: generate a synchronization signal Sync when the count of the received clock signal Clk reaches a preset value, and the synchronization signal Sync is generated when the count of the received clock signal Clk by the second communication device 200 reaches a preset value;

[0082] The first communication device 100 is configured to: when receiving the synchronization signal Sync sent by the second communication device 200, compare a preset parameter with a first count value and obtain a comparison result, and correct the first count value of the first communication device 100 according to the comparison result and the preset parameter, so that the clocks of the first communication device 100 and the second communication device 200 are synchronized, and the first count value is obtained by counting the clock signal Clk received by the first communication device 100;

[0083] The ratio of the preset value to the preset parameter is proportional to the ratio of the clock frequency of the second communication device 200 to the clock frequency of the first communication device 100 .

[0084] In the embodiment of the present application, a second communication device 200 and at least one first communication device 100 constitute a master-slave multi-slave, the second communication device 200 outputs a synchronization signal Sync, and at least one first communication device 100 receives the synchronization signal Sync. It is only necessary to pre-set the ratio of the preset value of the second communication device 200 to the preset parameter of the first communication device 100 to be proportional to the ratio of the second clock frequency of the second communication device 200 to the first clock frequency of the first communication device 100, and the second counter 220 of the second communication device 200 will generate a synchronization signal Sync after the count reaches the preset value, which can trigger the first communication device 100 to correct the count value of the first communication device 100 according to the comparison result and the preset parameter, and there is no need for the first communication device 100 and the second communication device 200 to perform clock synchronization through multiple handshakes through synchronization messages, which simplifies the clock synchronization processing flow, reduces resource occupation, reduces dependence on the communication network, and effectively improves the accuracy and efficiency of clock synchronization.

[0085] Please refer to Figure 5 As shown, the embodiment of the present application also provides a synchronous communication method, comprising the steps of:

[0086] Step S100: When the first communication device receives a synchronization signal sent by the second communication device, the preset parameter and the first count value are compared to obtain a comparison result; the synchronization signal is generated when the count of the received clock signal by the second communication device reaches a preset value, and the first count value is obtained according to the count of the clock signal received by the first communication device;

[0087] Step S200: The first communication device corrects the first count value of the first communication device according to the comparison result and the preset parameter to synchronize the clocks of the first communication device and the second communication device; wherein the ratio of the preset value to the preset parameter is proportional to the ratio of the clock frequency of the second communication device to the clock frequency of the first communication device.

[0088] In the embodiment of the present application, the second communication device 200 counts the clock signal Clk to obtain a second count value, and when the second count value of the second communication device 200 reaches a preset value, the second communication device 200 generates a synchronization signal Sync and sends the synchronization signal Sync to at least one first communication device 100. Figure 1 and Figure 5 As shown, when the first communication device 100 receives the synchronization signal Sync sent by the second communication device 200, the first communication device 100 compares the first count value with the preset parameter to obtain a comparison result, and then the first communication device 100 corrects the count value of the first communication device 100 according to the comparison result and the preset parameter. Since the ratio of the preset value to the preset parameter is proportional to the ratio, the time is calculated according to the count value and the clock frequency for counting the connected clock signal Clk. Therefore, the first communication device 100 corrects the count value of the first communication device 100 according to the comparison result and the preset parameter, so that the first communication device 100 can correct its own time, so that the clocks of the first communication device 100 and the second communication device 200 are synchronized.

[0089] In the present application, the synchronization signal Sync generated by the second communication device 200 when the count reaches a preset value triggers the first communication device 100 to correct the count value of the first communication device 100 according to the comparison result and the preset parameters. There is no need for multiple handshakes between the first communication device 100 and the second communication device 200 through synchronization messages for clock synchronization, which simplifies the clock synchronization processing flow, reduces resource usage, reduces dependence on the communication network, and effectively improves the accuracy and efficiency of clock synchronization.

[0090] In some embodiments, step S200, namely, the first communication device correcting the first count value of the first communication device according to the comparison result and the preset parameter, comprises the steps of:

[0091] Step S210: If the comparison result is that the first count value is less than the preset parameter, the first communication device replaces the first count value with the preset parameter;

[0092] Step S220: If the comparison result is that the first count value is greater than the preset parameter, the first communication device suspends counting and waits for a preset time period before resuming counting; the preset time period is determined based on the first count value and the preset parameter.

[0093] In an embodiment of the present application, the second communication device 200 counts the number of pulses of the received clock signal Clk in real time to obtain a second count value. When the second count value is less than a preset value, the second communication device 200 continues to count. When the second count value is equal to the preset value, the second comparison controller 230 generates and sends a synchronization signal Sync to the first communication device 100.

[0094] like Figure 2 As shown, the first communication device 100 includes a first counter 120, a first register 110 and a first comparison controller 130, and the first comparison controller 130 is connected to the first counter 120 and the first register 110 respectively. Among them, the first register 110 is used to save the preset parameters of the first communication device 100. The first counter 120 includes a port for receiving a clock signal Clk and a port for receiving a reset signal. When the first counter 120 receives the clock signal Clk, it counts the number of pulses of the received clock signal Clk in real time to obtain a first count value and save it. When the first counter 120 receives the reset signal, the first count value saved by the first counter 120 is cleared. A communication port of the first comparison controller 130 is used to receive the synchronization signal Sync sent by the second communication device 200, a port of the first comparison controller 130 is used to retrieve the first count value stored in the first counter 120, and another port of the first comparison controller 130 is used to retrieve the preset parameters stored in the first register 110. In this way, the first comparison controller 130 compares the preset parameters obtained from the first register 110 with the first count value obtained from the first counter 120 to obtain a comparison result. The first comparison controller 130 can generate a control signal based on the comparison result and the preset parameters and send it to the first counter 120. In this way, the first comparison controller 130 corrects the count value of the first communication device 100 according to the control signal.

[0095] In some examples, the embodiments of the present application further provide a synchronous communication method, wherein the preset parameters include a first cardinality value and a synchronization value of the first communication device 100, the synchronization value is determined according to the first cardinality value, the first cycle value and the first synchronization number of the first communication device 100, the preset value includes a second cardinality value and a second cycle value of the second communication device 200, the first cardinality value. The second cardinality value, the first cycle value and the second cycle value are all positive numbers, the ratio of the second cardinality value to the first cardinality value is proportional to the ratio of the preset value to the preset parameter, the ratio of the second cycle value to the first cycle value is proportional to the ratio of the preset value to the preset parameter, and the synchronous communication method includes the steps of:

[0096] Step S610: When the first communication device receives the first synchronization signal sent by the second communication device, the first base value is compared with the first count value of the first communication device to obtain a first comparison result; the first synchronization signal is generated when the count of the second communication device reaches the second base value;

[0097] Step S620: The first communication device corrects the first count value of the first communication device according to the first comparison result and the first base value, so as to synchronize the clocks of the first communication device and the second communication device;

[0098] Step S620: the first communication device corrects the first count value of the first communication device according to the first comparison result and the first base value, including the following steps:

[0099] Step S621: If the first comparison result is that the first count value is less than the first base value, the first communication device replaces the first count value with the first base value;

[0100] Step S622: If the first comparison result is that the first count value is greater than the first base value, the first communication device suspends counting and waits for a first preset time length before resuming counting; the first preset time length is equal to the difference between the first count value and the first base value;

[0101] Step S623: If the first comparison result is that the first count value is equal to the first base value, the first communication device continues counting and waits for receiving a second synchronization signal;

[0102] Step S630: When the first communication device receives the second synchronization signal sent by the second communication device, the synchronization value is compared with the first count value of the first communication device to obtain a second comparison result; the second synchronization signal is generated when the count of the second communication device reaches a second period value;

[0103] Step S640: The first communication device corrects the first count value of the first communication device according to the second comparison result and the synchronization value, so as to synchronize the clocks of the first communication device and the second communication device;

[0104] Step S640, the first communication device corrects the first count value of the first communication device according to the second comparison result and the synchronization value, including the steps of:

[0105] Step S641: If the second comparison result is that the first count value is less than the synchronization value, the first communication device replaces the first count value with the synchronization value;

[0106] Step S642: If the second comparison result is that the first count value is greater than the synchronization value, the first communication device suspends counting and waits for a second preset time length before resuming counting; the second preset time length is equal to the difference between the first count value and the synchronization value;

[0107] Step S643: If the first comparison result is that the first count value is equal to the first base value, the first communication device continues to count and waits for receiving a second synchronization signal, or clears the first count value and restarts counting when a reset signal is received.

[0108] In the embodiment of the present application, the second base value may be less than the second period value, so that the clock synchronization of at least one first communication device 100 and one second communication device 200 is achieved through at least two synchronizations. For example, two synchronization corrections may be performed between the first communication device 100 and the second communication device 200, that is, the first synchronization correction is triggered according to the first synchronization signal (that is, the above steps S610-S620), and the second synchronization correction is triggered according to the second synchronization signal (that is, the above steps S630-S640), and the synchronization correction accuracy can be improved through these two synchronization corrections.

[0109] Of course, three synchronization corrections can be performed between the first communication device 100 and the second communication device 200, that is, the first synchronization correction is triggered according to the first synchronization signal (that is, the above steps S610-S620), the second synchronization correction is triggered according to the first received second synchronization signal (that is, the above steps S630-S640), and then the third synchronization correction is triggered according to the second received second synchronization signal (that is, the above steps S630-S640). Through these three synchronization corrections, the synchronization correction accuracy can be improved, and because the synchronization correction of the above steps S630-S640 is performed once every synchronization cycle according to the two received second synchronization signals, the effect of periodic synchronization correction can be achieved, and the synchronization correction accuracy can be further improved. Of course, four synchronization corrections can be performed between the first communication device 100 and the second communication device 200. In short, the scheme of performing at least two synchronization corrections between the first communication device 100 and the second communication device 200 of the present application to improve the synchronization correction accuracy is within the protection scope of the present application.

[0110] The above is a detailed introduction to a synchronous communication system and method provided by the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the technical solution and core idea of ​​the present application. Ordinary technicians in this field should understand that they can still modify the technical solutions recorded in the aforementioned embodiments, or replace some of the technical features therein with equivalents; and these modifications or replacements do not make the essence of the corresponding technical solution deviate from the scope of the technical solution of the embodiments of the present application.

Claims

1. A synchronous communication system, characterized in that: include: at least one first communication device; The first communication device is configured to: when receiving a synchronization signal sent by the second communication device, compare a preset parameter with a first count value and obtain a comparison result, and correct the first count value of the first communication device according to the comparison result and the preset parameter to synchronize the clocks of the first communication device and the second communication device, the synchronization signal is generated when the count of the received clock signal by the second communication device reaches a preset value, and the first count value is obtained according to the count of the clock signal received by the first communication device; Wherein, the ratio of the preset value to the preset parameter is proportional to the ratio of the clock frequency of the second communication device to the clock frequency of the first communication device; The first communication device includes a first counter, a first register and a first comparison controller, and the first comparison controller is connected to the first counter and the first register respectively; The first register is configured to: store the preset parameters of the first communication device; The first counter is configured to: count the number of pulses of the received clock signal to obtain the first count value; The first comparison controller is configured to: receive a synchronization signal sent by the second communication device; obtain the preset parameter from the first register, and obtain the first count value from the first counter; compare the preset parameter with the first count value to obtain a comparison result, and correct the first count value of the first communication device according to the comparison result and the preset parameter to synchronize the clocks of the first communication device and the second communication device.

2. The synchronous communication system according to claim 1, characterized in that: The first comparison controller is further configured to: If the comparison result is that the first count value is less than the preset parameter, controlling the first counter to replace the first count value with the preset parameter; If the comparison result is that the first count value is greater than the preset parameter, controlling the first counter to pause counting and wait for a preset time before resuming counting; The preset duration is determined according to the first count value and the preset parameter.

3. The synchronous communication system according to claim 2, characterized in that: The preset parameter includes a first cardinality value of the first communication device, the preset value includes a second cardinality value of the second communication device, the ratio of the second cardinality value to the first cardinality value is proportional to the ratio of the preset value to the preset parameter, the synchronization signal includes a first synchronization signal, the first synchronization signal is generated when the count of the clock signal by the second communication device reaches the second cardinality value, the preset duration includes a first preset duration, and the first preset duration is equal to the difference between the first count value and the first cardinality value.

4. The synchronous communication system according to claim 2, characterized in that: The first communication device further comprises a first operator, the first operator is respectively connected to the first register and the first comparison controller, the preset parameter comprises a synchronization value, and the preset value comprises a second period value of the second communication device; The first operator is configured to: determine the synchronization value according to a first base value, a first period value and a first synchronization number of the first communication device; Among them, the ratio of the second period value to the first period value is proportional to the ratio of the preset value to the preset parameter, the synchronization signal includes a second synchronization signal, the second synchronization signal is generated when the count of the clock signal by the second communication device reaches the second period value, and the preset duration includes a second preset duration, and the second preset duration is equal to the difference between the first count value and the synchronization value.

5. The synchronous communication system according to claim 4, characterized in that: The synchronization value is equal to the sum of the multiplication result and the first base value, and the multiplication result is the product of the first period value and the first synchronization number.

6. The synchronous communication system according to claim 4, characterized in that: The synchronization value is equal to a sum of a multiplication result, a first preset calibration value of the first communication device for the clock signal, and the first base value, and the multiplication result is a product of the first period value and the first synchronization number.

7. A synchronous communication system, characterized in that: include: at least one first communication device and a second communication device, the second communication device being connected to the at least one first communication device; The second communication device is configured to: generate a synchronization signal when the count of the received clock signal reaches a preset value, and the synchronization signal is generated when the count of the received clock signal reaches a preset value; The first communication device is configured to: when receiving the synchronization signal sent by the second communication device, compare a preset parameter with a first count value and obtain a comparison result, and correct the first count value of the first communication device according to the comparison result and the preset parameter to synchronize the clocks of the first communication device and the second communication device, wherein the first count value is obtained by counting the clock signal received by the first communication device; Wherein, the ratio of the preset value to the preset parameter is proportional to the ratio of the clock frequency of the second communication device to the clock frequency of the first communication device; The first communication device includes a first counter, a first register and a first comparison controller, and the first comparison controller is connected to the first counter and the first register respectively; The first register is configured to: store the preset parameters of the first communication device; The first counter is configured to: count the number of pulses of the received clock signal to obtain the first count value; The first comparison controller is configured to: receive a synchronization signal sent by the second communication device; obtain the preset parameter from the first register, and obtain the first count value from the first counter; compare the preset parameter with the first count value to obtain a comparison result, and correct the first count value of the first communication device according to the comparison result and the preset parameter to synchronize the clocks of the first communication device and the second communication device.

8. A synchronous communication method, characterized in that: Includes steps: When the first communication device receives a synchronization signal sent by the second communication device, the preset parameter and the first count value are compared to obtain a comparison result; the synchronization signal is generated when the count of the received clock signal by the second communication device reaches a preset value, and the first count value is obtained according to the count of the clock signal received by the first communication device; The first communication device corrects the first count value of the first communication device according to the comparison result and the preset parameter to synchronize the clocks of the first communication device and the second communication device, including: if the comparison result is that the first count value is less than the preset parameter, the first communication device replaces the first count value with the preset parameter; If the comparison result is that the first count value is greater than the preset parameter, the first communication device suspends counting and waits for a preset time before resuming counting; the preset time is determined according to the first count value and the preset parameter; The ratio of the preset value to the preset parameter is proportional to the ratio of the clock frequency of the second communication device to the clock frequency of the first communication device.

Citation Information

Patent Citations

  • Real-time clock processing system and method

    CN107256065A

  • Bus period synchronization method and system

    CN112115079A