CN114448594A - Communication frequency synchronization method and system - Google Patents

Communication frequency synchronization method and system Download PDF

Info

Publication number
CN114448594A
CN114448594A CN202111647831.4A CN202111647831A CN114448594A CN 114448594 A CN114448594 A CN 114448594A CN 202111647831 A CN202111647831 A CN 202111647831A CN 114448594 A CN114448594 A CN 114448594A
Authority
CN
China
Prior art keywords
communication frequency
receiving end
data
receiving
sending
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111647831.4A
Other languages
Chinese (zh)
Other versions
CN114448594B (en
Inventor
王宏伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202111647831.4A priority Critical patent/CN114448594B/en
Publication of CN114448594A publication Critical patent/CN114448594A/en
Application granted granted Critical
Publication of CN114448594B publication Critical patent/CN114448594B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L7/00Arrangements for synchronising receiver with transmitter
    • H04L7/0016Arrangements for synchronising receiver with transmitter correction of synchronization errors
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L7/00Arrangements for synchronising receiver with transmitter
    • H04L7/0079Receiver details
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L7/00Arrangements for synchronising receiver with transmitter
    • H04L7/0091Transmitter details
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Abstract

The invention provides a communication frequency synchronization method and a system, wherein the method is applied to a sending end, and sends a high-level signal to a receiving end through a control line so that the receiving end starts timing after receiving the high-level signal through the control line; and sending a preset square wave signal to the receiving end through the control line according to the current communication frequency so that the receiving end stops timing after receiving the preset square wave signal through the control line, and adjusting the communication frequency of the receiving end based on the timing duration so as to realize the communication frequency synchronization with the receiving end. Therefore, the receiving end starts timing after receiving the high-level signal and stops timing after receiving the preset square wave signal, the frequency of the preset square wave signal is determined according to the timing duration, namely the current communication frequency of the sending end is determined, then the communication frequency of the receiving end is adjusted to the current communication frequency of the sending end, the communication frequency synchronization of the sending end and the receiving end is automatically realized, the agreement of the communication frequency is not needed in advance, and the communication efficiency is improved.

Description

Communication frequency synchronization method and system
Technical Field
The invention relates to the technical field of communication, in particular to a communication frequency synchronization method and a communication frequency synchronization system.
Background
The I2C bus is a simple, bidirectional two-wire synchronous serial bus. It requires only two wires to transfer information between devices connected to the bus.
The master device is used to initiate the bus to transfer data and to generate a clock to open up the devices that are transferring, when any addressed device is considered a slave device. If the host wants to send data to the slave device, the host addresses the slave device first, then actively sends the data to the slave device, and finally the host terminates the data transmission; the master device addresses the slave device first if the master device is to receive data from the slave device. The host is responsible for generating the timing clock and terminating the data transfer.
I2c communication, first send the initial condition, want to finish the communication, want to send a stop condition, while communicating, can send the initial condition to finish the multistage communication many times, avoid other host computer to snatch the bus, this communication mode has decided I2c is actually the half-duplex communication mode can't realize the full-duplex communication. The I2C transmission bit rate can reach 100Kbit/s in the standard mode, 400Kbit/s in the fast mode and 3.4Mbit/s in the high-speed mode; it can also be understood that the clock frequency can reach 100kHz in standard mode, 400kHz in fast mode, and 3.4MHz in high speed mode.
However, in actual communication, the communication frequencies of both communication parties cannot be known, and only a pre-agreement is made before communication to ensure the communication frequencies to be consistent, so that the communication with the automatic synchronization frequency cannot be realized.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and a system for synchronizing communication frequencies, so as to overcome the problem in the prior art that since i2c is synchronous half-duplex communication, it is necessary to rely on the agreement of communication frequencies between two communication parties in advance, and thus automatic synchronous frequency communication cannot be achieved.
According to a first aspect, an embodiment of the present invention provides a communication frequency synchronization method, applied to a sending end, where the method includes:
sending a high-level signal to a receiving end through a control line so that the receiving end starts timing after receiving the high-level signal through the control line;
and sending a preset square wave signal to the receiving end through the control line according to the current communication frequency so that the receiving end stops timing after receiving the preset square wave signal through the control line, and adjusting the communication frequency of the receiving end based on the timing duration so as to realize the communication frequency synchronization with the receiving end.
Optionally, before sending a high-level signal to the receiving end through a control line, the method further includes:
sending first preset data to a receiving end through a data line based on the current communication frequency;
judging whether a first feedback signal sent by the receiving end is received within a set time, wherein the first feedback signal is a feedback signal generated by the receiving end after the receiving end receives the first preset data;
and when the first feedback signal sent by the receiving end is not received within the set time, sending a high-level signal to the receiving end through a control line.
Optionally, after sending a preset square wave signal to the receiving end through the control line according to the current communication frequency, the method further includes:
sending second preset data to a receiving end through a data line based on the current communication frequency;
judging whether a second feedback signal sent by the receiving end is received within a set time, wherein the second feedback signal is a feedback signal generated after the receiving end receives the second preset data through a data line;
and when the second feedback signal sent by the receiving end is not received within the set time, generating an abnormal alarm signal.
Optionally, after the communication frequency synchronization with the receiving end is achieved, the method further includes:
acquiring data to be transmitted;
and sending the data to be transmitted to the receiving end through a data line.
Optionally, before the first preset data is sent to the receiving end through the data line at the current communication frequency of the control line, the method further includes:
detecting whether the communication state of the data line is idle;
and when the communication state of the data line is detected to be idle, sending first preset data to a receiving end through the data line based on the current communication frequency.
According to a second aspect, an embodiment of the present invention further provides a communication frequency synchronization method, applied to a receiving end, where the method includes:
starting timing after receiving a high-level signal sent by a sending end through a control line;
stopping timing after receiving a preset square wave signal sent by the sending end through a control line, wherein the preset square wave signal is the square wave signal sent by the sending end to the receiving end through the control line according to the current communication frequency of the sending end;
and adjusting the communication frequency based on the timing duration to realize the communication frequency synchronization with the transmitting end.
Optionally, the adjusting the communication frequency based on the time length of the timing includes:
calculating the current communication frequency of the sending end based on the number of the periods of the preset square wave signals and the duration;
and adjusting the communication frequency according to the current communication frequency so as to realize the communication frequency synchronization with the transmitting end.
Optionally, before starting timing after receiving a high-level signal sent by the sending end through a control line, the method further includes:
receiving first data sent by a sending end through a data line, wherein the first data is data sent by the sending end to a receiving end through the data line based on the current communication frequency;
judging whether the first data is first preset data or not;
when the first data is first preset data, generating a first feedback signal based on the first preset data;
and sending the first feedback signal to the sending end so that the sending end receives the first feedback signal sent by the receiving end within a set time and determines that the communication frequency of the sending end is synchronous with the communication frequency of the sending end.
Optionally, after adjusting the current communication frequency based on the timed duration, the method further includes:
receiving second data sent by the sending end through a data line, wherein the second data is data sent by the receiving end to the receiving end through the data line based on the current communication frequency;
judging whether the second data is second preset data or not;
and when the second data is not second preset data, generating an abnormal alarm signal.
According to a third aspect, an embodiment of the present invention provides a communication frequency synchronization system, including: the device comprises a sending end and a control end, wherein the sending end sends a high-level signal to a receiving end through a control line; the receiving end starts timing after receiving the high-level signal through a control line, the sending end sends a preset square wave signal to the receiving end through the control line according to the current communication frequency, the receiving end stops timing after receiving the preset square wave signal sent by the sending end through the control line, and the communication frequency is adjusted based on the timing duration so as to achieve communication frequency synchronization with the sending end.
According to a fourth aspect, embodiments of the present invention provide a computer-readable storage medium storing computer instructions which, when executed by a processor, implement the method of the first aspect of the present invention and any one of its alternatives.
According to a fifth aspect, an embodiment of the present invention provides an electronic device, including:
a memory and a processor, the memory and the processor being communicatively coupled to each other, the memory having stored therein computer instructions, the processor being configured to execute the computer instructions to perform the method of the first aspect of the present invention and any one of the alternatives thereof.
The technical scheme of the invention has the following advantages:
1. the embodiment of the invention provides a communication frequency synchronization method, which is applied to a sending end and comprises the following steps: sending a high-level signal to a receiving end through a control line so that the receiving end starts timing after receiving the high-level signal through the control line; and sending a preset square wave signal to the receiving end through the control line according to the current communication frequency so that the receiving end stops timing after receiving the preset square wave signal through the control line, and adjusting the communication frequency of the receiving end based on the timing duration so as to realize the communication frequency synchronization with the receiving end. Therefore, the receiving end starts timing after receiving the high-level signal and stops timing after receiving the preset square wave signal, the frequency of the preset square wave signal is determined according to the timing duration, namely the current communication frequency of the sending end is determined, then the communication frequency of the receiving end is adjusted to the current communication frequency of the sending end, the communication frequency synchronization of the sending end and the receiving end is automatically realized, the agreement of the communication frequency is not needed in advance, and the communication efficiency is improved.
2. The embodiment of the invention provides a communication frequency synchronization method, which is applied to a receiving end and comprises the following steps: starting timing after receiving a high-level signal sent by a sending end through a control line; stopping timing after receiving a preset square wave signal sent by a sending end through a control line, wherein the preset square wave signal is a square wave signal sent by the sending end to a receiving end through the control line according to the current communication frequency of the sending end; and adjusting the communication frequency based on the timing duration to realize the communication frequency synchronization with the transmitting end. Therefore, the timing is started after the high-level signal sent by the sending end is received, and the timing is stopped after the preset square wave signal sent by the sending end is received, so that the frequency of the preset square wave signal is determined according to the timing duration, namely the current communication frequency of the sending end is determined, and then the communication frequency of the receiving end is adjusted to the current communication frequency of the sending end, thereby automatically realizing the synchronization of the communication frequencies of the sending end and the receiving end, avoiding the need of making an agreement on the communication frequency in advance, and improving the communication efficiency.
3. The embodiment of the invention provides a communication frequency synchronization system, which comprises: the device comprises a sending end and a control end, wherein the sending end sends a high-level signal to a receiving end through a control line; the receiving end starts timing after receiving the high-level signal through the control line, the sending end sends a preset square wave signal to the receiving end through the control line according to the current communication frequency, the receiving end stops timing after receiving the preset square wave signal sent by the sending end through the control line, and the communication frequency is adjusted based on the timing duration so as to achieve communication frequency synchronization with the sending end. Therefore, the transmitting end transmits the high-level signal to the receiving end through the control line and then transmits the preset square wave signal according to the current communication frequency, so that the receiving end can start timing after receiving the high-level signal and stop timing after receiving the preset square wave signal, the frequency of the preset square wave signal is determined according to the timing duration, namely the current communication frequency of the transmitting end is determined, then the communication frequency of the receiving end is adjusted to the current communication frequency of the transmitting end, the synchronization of the communication frequency of the transmitting end and the receiving end is automatically realized, the agreement of the communication frequency is not needed to be carried out in advance, and the communication efficiency is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a schematic structural diagram of a communication frequency synchronization system according to an embodiment of the present invention;
fig. 2 is a schematic diagram illustrating an interaction process of a communication frequency synchronization system according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an electronic device in an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, and are only for convenience of description and simplicity of description, but do not indicate or imply that the device or element being referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus, should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
In the description of the present invention, it should be noted that, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; the two elements may be directly connected or indirectly connected through an intermediate medium, or may be communicated with each other inside the two elements, or may be wirelessly connected or wired connected. The specific meanings of the above terms in the present invention can be understood by those skilled in the art according to specific situations.
The technical features mentioned in the different embodiments of the invention described below can be combined with each other as long as they do not conflict with each other.
The I2C bus is a simple, bidirectional two-wire synchronous serial bus. It requires only two wires to transfer information between devices connected to the bus.
The master device is used to initiate the bus to transfer data and to generate a clock to open up the devices that are transferring, when any addressed device is considered a slave device. If the host wants to send data to the slave device, the host addresses the slave device first, then actively sends the data to the slave device, and finally the host terminates the data transmission; the master device addresses the slave device first if the master device is to receive data from the slave device. The host is responsible for generating the timing clock and terminating the data transfer.
The I2c communication firstly needs to send a starting condition, needs to finish communication, needs to send a stopping condition, and can send the starting condition for multiple times to finish multi-section communication during communication, thereby avoiding other hosts from snatching a bus, and the communication mode determines that the I2c can not realize full-duplex communication actually in a half-duplex communication mode. The I2C transmission bit rate can reach 100Kbit/s in the standard mode, 400Kbit/s in the fast mode and 3.4Mbit/s in the high-speed mode; it can also be understood that the clock frequency can reach 100kHz in standard mode, 400kHz in fast mode, and 3.4MHz in high speed mode.
However, in actual communication, the communication frequencies of both communication parties cannot be known, and only a pre-agreement is made before communication to ensure the communication frequencies to be consistent, so that the communication with the automatic synchronization frequency cannot be realized.
In view of the above problem, an embodiment of the present invention provides a communication frequency synchronization system, as shown in fig. 1, the communication frequency synchronization system includes: a transmitting end and a control end, wherein, as shown in fig. 2, the transmitting end transmits a high level signal to the receiving end through a control line; the receiving end starts timing after receiving the high-level signal through the control line, the sending end sends a preset square wave signal to the receiving end through the control line according to the current communication frequency, the receiving end stops timing after receiving the preset square wave signal sent by the sending end through the control line, and the communication frequency is adjusted based on the timing duration so as to achieve communication frequency synchronization with the sending end.
The transmitting end and the receiving end are connected through an I2C bus. For the detailed working process of the communication frequency synchronization system, reference is made to the following description of the method embodiment, and no further description is given here.
Through the cooperative cooperation of the above components, the communication frequency synchronization system provided in the embodiment of the present invention transmits the preset square wave signal according to the current communication frequency after the transmitting end transmits the high level signal to the receiving end through the control line, so that the receiving end can start timing after receiving the high level signal and stop timing after receiving the preset square wave signal, thereby determining the frequency of the preset square wave signal according to the timing duration, that is, determining the current communication frequency of the transmitting end, and then adjusting the communication frequency of the receiving end to the current communication frequency of the transmitting end, thereby automatically synchronizing the communication frequencies of the transmitting end and the receiving end, without making an appointment of the communication frequency in advance, and improving the communication efficiency.
An embodiment of the present invention further provides a communication frequency synchronization method, which is applied to a sending end and a receiving end shown in fig. 1, where as shown in fig. 2, the sending end is configured to execute steps S101 to S102, and the receiving end is configured to execute steps S201 to S203, and the communication frequency synchronization method specifically includes the following steps:
step S101: and sending a high-level signal to a receiving end through a control line.
Specifically, the high level signal is a high level for a certain time, and the specific time length can be set according to actual needs, which is not limited in the present invention.
Step S201: the timing is started after receiving a high level signal transmitted from the transmitting terminal through the control line.
Specifically, by changing the SCL receiver function of the receiving end to a clock counter, the timing is started after the reception of the high level signal.
Step S102: and sending a preset square wave signal to a receiving end through a control line according to the current communication frequency.
Specifically, the preset square wave signal is a square wave signal with a fixed period formed according to the current communication frequency of the transmitting end.
Step S202: and stopping timing after the preset square wave signal sent by the sending end is received through the control line.
Specifically, since the sending end sends the preset square wave signal immediately after sending the high level signal, the time for the receiving end to start timing after receiving the high level signal is the time for starting receiving the preset square wave signal, the time for stopping timing after receiving the preset square wave signal is the time for the whole preset square wave signal, and the total timing time is the time for the whole preset square wave signal.
Step S203: and adjusting the communication frequency based on the timing duration to realize the communication frequency synchronization with the transmitting end.
Specifically, in an embodiment, the step S203 specifically includes the following steps:
step S31: and calculating the current communication frequency of the sending end based on the number and the duration of the cycles of the preset square wave signal.
Step S32: and adjusting the communication frequency according to the current communication frequency so as to realize the communication frequency synchronization with the transmitting end.
Specifically, since the number of cycles of the preset square wave signal is fixed, the duration of each cycle can be determined according to the duration and the number of cycles, so as to determine the frequency of the preset square wave signal, and the communication frequency of the receiving end is set according to the frequency of the preset square wave signal, so that the communication frequency synchronization between the receiving end and the transmitting end can be realized.
By executing the above steps, the communication frequency synchronization method provided in the embodiment of the present invention starts timing after the receiving end receives the high level signal, and stops timing after the receiving end receives the preset square wave signal, so as to determine the frequency of the preset square wave signal according to the timing duration, that is, determine the current communication frequency of the transmitting end, and then adjust the communication frequency of the receiving end to the current communication frequency of the transmitting end, thereby automatically synchronizing the communication frequencies of the transmitting end and the receiving end, without making an agreement on the communication frequency in advance, and improving the communication efficiency.
Specifically, in an embodiment, the sending end is further configured to perform the following steps:
step S104: and transmitting first preset data to a receiving end through a data line based on the current communication frequency.
The first preset data is communication frequency synchronization test data, and the data content of the data can be flexibly set according to actual needs, for example, the first preset data may be 0xff, which is only taken as an example and the present invention is not limited thereto.
Step S105: and judging whether a first feedback signal sent by a receiving end is received within a set time.
The first feedback signal is a feedback signal generated by the receiving end after receiving the first preset data. Specifically, the receiving end analyzes the received data, determines whether the received data is the first preset data, and sends a corresponding feedback signal to the sending end if the received data is the first preset data.
Step S106: when the first feedback signal transmitted by the receiving end is not received within the set time, the above step S101 is executed.
Specifically, when the first feedback signal sent by the receiving end is received within the set time, the communication frequency synchronization between the receiving end and the sending end is described, and data communication can be directly performed without performing communication frequency synchronization adjustment, so that the processing efficiency is improved.
Specifically, in an embodiment, before performing the step S104, the sending end is further configured to perform the following steps:
step S103 detects whether the communication state of the data line is idle.
Specifically, when it is detected that the communication state of the data line is idle, step S104 is executed, otherwise, step S103 is continuously executed. Therefore, the problem that the communication frequency synchronization cannot be carried out when the communication state of the data line is busy is avoided.
Specifically, in an embodiment, the receiving end is further configured to perform the following steps:
step S204: and receiving first data sent by a sending end through a data line.
The first data is data which is sent to the receiving end by the sending end through the data line based on the current communication frequency.
Step S205: and judging whether the first data is first preset data or not.
Step S206: when the first data is first preset data, a first feedback signal is generated based on the first preset data.
Step S207: and sending the first feedback signal to the sending end so that the sending end receives the first feedback signal sent by the receiving end within the set time and determines the synchronization with the communication frequency of the sending end.
Specifically, when the transmitting end and the receiving end perform data communication by using the data line of the I2C bus, if the communication frequencies of the transmitting end and the receiving end are not consistent, the data received by the receiving end may not be consistent with the data actually transmitted by the transmitting end, and therefore, the consistency of the communication frequencies of the transmitting end and the receiving end may be tested by determining whether the received data is the communication frequency synchronization test data specified in advance.
Specifically, in an embodiment, after the sending end executes the step S102, the sending end is further specifically configured to execute the following steps:
step S107: and transmitting second preset data to the receiving end through the data line based on the current communication frequency.
The second preset data is also communication frequency synchronization test data, the data content of the data can be flexibly set according to actual needs, and the data content may be the same as or different from the first preset data, and exemplarily, the second preset data may also be 0xff, which is only an example, and the present invention is not limited thereto.
Step S108: and judging whether a second feedback signal sent by the receiving end is received within the set time.
The second feedback signal is a feedback signal generated by the receiving end after receiving second preset data through the data line.
Step S109: and when the second feedback signal sent by the receiving end is not received within the set time, generating an abnormal alarm signal.
Specifically, after the communication frequency of the receiving end is set to be consistent with the current communication frequency of the sending end, whether the communication frequency synchronization of the sending end and the receiving end is achieved is verified by sending the communication frequency synchronization test data to the receiving end again, if the communication frequency synchronization is achieved, data communication between the sending end and the receiving end can be formally carried out, and if the communication frequency synchronization is not achieved, an abnormal alarm signal is generated to give an alarm, so that the communication frequency synchronization is carried out manually, and the communication frequency synchronization of the sending end and the receiving end can be guaranteed.
Specifically, in an embodiment, after the receiving end performs the step S203, the receiving end is further configured to perform the following steps:
step S208: and receiving second data sent by the sending end through the data line.
The second data is data which is sent to the receiving end by the receiving end through the data line based on the current communication frequency;
step S209: and judging whether the second data is second preset data or not.
Step S210: and when the second data is not the second preset data, generating an abnormal alarm signal.
Specifically, when the transmitting end and the receiving end perform data communication by using the data line of the I2C bus, if the communication frequencies of the transmitting end and the receiving end are not consistent, the data received by the receiving end may not be consistent with the data actually transmitted by the transmitting end, and therefore, it is possible to retest whether the receiving end is consistent with the communication frequency of the transmitting end after readjusting the communication frequency by judging whether the received data is communication frequency synchronization test data specified in advance, if the communication frequency synchronization is achieved, data communication between the receiving end and the transmitting end can be formally performed, and if the communication frequency synchronization is not achieved, an abnormal alarm signal is generated to alarm, thereby switching to manual communication frequency synchronization to ensure that the transmitting end and the receiving end can achieve communication frequency synchronization.
Specifically, in an embodiment, after the transmitting end implements communication frequency synchronization with the receiving end, the method is further specifically configured to perform the following steps:
step S110: and acquiring data to be transmitted.
Step S111: and sending the data to be transmitted to a receiving end through a data line.
Specifically, after the receiving end and the sending end realize communication frequency synchronization, data communication can be formally carried out, at the moment, the sending end sends data to the receiving end, and the receiving end can receive correct data, so that the quality of data communication is guaranteed.
After the frequency of the sending terminal is automatically identified, the invention realizes automatic synchronization by using the communication frequency originally required to be agreed by the sending terminal and the receiving terminal together, thereby greatly improving the practicability of the i2c protocol.
The following describes the communication frequency synchronization method provided in the embodiment of the present invention in detail with reference to specific application examples.
The signal lines of the I2C bus are made up of data lines and control lines, denoted SDA and SCL, respectively. Where SDA is the bidirectional data line and SCL is the clock line.
1) Communication frequency synchronization
The Master end (sending end) and the slave end (receiving end) keep clock synchronization, after the Master end starts signals, the Master end sends a 0xff on the premise that the current SDA line is based on the Master end communication frequency, and if the slave end communication frequency is the same as the Master end, an acknowledgement signal is sent, so that communication can be realized; if the slave terminal recognizes that it is not 0xff, the slave terminal sets the SCL receiver function to be a clock counter instead.
And then the Master terminal sends a high level signal to the slave terminal through the SCL, and immediately sends a preset square wave signal according to the current communication frequency of the Master terminal after sending the high level signal. The slave end starts timing after receiving the high level signal, the SCL receiver stops timing after receiving the preset square wave signal, the clock frequency of the Master end is directly calculated according to the timing duration and the number of the cycles of the preset square wave signal, and the communication frequency of the slave end is set as the clock frequency of the Master end.
The Master end sends a 0xff again on the premise that the current SDA line is based on the communication frequency of the Master end, the slave end gives an acknowledgement signal to the Master end after the second 0xff arrives, and the Master end completes the communication frequency synchronization of the Master end and the slave end after receiving the acknowledgement signal.
2) Data transceiving
After the communication frequency synchronization is finished, the master end and the slave end can normally receive and transmit data on the SDA line. When the I2c protocol is used for communication, the communication frequencies of the two parties can be automatically synchronized, and the I2C data communication can be realized.
By executing the above steps, the communication frequency synchronization method provided in the embodiment of the present invention starts timing after the receiving end receives the high level signal, and stops timing after the receiving end receives the preset square wave signal, so as to determine the frequency of the preset square wave signal according to the timing duration, that is, determine the current communication frequency of the transmitting end, and then adjust the communication frequency of the receiving end to the current communication frequency of the transmitting end, thereby automatically synchronizing the communication frequencies of the transmitting end and the receiving end, without making an agreement on the communication frequency in advance, and improving the communication efficiency.
As shown in fig. 3, an embodiment of the present invention further provides an electronic device, which may include a processor 901 and a memory 902, where the processor 901 and the memory 902 may be connected by a bus or by another manner, and fig. 3 takes the connection by the bus as an example.
Processor 901 may be a Central Processing Unit (CPU). The Processor 901 may also be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, or combinations thereof.
The memory 902, which is a non-transitory computer readable storage medium, may be used to store non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules corresponding to the methods in the embodiments of the present invention. The processor 901 executes various functional applications and data processing of the processor, i.e., implements the above-described method, by executing non-transitory software programs, instructions, and modules stored in the memory 902.
The memory 902 may include a storage program area and a storage data area, wherein the storage program area may store an application program required for operating the device, at least one function; the storage data area may store data created by the processor 901, and the like. Further, the memory 902 may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory 902 may optionally include memory located remotely from the processor 901, which may be connected to the processor 901 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
One or more modules are stored in the memory 902, which when executed by the processor 901 performs the methods described above.
The specific details of the server may be understood by referring to the corresponding related descriptions and effects in the above method embodiments, and are not described herein again.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, and the implemented program can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic Disk, an optical Disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a Flash Memory (Flash Memory), a Hard Disk (Hard Disk Drive, abbreviated as HDD) or a Solid State Drive (SSD), etc.; the storage medium may also comprise a combination of memories of the kind described above.
Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations fall within the scope defined by the appended claims.

Claims (10)

1. A communication frequency synchronization method is applied to a sending end and is characterized by comprising the following steps:
sending a high-level signal to a receiving end through a control line so that the receiving end starts timing after receiving the high-level signal through the control line;
and sending a preset square wave signal to the receiving end through the control line according to the current communication frequency so that the receiving end stops timing after receiving the preset square wave signal through the control line, and adjusting the communication frequency of the receiving end based on the timing duration so as to realize the communication frequency synchronization with the receiving end.
2. The method of claim 1, wherein before sending a high signal to the receiving end through the control line, the method further comprises:
sending first preset data to a receiving end through a data line based on the current communication frequency;
judging whether a first feedback signal sent by the receiving end is received within a set time, wherein the first feedback signal is a feedback signal generated by the receiving end after the receiving end receives the first preset data;
and when the first feedback signal sent by the receiving end is not received within the set time, sending a high-level signal to the receiving end through a control line.
3. The method of claim 1, wherein after transmitting a preset square wave signal to the receiving end through the control line at the current communication frequency, the method further comprises:
sending second preset data to a receiving end through a data line based on the current communication frequency;
judging whether a second feedback signal sent by the receiving end is received within a set time, wherein the second feedback signal is a feedback signal generated after the receiving end receives the second preset data through a data line;
and when the second feedback signal sent by the receiving end is not received within the set time, generating an abnormal alarm signal.
4. The method of claim 1, wherein after the communication frequency synchronization with the receiving end is achieved, the method further comprises:
acquiring data to be transmitted;
and sending the data to be transmitted to the receiving end through a data line.
5. A communication frequency synchronization method is applied to a receiving end and is characterized by comprising the following steps:
starting timing after receiving a high-level signal sent by a sending end through a control line;
stopping timing after receiving a preset square wave signal sent by the sending end through a control line, wherein the preset square wave signal is the square wave signal sent by the sending end to the receiving end through the control line according to the current communication frequency of the sending end;
and adjusting the communication frequency based on the timing duration to realize the communication frequency synchronization with the transmitting end.
6. The method of claim 5, wherein adjusting the communication frequency based on the length of the timing comprises:
calculating the current communication frequency of the sending end based on the number of the periods of the preset square wave signals and the duration;
and adjusting the communication frequency according to the current communication frequency so as to realize the communication frequency synchronization with the transmitting end.
7. The method according to claim 5, wherein before starting timing after receiving a high level signal transmitted from the transmitting end through a control line, the method further comprises:
receiving first data sent by a sending end through a data line, wherein the first data is data sent by the sending end to a receiving end through the data line based on the current communication frequency;
judging whether the first data is first preset data or not;
when the first data is first preset data, generating a first feedback signal based on the first preset data;
sending the first feedback signal to the sending end so that the sending end receives the first feedback signal sent by the receiving end within a set time and determines that the communication frequency of the sending end is synchronous with the communication frequency of the sending end;
after adjusting the current communication frequency based on the timed length, the method further comprises:
receiving second data sent by the sending end through a data line, wherein the second data is data sent by the receiving end to the receiving end through the data line based on the current communication frequency;
judging whether the second data is second preset data or not;
and when the second data is not second preset data, generating an abnormal alarm signal.
8. A communication frequency synchronization system, comprising: a sending end and a control end, wherein,
the transmitting end transmits a high-level signal to the receiving end through a control line;
the receiving end starts timing after receiving the high level signal through the control line,
the sending end sends a preset square wave signal to the receiving end through the control line according to the current communication frequency,
and the receiving end stops timing after receiving the preset square wave signal sent by the sending end through a control line, and adjusts the communication frequency based on the timing duration so as to realize the communication frequency synchronization with the sending end.
9. An electronic device, comprising:
a memory and a processor, the memory and the processor being communicatively coupled to each other, the memory having stored therein computer instructions, the processor being configured to execute the computer instructions to perform the method of any of claims 1-7.
10. A computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions that, when executed by a processor, implement the method of any one of claims 1-7.
CN202111647831.4A 2021-12-29 2021-12-29 Communication frequency synchronization method and system Active CN114448594B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111647831.4A CN114448594B (en) 2021-12-29 2021-12-29 Communication frequency synchronization method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111647831.4A CN114448594B (en) 2021-12-29 2021-12-29 Communication frequency synchronization method and system

Publications (2)

Publication Number Publication Date
CN114448594A true CN114448594A (en) 2022-05-06
CN114448594B CN114448594B (en) 2023-08-08

Family

ID=81366356

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111647831.4A Active CN114448594B (en) 2021-12-29 2021-12-29 Communication frequency synchronization method and system

Country Status (1)

Country Link
CN (1) CN114448594B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103491198A (en) * 2013-09-16 2014-01-01 上海交通大学 Ten billion Ethernet transmission system used for positron emission computer tomography
CN105099644A (en) * 2014-04-23 2015-11-25 小米科技有限责任公司 Half-duplex communication method and device
CN109792376A (en) * 2017-02-14 2019-05-21 华为技术有限公司 A kind of clock synchronizing method and equipment
CN113609043A (en) * 2021-06-20 2021-11-05 山东云海国创云计算装备产业创新中心有限公司 Data transmission method, device and equipment of I2C host and readable medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103491198A (en) * 2013-09-16 2014-01-01 上海交通大学 Ten billion Ethernet transmission system used for positron emission computer tomography
CN105099644A (en) * 2014-04-23 2015-11-25 小米科技有限责任公司 Half-duplex communication method and device
CN109792376A (en) * 2017-02-14 2019-05-21 华为技术有限公司 A kind of clock synchronizing method and equipment
CN113609043A (en) * 2021-06-20 2021-11-05 山东云海国创云计算装备产业创新中心有限公司 Data transmission method, device and equipment of I2C host and readable medium

Also Published As

Publication number Publication date
CN114448594B (en) 2023-08-08

Similar Documents

Publication Publication Date Title
JP4936204B2 (en) Communication system and communication method
CN106063198A (en) Subscriber station for a bus system and method for improving the quality of transmission in a bus system
CN112968752B (en) Baud rate switching method and device for UART communication and initiator terminal
CA2932451A1 (en) Method and apparatus for transmitting d2d discovery signal and communication system
CN105183687B (en) A kind of timesharing serial port communication method and system
CN105701038B (en) A kind of cascade chip starting method and relevant apparatus
US9332536B1 (en) Method and apparatus for managing communication on a wireless channel
WO2013181969A1 (en) Method, device and system for device-to-device (d2d) communication
CN111491351B (en) Method and system for sensing online of WiFi terminal based on authentication information
CN114448594A (en) Communication frequency synchronization method and system
CN113746217B (en) Wireless equipment matching communication method and system based on trend judgment and electronic equipment
CN106850713B (en) Data transmission method and device based on serial server and serial server
JP2004531994A5 (en)
CN114243954B (en) Wireless equipment matching communication system and method based on waveform characteristics and electronic equipment
US11917543B2 (en) Bluetooth-based data transmission method and data receiving method, communicating apparatus and computer storage medium
CN109995632B (en) Communication method, device and system of multi-machine communication system
WO2015109524A1 (en) Method and device for transmitting synchronisation signal
WO2018035681A1 (en) Method of establishing interface connection, and interface chip
US20130244585A1 (en) Transmission Power Control Negotiation Method and Wireless Communication System Using the Same
US9307509B1 (en) Transmitting radio signals using simultaneous retransmission
EP2901561A1 (en) Channel reuse among communication networks sharing a communication channel
CN114443551B (en) Method, system, equipment and medium for realizing I2C communication by single line
TW202022627A (en) Universal serial bus device and operation method thereof
CN106788742B (en) The method of PON module management CATV module in double-fiber convergent terminal
CN105812086A (en) Monitor communication method and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant