A synchronous communication system, method, device, electronic device and storage medium

By adjusting the level status of the universal input and output interface in SPI communication, the timing between devices is ensured, the problem of insufficient robustness and robustness of SPI communication is solved, and more stable data interaction is achieved.

CN118535357BActive Publication Date: 2024-09-27BEIJING PHIGENT TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411006247.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-25
Publication Date
2024-09-27
Estimated Expiration
2044-07-25

AI Technical Summary

Technical Problem

There is a lack of effective mechanism in SPI communication to ensure the timing between devices, resulting in poor communication robustness and robustness.

Method used

After establishing a connection between devices, adjust the output status of the general input and output interface to high level to ensure the timing of data interaction, and adjust it to low level after the interaction is completed to provide an effective triggering mechanism to ensure timing.

Benefits of technology

The robustness and robustness of SPI communication are improved, allowing the device to communicate with any cycle size to avoid data interaction failures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118535357B
    Figure CN118535357B
Patent Text Reader

Abstract

The present application is about a synchronous communication system, device, electronic device and storage medium, including: after the first device establishes a connection with the second device, the first data is copied to the first storage area of ​​the first device; the output state of the general input and output interface is adjusted to a high level; the first data is sent to the receiving buffer queue of the second device; when the second device detects that the output state of the general input and output interface is high, the second data is copied to the first storage area of ​​the second device, and then sent to the receiving buffer queue of the first device; the first data is sent to the second storage area of ​​the second device; the first data is read and parsed from the second storage area of ​​the second device; the second data is sent to the second storage area of ​​the first device; the output state of the general input and output interface is adjusted to a low level; and the second data is read and parsed. In this way, the timing between the first device and the second device is ensured, and the robustness and robustness of SPI communication are improved.
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, method, device, electronic device and storage medium. Background Art

[0002] SPI (Serial Peripheral Interface) is a synchronous serial communication bus with the characteristics of high speed, full-duplex and simplicity. It allows a second device (Master) to initiate communication with one or more first devices (Slave) to complete data exchange.

[0003] The SPI interface usually uses four signal lines for communication, namely two data lines, one clock line and one chip select signal line. The two data lines are used for data transmission, the clock line is initiated by the second device and is used to provide a clock pulse, and the chip select signal line is used by the second device to select the first device that needs to communicate.

[0004] However, in the prior art, there is no effective mechanism to ensure the timing between the first device and the second device during the SPI communication process. If the startup time of the second device is inconsistent with that of the first device, data interaction between the second device and the first device may fail. Therefore, the robustness and robustness of SPI communication are poor. Summary of the invention

[0005] The present application provides a synchronous communication system, method, device, electronic device and storage medium to at least solve the problem in the related art that the timing between the first device and the second device cannot be ensured during the SPI communication process, resulting in poor robustness and robustness of the SPI communication. The technical solution of the present disclosure is as follows:

[0006] According to a first aspect of an embodiment of the present disclosure, there is provided a synchronous communication method, including:

[0007] The first device is configured to copy the first data to the first storage area of ​​the first device after establishing a connection with the second device; adjust the output state of the general input / output interface to a high level; and send the first data from the first storage area of ​​the first device to the receiving buffer queue of the second device;

[0008] The second device is configured to, when detecting that the output state of the universal input / output interface is at a high level, copy the second data to the first storage area of ​​the second device; send the second data from the first storage area of ​​the second device to the receiving buffer queue of the first device; send the first data from the receiving buffer queue of the second device to the second storage area of ​​the second device; and read and parse the first data from the second storage area of ​​the second device;

[0009] The first device is also used to send the second data from the receiving buffer queue of the first device to the second storage area of ​​the first device; adjust the output state of the general input and output interface to a low level; and read and parse the second data from the transmission memory area of ​​the first device.

[0010] Optionally, the first data is copied from the file transfer buffer of the first device to the first storage area of ​​the first device through the application layer communication management program of the first device;

[0011] The second data is copied from the second storage area of ​​the first device to the file receiving buffer of the first device through the application layer communication management program of the first device, and the second data in the file receiving buffer of the first device is parsed.

[0012] Optionally, the second device is specifically used for:

[0013] Copying the second data from the file transfer buffer of the second device to the first storage area of ​​the second device through the application layer communication management program of the second device;

[0014] The first data is copied from the second storage area of ​​the second device to the file receiving buffer of the second device through the application layer communication management program of the second device, and the first data in the file receiving buffer of the second device is parsed.

[0015] Optionally, the first device is specifically used to:

[0016] sending, through a direct memory storage module of the first device, the first data from a first storage area of ​​the first device to a transmission buffer queue of the first device;

[0017] Sending the first data from a transmission buffer queue of the first device to a shift register of the first device;

[0018] The first data is sent from the shift register of the first device to the receiving buffer queue of the second device through a synchronous serial communication bus interface.

[0019] Optionally, the second device is specifically used for:

[0020] The shift register of the second device receives the first data sent by the shift register of the first device through the synchronous serial communication bus interface, and sends the first data to the receiving buffer queue of the second device;

[0021] The first data is sent from the receiving buffer queue of the second device to the second storage area of ​​the second device through the direct memory storage module of the second device.

[0022] Optionally, the second device is specifically used for:

[0023] sending the second data from the first storage area of ​​the second device to a transmission buffer queue of the second device through a direct memory storage module of the second device;

[0024] sending the second data from a transmission buffer queue of the second device to a shift register of the second device;

[0025] The second data is sent from the shift register of the second device to the receiving buffer queue of the first device through the synchronous serial communication bus interface.

[0026] Optionally, the first device is specifically used to:

[0027] The shift register of the first device receives the second data sent by the shift register of the second device through the synchronous serial communication bus interface, and sends the second data to the receiving buffer queue of the first device;

[0028] The second data is sent from the receiving buffer queue of the first device to the second storage area of ​​the first device through the direct memory storage module of the first device.

[0029] Optionally, the first device is specifically used to:

[0030] Based on the timestamp of the second device, performing remote processing on the first data;

[0031] The processed first data is copied to a file transfer buffer of a first device, and is transferred from the file transfer buffer of the first device to a first storage area of ​​the first device.

[0032] Optionally, the first device is specifically used to:

[0033] Acquire a time difference between the first device and the second device;

[0034] The time period taken by the direct memory storage module of the first device to send the first data to the transmission buffer queue of the first device is added to the time difference to serve as a remote timestamp of the first data.

[0035] Optionally, the first device is specifically used to:

[0036] Based on the timestamp of the second device, localize the second data stored in the receiving buffer queue of the first device;

[0037] The processed second data is sent to the second storage area of ​​the first device.

[0038] Optionally, the first device is specifically used to:

[0039] Acquire a time difference between the first device and the second device;

[0040] The time period taken by the direct memory storage module of the second device to transmit the second data to the transmission buffer queue of the second device is added to the time difference to obtain a localized timestamp of the second data.

[0041] Optionally, the first device is specifically used to:

[0042] Add the most recently acquired timestamp of the second device to the time period taken for the synchronous serial communication bus between the second device and the first device to transmit a data packet, and subtract the timestamp of the first device to obtain the time difference between the first device and the second device; wherein the timestamp of the second device is carried in the second data.

[0043] Optionally, the first device is specifically used to:

[0044] Determining whether the accumulated number of the time differences exceeds a preset number;

[0045] If it exceeds, the most recent preset number of time differences are accumulated and averaged;

[0046] It is determined whether the absolute difference between the mean and the currently calculated time difference is greater than a set threshold; if so, the current time difference is adjusted to the mean.

[0047] According to a second aspect of an embodiment of the present disclosure, a synchronous communication method is provided, which is applied to a first device and includes:

[0048] After establishing a connection with the second device, copying the first data to the first storage area of ​​the first device;

[0049] Adjust the output state of the general input and output interface to a high level;

[0050] Sending the first data from the first storage area of ​​the first device to a receiving buffer queue of the second device;

[0051] Sending second data from the receiving buffer queue of the first device to a second storage area of ​​the first device;

[0052] Adjusting the output state of the universal input / output interface to a low level;

[0053] The second data is read and parsed from a second storage area of ​​the first device.

[0054] According to a third aspect of an embodiment of the present disclosure, a synchronous communication method is provided, which is applied to a second device, including:

[0055] When it is detected that the output state of the general input / output interface is at a high level, copying the second data to the first storage area of ​​the second device;

[0056] sending the second data from the first storage area of ​​the second device to a receiving buffer queue of the first device;

[0057] receiving first data sent from a first storage area to a receiving buffer queue of a second device, and sending the first data from the receiving buffer queue of the second device to a second storage area of ​​the second device;

[0058] The first data is read and parsed from a second storage area of ​​the second device.

[0059] According to a fourth aspect of an embodiment of the present disclosure, a synchronous communication apparatus is provided, which is applied to a first device, including:

[0060] A first transmission module, configured to copy the first data to a first storage area of ​​the first device after establishing a connection with the second device;

[0061] A first adjustment module, used for adjusting the output state of the general input and output interface to a high level;

[0062] A second transmission module, configured to send the first data from the first storage area of ​​the first device to a receiving buffer queue of a second device;

[0063] A third transmission module, configured to send second data from the receiving buffer queue of the first device to a second storage area of ​​the first device;

[0064] A second adjustment module, used for adjusting the output state of the universal input and output interface to a low level;

[0065] A fourth transmission module is used to read and parse the second data from the second storage area of ​​the first device.

[0066] According to a fifth aspect of an embodiment of the present disclosure, a synchronous communication apparatus is provided, which is applied to a second device, including:

[0067] A detection module, configured to copy the second data to the first storage area of ​​the second device when detecting that the output state of the general input / output interface is at a high level;

[0068] A sending module, used for sending the second data from the first storage area of ​​the second device to the receiving buffer queue of the first device;

[0069] A receiving module, configured to receive first data sent from a first storage area to a receiving buffer queue of a second device, and send the first data from the receiving buffer queue of the second device to a second storage area of ​​the second device;

[0070] A processing module is used to read and parse the first data from the second storage area of ​​the second device.

[0071] According to a sixth aspect of an embodiment of the present disclosure, there is provided a synchronous communication electronic device, including:

[0072] processor;

[0073] a memory for storing instructions executable by the processor;

[0074] The processor is configured to execute the instructions to implement any one of the synchronous communication methods described above.

[0075] According to the seventh aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of a synchronous communication electronic device, the synchronous communication electronic device is enabled to execute any one of the synchronous communication methods described above.

[0076] According to an eighth aspect of an embodiment of the present disclosure, there is provided a computer program product, comprising a computer program / instruction, wherein when the computer program / instruction is executed by a processor, the synchronous communication method described in any one of the above is implemented.

[0077] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:

[0078] In the scheme provided in the present application, after establishing a connection with the second device, the first device copies the first data to the first storage area of ​​the first device; adjusts the output state of the general input / output interface to a high level; sends the first data from the first storage area of ​​the first device to the receiving buffer queue of the second device; when the second device detects that the output state of the general input / output interface is a high level, the second device copies the second data to the first storage area of ​​the second device; sends the second data from the first storage area of ​​the second device to the receiving buffer queue of the first device; sends the first data from the receiving buffer queue of the second device to the second storage area of ​​the second device; reads and parses the first data from the second storage area of ​​the second device; the first device sends the second data from the receiving buffer queue of the first device to the second storage area of ​​the first device; adjusts the output state of the general input / output interface to a low level; and reads and parses the second data from the transmission memory area of ​​the first device.

[0079] In this way, before the first device exchanges data, it adjusts the output state of the universal input / output interface to a high level. The second device determines the output state of the universal input / output interface and agrees to exchange data with the first device when the output state is a high level. After the data interaction is completed, the first device adjusts the output state of the universal input / output interface to a low level again. That is to say, by adding a universal input / output interface, an effective trigger mechanism is provided to ensure the timing between the first device and the second device, so that the second device and the first device can communicate with each other in any cycle size, thereby improving the robustness and robustness of the SPI communication.

[0080] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0081] Figure 1 The present invention is a flowchart of a synchronous communication method according to an exemplary embodiment.

[0082] Figure 2 The diagram is a data interaction diagram of a synchronous communication method according to an exemplary embodiment.

[0083] Figure 3 It is an overall block diagram showing a periodic transmission control process according to an exemplary embodiment.

[0084] Figure 4 The present invention is a flowchart of programming of a second device according to an exemplary embodiment.

[0085] Figure 5 It is a flowchart of programming of a first device according to an exemplary embodiment.

[0086] Figure 6 The figure is a schematic diagram showing a principle of data timestamp synchronization according to an exemplary embodiment.

[0087] Figure 7 The figure is a schematic diagram showing the composition of a time difference according to an exemplary embodiment.

[0088] Figure 8 The figure is a schematic diagram of a time difference updating process according to an exemplary embodiment.

[0089] Fig. 9 The present invention is a flowchart of a synchronous communication method according to an exemplary embodiment.

[0090] Fig.10 The present invention is a flowchart of a synchronous communication method according to an exemplary embodiment.

[0091] Fig.11 The invention is a block diagram of a synchronous communication device according to an exemplary embodiment.

[0092] Fig.12 The invention is a block diagram of a synchronous communication device according to an exemplary embodiment.

[0093] Fig.13 It is a block diagram of an electronic device for synchronous communication according to an exemplary embodiment.

[0094] Fig.14 It is a block diagram of a device for synchronous communication according to an exemplary embodiment. DETAILED DESCRIPTION

[0095] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0096] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.

[0097] Figure 1 is a flowchart of a synchronous communication method according to an exemplary embodiment. Figure 1 As shown, the synchronous communication method includes:

[0098] In step S11, after establishing a connection with the second device, the first device copies the first data to the first storage area of ​​the first device; adjusts the output state of the general input and output interface to a high level; and sends the first data from the first storage area of ​​the first device to the receiving buffer queue of the second device.

[0099] SPI allows a host to start communication with one or more slaves to complete data exchange. However, in the related art, there is no effective mechanism to ensure the timing between the slave and the host during the SPI communication process. If the start time of the host and the slave is inconsistent, the data exchange between the host and the slave may fail. Therefore, the robustness and robustness of SPI communication are poor.

[0100] Based on this, the present application provides a synchronous communication method to solve the above problems.

[0101] In this step, the first device is a slave in the SPI system, and the second device is a host in the SPI system. First, after establishing a connection with the second device, the first device copies the first data to the first storage area of ​​the first device, wherein the first data is data that the first device needs to send to the second device for data interaction, and can be a data file or information instruction in any form. For example, the first data can be packaged PDU (Protocol Data Unit, also known as message / message packet) data, which is not limited in this application.

[0102] In the present application, the first storage area of ​​the first device refers to a TX TMA (Transfer Memory Area) of the first device, and the first storage area of ​​the first device is located in a main memory RAM (Random Access Memory) of the first device.

[0103] In one implementation, the first device copies the first data from the file transfer buffer of the first device to the first storage area of ​​the first device through the application layer communication management program of the first device.

[0104] The application layer communication management program of the first device refers to the SPI Manager of the first device, which can be used to record the communication status and perform data packing and unpacking operations. In other words, the first data is stored in the file transfer buffer of the first device, that is, the TX Buffer of the first device, and the TX Buffer is also located in the main memory RAM of the first device. Therefore, the SPI Manager can copy the first data from the file transfer buffer of the first device to the TX TMA of the first device.

[0105] Then, before sending the first data to the second device, the first device adjusts the output state of the general-purpose input / output (GPIO) interface to a high level. In this way, by triggering the change of the output state of the GPIO interface, a trigger mechanism is formed, which can realize the response between the second device and the first device and ensure the timing of data interaction between the second device and the first device.

[0106] Furthermore, after the output state of the GPIO interface is adjusted to a high level, the first device can send the first data from the first storage area of ​​the first device to the receiving buffer queue of the second device. The receiving buffer queue of the second device refers to the RX FIFO of the second device, which is a buffer zone that can be used to temporarily store the received first data.

[0107] In one implementation, the first device is specifically configured to:

[0108] Sending, through a direct memory storage module of the first device, first data from a first storage area of ​​the first device to a transmission buffer queue of the first device;

[0109] Sending the first data from the transmission buffer queue of the first device to the shift register of the first device;

[0110] The first data is sent from the shift register of the first device to the receiving buffer queue of the second device through the synchronous serial communication bus interface.

[0111] That is to say, the transmission process of the first data in the first device specifically includes: first, through the direct memory access (DMA) module of the first device, the first data is sent from the first device TX TMA to the transmission buffer queue of the first device, that is, the first device TX FIFO; then, the first data is sent from the first device TX FIFO to the shift register (SPI Shift Register) of the first device; and further, through the SPI interface, the first data is sent from the first device SPI Shift Register to the second device RX FIFO.

[0112] Among them, the DMA module can trigger data transmission in the TX TMA of the first device. Specifically, during the transmission process, when the TX FIFO of the first device is reduced to a predefined depth, the DMA module is triggered to transfer data from the TX TMA of the first device to the TX FIFO of the first device, so that the data depth in the TX FIFO of the first device can be maintained at a certain level, so as to make the transmission efficiency of the SPI interface higher.

[0113] In step S12, when the second device detects that the output state of the general input / output interface is at a high level, the second device copies the second data to the first storage area of ​​the second device; sends the second data from the first storage area of ​​the second device to the receiving buffer queue of the first device; sends the first data from the receiving buffer queue of the second device to the second storage area of ​​the second device; and reads and parses the first data from the second storage area of ​​the second device.

[0114] In this step, when the second device detects that the output state of the general input / output interface is at a high level, it can initiate data interaction with the first device and send the first data from the receiving buffer queue of the second device to the second storage area of ​​the second device; wherein the second storage area of ​​the second device is the RX TMA of the second device, and the second device RXTMA is located in the main memory RAM of the second device.

[0115] Then, the first data is read and parsed from the second storage area of ​​the second device. For example, if the first data is a PDU, the first data may be unpacked and then the unpacked data may be processed to implement data interaction between the second device and the first device.

[0116] In one implementation, the second device is specifically used to copy the first data from the second storage area of ​​the second device to the file receiving buffer of the second device through the application layer communication management program of the second device, and parse the first data in the file receiving buffer of the second device.

[0117] Among them, the application layer communication management program of the second device refers to the SPI Manager of the second device, the second storage area of ​​the second device refers to the RX TMA of the second device, the file receiving buffer of the second device refers to the RXBuffer of the second device, and the second device RX Buffer is also located in the main memory RAM of the second device. Therefore, the SPI Manager can copy the first data from the second device RX TMA to the second device RX Buffer in a copying manner, and then perform data parsing processing in the second device RXBuffer.

[0118] At the same time, when the second device detects that the output state of the general input and output interface is high, it can also copy the second data to the first storage area of ​​the second device; wherein the second data is the data that the second device needs to send to the first device for data interaction, and can be any form of data file or information instruction, for example, the second data can be packaged PDU data, etc., which is not limited in this application. The first storage area of ​​the second device refers to the TXTMA of the second device, and the first storage area of ​​the second device is located in the main memory RAM of the first device.

[0119] Then, the second device can send the second data from the first storage area of ​​the second device to the receiving buffer queue of the first device. The receiving buffer queue of the first device refers to the RX FIFO of the first device, which is a buffer zone that can be used to temporarily store the received second data.

[0120] In the present application, the transmission process of the second data in the second device is similar to the transmission process of the first data in the first device, and will not be repeated here.

[0121] In one implementation, the second device is specifically configured to copy the second data from the file transfer buffer of the second device to the first storage area of ​​the second device through an application layer communication management program of the second device.

[0122] That is, the second data is stored in the file transfer buffer of the second device, that is, the TX Buffer of the second device, and the TX Buffer is also located in the main memory RAM of the second device. Therefore, the SPI Manager can copy the second data from the file transfer buffer of the second device to the TX TMA of the second device.

[0123] In one implementation, the second device is specifically configured to:

[0124] The shift register of the second device receives the first data sent by the shift register of the first device through the synchronous serial communication bus interface, and sends the first data to the receiving buffer queue of the second device;

[0125] The first data is sent from the receiving buffer queue of the second device to the second storage area of ​​the second device through the direct memory storage module of the second device.

[0126] That is to say, the transmission process of the first data in the second device specifically includes: first, through the SPI interface, the second device SPI Shift Register receives the first data sent by the first device SPI Shift Register, and then, sends the first data from the second device SPI Shift Register to the second device RX FIFO; then, the second device DMA module sends the first data from the second device RX FIFO to the second device RX TMA.

[0127] Among them, the DMA module can trigger data transmission in the second device RX TMA. Specifically, during the transmission process, when the second device RX FIFO increases to a predefined depth, the DMA module is triggered to transfer data from the second device RX FIFO to the second device RX TMA, so that the data depth in the first device TX FIFO can be maintained at a certain level, so as to make the transmission efficiency of the SPI interface higher.

[0128] In step S13, the first device sends the second data from the receiving buffer queue of the first device to the second storage area of ​​the first device; adjusts the output state of the general input and output interface to a low level; and reads and parses the second data from the second storage area of ​​the first device.

[0129] In this step, the first device receives the second data from the second device, thereby realizing data interaction between the first device and the second device, that is, the first data is transmitted from the first device to the second device, and the second data is transmitted from the second device to the second device. Then, the first device adjusts the output state of the GPIO interface to a low level, and correspondingly, when the second device detects that the output state of the GPIO interface is a low level, it will also suspend data interaction with the first device, so that the communication cycle of data interaction is realized, and the timing of SPI communication can be improved.

[0130] In one implementation, the first device copies the second data from the second storage area of ​​the first device to the file receiving buffer of the first device through the application layer communication management program of the first device, and parses the second data in the file receiving buffer of the first device.

[0131] That is to say, the transmission process of the second data in the first device is similar to the transmission process of the first data in the second device in the aforementioned steps, and will not be repeated here.

[0132] The data interaction process in this application is described below through a specific embodiment.

[0133] like Figure 2 As shown, it is a data interaction schematic diagram of the synchronous communication method provided by the present application, wherein the SPI-based communication solution provided by the present application is implemented by three parts, namely, SPI Manager (application layer communication manager), RAM, and SPI Driver (driver).

[0134] SPI Manager is responsible for recording the communication status and packing and unpacking the data. Taking the first device sending the first data as an example, the first data to be sent is first packed into a PDU, and then copied from TXBuffer to the TX TMA of the first device. Conversely, when the first device receives the second data, it first copies the PDU from the RXTMA of the first device and sends it to the RX Buffer in the SPI Manager of the first device, and then unpacks it.

[0135] A section of RAM is allocated to store communication data, ensuring that both the TX / RX Buffer and the TX / RX TMA are located in the main RAM, so that data between the two can be copied directly. The data copy can be achieved by calling the memory copy function (mem copy).

[0136] The SPI Driver includes TX / RX FIFO and SPI Shift Register, where TX / RX FIFO is a buffer used to temporarily store data from / to the SPI Shift Register. The SPI Shift Register is a shift register used to send and receive data on the bus.

[0137] SPI is a low-speed module relative to the CPU, so the present invention adds a DMA module to make the transmission efficiency of SPI higher. In the actual transmission process, for sending the first data, when the first device TX FIFO is reduced to a certain predefined depth, the first device DMA module is triggered to transfer the first data from the first device TX TMA to the first device TXFIFO. For receiving the second data, when the first device RX FIFO is increased to a certain predefined depth, the first device DMA module is triggered to transfer the second data from the first device RX FIFO to the first device RX TMA.

[0138] The data interaction method in the second device is similar to that in the first device and will not be described in detail here.

[0139] From the above description, it can be seen that TMA can be accessed by both the upper-layer SPI Manager and the lower-layer DMA, which creates a competitive state. For example, when the SPI Manager is reading the RX TMA, the DMA is transmitting data to it, which may cause the former to read damaged data. In order to solve this problem, this application will perform periodic regulation on the transmission of data, that is, when sending and receiving data, it is strictly executed in a cycle order. A cycle can be described as: TX Buffer, TX TMA, TX FIFO, wait for the SPI Shift Register of the driver layer to complete the data exchange, and then execute the receiving process: RX FIFO, RX TMA, RX Buffer.

[0140] like Figure 3 As shown, it is the overall block diagram of the periodic transmission control process. Figure 4 , Figure 5 The second device (master) and the first device (slave) correspond to Figure 3The program design flow chart of periodic transmission control is shown.

[0141] In order to improve the robustness and robustness of SPI communication, the present application adds a GPIO port based on the SPI communication port, so as to realize arbitrary periodic communication between the second device and the first device. By detecting the level state of GPIO, the problem of interaction failure can be effectively avoided.

[0142] First, after the first device completes data packaging (Packet) and DMA configuration, and realizes hardware initialization and related parameter initialization, when it needs to establish a connection with the second device, the output state of the GPIO interface is adjusted to a high level. The second device waits for the GPIO rising edge. When it detects that the output state of the GPIO interface is adjusted to a high level, it performs data packaging and DMA configuration of the second device to realize hardware initialization and related parameter initialization. Then, SPI communication can begin between the first device and the second device.

[0143] Then, the message to be sent, such as the first data in the first device and the second data in the second device, is copied from the TX Buffer to the TX TMA. After that, the first device can determine the predefined depth of the TX / RX FIFO of the first device according to the DMA_INT field. When the TX FIFO of the first device is reduced to the predefined depth, the DMA module of the first device transfers the first data from the TX TMA of the first device to the TX FIFO of the first device, or, when the RXFIFO of the first device is increased to the predefined depth, the DMA module of the first device transfers the second data from the RX FIFO of the first device to the RX TMA of the first device, and then to the RX Buffer, parses the second data, and calls the data distribution callback function. The data transmission method of the DMA module in the second device is similar to that in the first device, which will not be repeated here.

[0144] After data transmission within a communication cycle is completed, the first device adjusts the output state of the GPIO interface to a low level to suspend data interaction between the second device and the first device. In this way, periodic control (Clock control) of data interaction is achieved through the level change of the GPIO interface.

[0145] The size of the communication cycle is determined by the first device, which allows any required communication cycle to be implemented, while the second device is only responsible for starting the communication. Even if there are some task delays between the first device and the second device, this will only cause the communication cycle to become longer, and will not cause communication failure. In addition, the second device prevents the problem of communication failure caused by inconsistent start clocks between the first device and the second device by detecting the GPIO rising edge and high level. This improvement enhances the reliability and stability of SPI communication and makes the communication more robust.

[0146] It is understandable that usually there are different time sources on two different chips, so the time sources of the second device and the first device are different, there are different time drifts, and their startup times are also inconsistent, resulting in different time domains for the second device and the first device. When the data timestamps obtained in different time domains are used for algorithm calculations at the application layer, data in different time domains cannot be synchronized, so it is necessary to synchronize the time of the data transmitted in the second device and the first device.

[0147] In one implementation, the first device is specifically used to perform remote processing on the first data based on the timestamp of the second device; copy the processed first data to the file transfer buffer of the first device, and transfer it from the file transfer buffer of the first device to the first storage area of ​​the first device.

[0148] That is to say, the present application requires remote processing of timestamps in different time domains, similar to the need to synchronize time differences in different countries and regions, wherein the remote processing of timestamps is completed in the first device, and the second device does not pay attention to the processing of timestamps.

[0149] Specifically, the data sent by the second device to the first device usually carries a corresponding timestamp. The first device can read and store the timestamp of the most recent data received from the second device as the timestamp of the second device. Then, when generating the first data, the timestamp of the first data is processed remotely based on the timestamp of the second device. In this way, the first data in the TX Buffer of the first device has been processed remotely, and after being sent to the second device, the first data is consistent with the timestamp of the second device.

[0150] In one implementation, the first device is specifically used to obtain the time difference between the first device and the second device; the time period taken by the direct memory storage module of the first device to complete receiving data from the buffer of the first device is added to the time difference as the remote timestamp of the first data.

[0151] Specifically, if Figure 6As shown, it is a schematic diagram of the principle of data timestamp synchronization. It can be seen that when data interacts between the first device and the second device, in order to maintain the consistency of the timestamp, the first device needs to perform remote processing and local processing of the timestamp when sending and receiving data respectively.

[0152] Specifically, the first device needs to use the time difference offset between the first device and the second device and the time period SL_T taken by the DMA module of the first device to send the first data to the TX FIFO of the first device during the SPI communication process. DMA , the timestamp of the first data transmitted to the second device end is processed remotely, that is, the timestamp of the data output remotely from the first device end to the second device end SL_Ta = SL_T DMA + offset. In addition, the time difference offset between the first device and the second device and the time period MA_T taken to send from the TX FIFO of the second device to the DMA module of the second device are also required. DMA , localize the timestamp of the second data received from the second device, that is, the first device localizes the timestamp MA_T of the data transmitted from the second device S =MA_T DMA offset.

[0153] It is not difficult to see from the above description that the key to data timestamp synchronization lies in the time difference between two time domains, namely, offset.

[0154] In one implementation, the first device is specifically configured to:

[0155] The time difference between the first device and the second device is obtained by adding the most recently acquired timestamp of the second device to the time period taken for the synchronous serial communication bus between the second device and the first device to transmit the data packet, and subtracting the timestamp of the first device; wherein the timestamp of the second device is carried in the second data.

[0156] like Figure 7 As shown, it is a schematic diagram of the composition of the time difference, which mainly includes the host time domain, the slave time domain and the time period spent by the SPI hardware link between the second device and the first device to transmit the data packet. Specifically, the meaning of the time variables included in the data transmission process in this application is as follows, and the units are all microseconds (us):

[0157] The host time domain includes T MA 、MA_T DMA ;

[0158] T MA : The local timestamp of the second device before the second device sends the data packet;

[0159] MA_T DMA : The time period taken by the DMA module of the second device to transfer data with the TX / RX FIFO;

[0160] T SPI : The time period taken by the SPI hardware link between the second device and the first device to transmit the data packet. This time period can be calculated using the actual SPI clock;

[0161] The slave time domain includes SL_T DMA , T SL ;

[0162] SL_T DMA : The time period taken by the first device DMA module to transfer data with the TX / RX FIFO;

[0163] T SL : The timestamp recorded by the first device after DMA receives the data packet;

[0164] Then, the corresponding offset calculation formula is:

[0165]

[0166] Since the DMA transmission time is small and can be ignored, the above formula can be rewritten as:

[0167]

[0168] Then, the timestamp of the data localized by the first device and transmitted by the second device is:

[0169]

[0170] The timestamp of the data remotely output from the first device to the second device is:

[0171]

[0172] In one implementation, the first device is specifically configured to:

[0173] Determine whether the accumulated number of time differences exceeds a preset number;

[0174] If it exceeds, the most recent preset number of time differences are accumulated and averaged;

[0175] Determine whether the absolute difference between the mean and the currently calculated time difference is greater than the set threshold. If so, adjust the current time difference to the mean.

[0176] That is to say, since the data timestamp synchronization method needs to update the timestamp in each communication cycle, the offset also needs to be calculated and updated in each communication cycle. In order to prevent the offset from being easily affected by interference values ​​during the update process, resulting in large deviations and unreliability in its value, a safety mechanism for the offset can be added. Considering the illegal value attribute of the offset, the abnormal value belongs to the category of linear value filtering, that is, the safety mechanism needs to filter out data with abnormal offset value range. In addition, the adjustment of the overall range of the offset value should also be considered, that is, the safety mechanism needs to adjust the data synchronization output as the overall data changes.

[0177] Specifically, we can use the method of summing and averaging:

[0178]

[0179] Where offset(t) represents the time difference of the tth data transmission, m represents the preset number, and the formula means taking the average AVE of the m offsets closest to the current one in the previous n data transmissions. (n+1) , then, we can further calculate the mean AVE (n+1) The absolute difference between the time difference offset(n+1) of the n+1th data transmission process and the time difference offset(n+1). If the absolute difference exceeds the set threshold k, the value of offset(n+1) is considered abnormal. The threshold k needs to be obtained based on actual statistics.

[0180] Specifically, the update process of the time difference is as follows: Figure 8 The steps are as follows:

[0181] First, determine whether the current cumulative number of offsets exceeds m. If not, do not adjust offset(n+1). If the current cumulative number of offsets exceeds m, then accumulate and sum the previous m time differences and take the average value AVE(n+1).

[0182] Then, determine whether the absolute difference between the mean AVE(n+1) and offset(n+1) exceeds the set threshold k. If not, do not adjust offset(n+1). If exceeded, adjust offset(n+1) to AVE(n+1).

[0183] Finally, the original offset (n+1) is accumulated into the new first m time differences to facilitate the next update calculation.

[0184] In one implementation, the first device is specifically configured to perform local processing on second data stored in a receiving buffer queue of the first device based on a timestamp of the second device; and send the processed second data to a second storage area of ​​the first device.

[0185] That is, the first device may also perform localized processing on the timestamp of the second data received from the second device, so that the timestamp of the second data is consistent with the timestamp of the local data stored in the first device.

[0186] In one implementation, the first device is specifically used to obtain the time difference between the first device and the second device; the time period taken by the direct memory storage module of the second device to transfer data to the buffer of the second device is added to the time difference as the localized timestamp of the second data.

[0187] That is to say, first, when the second device receives the second data collected by the sensor, it adds the timestamp of the second device, and then, the second data is transmitted to the first device through SPI, and the first device performs local processing on the timestamp of the second data; in addition, when the first device receives the first data collected by the sensor, it adds the timestamp of the first device, and then, before the first data is transmitted to the second device through SPI, the first device performs remote processing on the first data.

[0188] From the above, it can be seen that the technical solution provided by the embodiment of the present disclosure is that the first device adjusts the output state of the universal input and output interface to a high level before data interaction, and the second device judges the output state of the universal input and output interface, and agrees to interact with the first device when the output state is a high level. After the data interaction is completed, the first device adjusts the output state of the universal input and output interface to a low level again. That is to say, by adding a universal input and output interface, an effective trigger mechanism is provided to ensure the timing between the first device and the second device, so that the second device and the first device can communicate with any cycle size, thereby improving the robustness and robustness of the SPI communication.

[0189] Fig. 9 is a flowchart of a synchronous communication method according to an exemplary embodiment, which is applied to a first device and includes:

[0190] Step S201: after establishing a connection with a second device, copying first data to a first storage area of ​​a first device;

[0191] Step S202: adjusting the output state of the general input / output interface to a high level;

[0192] Step S203: sending the first data from the first storage area of ​​the first device to the receiving buffer queue of the second device;

[0193] Step S204: sending the second data from the receiving buffer queue of the first device to the second storage area of ​​the first device;

[0194] Step S205: adjusting the output state of the universal input / output interface to a low level;

[0195] Step S206: Read and parse the second data from the second storage area of ​​the first device.

[0196] From the above, it can be seen that the technical solution provided by the embodiment of the present disclosure is that the first device adjusts the output state of the universal input and output interface to a high level before data interaction, and the second device judges the output state of the universal input and output interface, and agrees to interact with the first device when the output state is a high level. After the data interaction is completed, the first device adjusts the output state of the universal input and output interface to a low level again. That is to say, by adding a universal input and output interface, an effective trigger mechanism is provided to ensure the timing between the first device and the second device, so that the second device and the first device can communicate with any cycle size, thereby improving the robustness and robustness of the SPI communication.

[0197] Fig.10 A synchronous communication method according to an exemplary embodiment is applied to a second device, including:

[0198] Step S301: when it is detected that the output state of the general input / output interface is high, copy the second data to the first storage area of ​​the second device;

[0199] Step S302: sending the second data from the first storage area of ​​the second device to the receiving buffer queue of the first device;

[0200] Step S303: receiving first data sent from the first storage area of ​​the first device to the receiving buffer queue of the second device, and sending the first data from the receiving buffer queue of the second device to the second storage area of ​​the second device;

[0201] Step S304: reading and parsing the first data from the second storage area of ​​the second device.

[0202] From the above, it can be seen that the technical solution provided by the embodiment of the present disclosure is that the first device adjusts the output state of the universal input and output interface to a high level before data interaction, and the second device judges the output state of the universal input and output interface, and agrees to interact with the first device when the output state is a high level. After the data interaction is completed, the first device adjusts the output state of the universal input and output interface to a low level again. That is to say, by adding a universal input and output interface, an effective trigger mechanism is provided to ensure the timing between the first device and the second device, so that the second device and the first device can communicate with any cycle size, thereby improving the robustness and robustness of the SPI communication.

[0203] Fig.11 A synchronous communication device according to an exemplary embodiment is applied to a first device, including:

[0204] The first transmission module 401 is used to copy the first data to the first storage area of ​​the first device after establishing a connection with the second device;

[0205] A first adjustment module 402, used to adjust the output state of the general input and output interface to a high level;

[0206] A second transmission module 403, configured to send the first data from the first storage area of ​​the first device to a receiving buffer queue of a second device;

[0207] A third transmission module 404, configured to send the second data from the receiving buffer queue of the first device to the second storage area of ​​the first device;

[0208] The second adjustment module 405 is further used to adjust the output state of the universal input and output interface to a low level;

[0209] The fourth transmission module 406 is configured to read and parse the second data from the second storage area of ​​the first device.

[0210] From the above, it can be seen that the technical solution provided by the embodiment of the present disclosure is that the first device adjusts the output state of the universal input and output interface to a high level before data interaction, and the second device judges the output state of the universal input and output interface, and agrees to interact with the first device when the output state is a high level. After the data interaction is completed, the first device adjusts the output state of the universal input and output interface to a low level again. That is to say, by adding a universal input and output interface, an effective trigger mechanism is provided to ensure the timing between the first device and the second device, so that the second device and the first device can communicate with any cycle size, thereby improving the robustness and robustness of the SPI communication.

[0211] Fig.12 A synchronous communication device according to an exemplary embodiment is applied to a second device, including:

[0212] The detection module 501 is used to copy the second data to the first storage area of ​​the second device when detecting that the output state of the general input and output interface is high level;

[0213] A sending module 502, configured to send the second data from the first storage area of ​​the second device to a receiving buffer queue of the first device;

[0214] A receiving module 503, configured to receive first data sent from the first storage area to a receiving buffer queue of a second device, and send the first data from the receiving buffer queue of the second device to a second storage area of ​​the second device;

[0215] The processing module 504 is configured to read and parse the first data from the second storage area of ​​the second device.

[0216] From the above, it can be seen that the technical solution provided by the embodiment of the present disclosure is that the first device adjusts the output state of the universal input and output interface to a high level before data interaction, and the second device judges the output state of the universal input and output interface, and agrees to interact with the first device when the output state is a high level. After the data interaction is completed, the first device adjusts the output state of the universal input and output interface to a low level again. That is to say, by adding a universal input and output interface, an effective trigger mechanism is provided to ensure the timing between the first device and the second device, so that the second device and the first device can communicate with any cycle size, thereby improving the robustness and robustness of the SPI communication.

[0217] Fig.13 It is a block diagram of an electronic device for synchronous communication according to an exemplary embodiment.

[0218] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory including instructions, and the instructions can be executed by a processor of an electronic device to complete the method. Optionally, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0219] In an exemplary embodiment, a computer program product is also provided. When the computer program product is executed on a computer, the computer is enabled to implement the synchronous communication method.

[0220] From the above, it can be seen that the technical solution provided by the embodiment of the present disclosure is that the first device adjusts the output state of the universal input and output interface to a high level before data interaction, and the second device judges the output state of the universal input and output interface, and agrees to interact with the first device when the output state is a high level. After the data interaction is completed, the first device adjusts the output state of the universal input and output interface to a low level again. That is to say, by adding a universal input and output interface, an effective trigger mechanism is provided to ensure the timing between the first device and the second device, so that the second device and the first device can communicate with any cycle size, thereby improving the robustness and robustness of the SPI communication.

[0221] Fig.14 It is a block diagram of a device 800 for synchronous communication according to an exemplary embodiment.

[0222] For example, apparatus 800 may be a mobile phone, a computer, a digital broadcast electronic device, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0223] Reference Fig.14 , the device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .

[0224] The processing component 802 generally controls the overall operation of the device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the described method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.

[0225] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0226] The power supply component 807 provides power to the various components of the device 800. The power supply component 807 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 800.

[0227] The multimedia component 808 includes a screen that provides an output interface between the device 800 and the account. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the account. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have focal length and optical zoom capabilities.

[0228] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the device 800 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.

[0229] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.

[0230] The sensor assembly 814 includes one or more sensors for providing various aspects of the status assessment of the device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the device 800, and the sensor assembly 814 can also detect the position change of the device 800 or a component of the device 800, the presence or absence of contact with the device 800, the orientation or acceleration / deceleration of the device 800, and the temperature change of the device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0231] The communication component 816 is configured to facilitate wired or wireless communication between the device 800 and other devices. The device 800 can access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G or 5G), or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0232] In an exemplary embodiment, the apparatus 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the methods described in the first and second aspects.

[0233] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by the processor 820 of the device 800 to complete the method. Optionally, for example, the storage medium can be a non-transitory computer-readable storage medium, for example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0234] In an exemplary embodiment, a computer program product comprising instructions is also provided. When the computer program product is executed on a computer, the computer is enabled to execute the synchronous communication method described in any one of the embodiments.

[0235] From the above, it can be seen that the technical solution provided by the embodiment of the present disclosure is that the first device adjusts the output state of the universal input and output interface to a high level before data interaction, and the second device judges the output state of the universal input and output interface, and agrees to interact with the first device when the output state is a high level. After the data interaction is completed, the first device adjusts the output state of the universal input and output interface to a low level again. That is to say, by adding a universal input and output interface, an effective trigger mechanism is provided to ensure the timing between the first device and the second device, so that the second device and the first device can communicate with any cycle size, thereby improving the robustness and robustness of the SPI communication.

[0236] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0237] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A synchronous communication system, It is characterized in that include: The first device is configured to copy the first data to the first storage area of ​​the first device after establishing a connection with the second device; Adjust the output state of the general input and output interface to a high level; Sending the first data from the first storage area of ​​the first device to a receiving buffer queue of the second device; The second device is configured to copy the second data to the first storage area of ​​the second device when detecting that the output state of the universal input / output interface is at a high level; sending the second data from the first storage area of ​​the second device to a receiving buffer queue of the first device; Sending the first data from the receiving buffer queue of the second device to the second storage area of ​​the second device; reading and parsing the first data from the second storage area of ​​the second device; The first device is also used to send the second data from the receiving buffer queue of the first device to the second storage area of ​​the first device; adjust the output state of the general input and output interface to a low level; and read and parse the second data from the first storage area of ​​the first device.

2. The synchronous communication system according to claim 1, It is characterized in that The first device is specifically used for: Copying, by means of an application layer communication management program of the first device, first data from a file transfer buffer of the first device to a first storage area of ​​the first device; The second data is copied from the second storage area of ​​the first device to the file receiving buffer of the first device through the application layer communication management program of the first device, and the second data in the file receiving buffer of the first device is parsed.

3. The synchronous communication system according to claim 1, It is characterized in that The second device is specifically used for: copying the second data from the file transfer buffer of the second device to the first storage area of ​​the second device through the application layer communication management program of the second device; The first data is copied from the second storage area of ​​the second device to the file receiving buffer of the second device through the application layer communication management program of the second device, and the first data in the file receiving buffer of the second device is parsed.

4. The synchronous communication system according to claim 1, It is characterized in that The first device is specifically used for: sending, through a direct memory storage module of the first device, the first data from a first storage area of ​​the first device to a transmission buffer queue of the first device; Sending the first data from a transmission buffer queue of the first device to a shift register of the first device; The first data is sent from the shift register of the first device to the receiving buffer queue of the second device through a synchronous serial communication bus interface.

5. The synchronous communication system according to claim 4, It is characterized in that The second device is specifically used for: The shift register of the second device receives the first data sent by the shift register of the first device through the synchronous serial communication bus interface, and sends the first data to the receiving buffer queue of the second device; The first data is sent from the receiving buffer queue of the second device to the second storage area of ​​the second device through the direct memory storage module of the second device.

6. The synchronous communication system according to claim 1, It is characterized in that The second device is specifically used for: sending, by a direct memory storage module of the second device, the second data from the first storage area of ​​the second device to a transmission buffer queue of the second device; sending the second data from a transmission buffer queue of the second device to a shift register of the second device; The second data is sent from the shift register of the second device to the receiving buffer queue of the first device through a synchronous serial communication bus interface.

7. The synchronous communication system according to claim 6, It is characterized in that The first device is specifically used for: The shift register of the first device receives the second data sent by the shift register of the second device through the synchronous serial communication bus interface, and sends the second data to the receiving buffer queue of the first device; The second data is sent from the receiving buffer queue of the first device to the second storage area of ​​the first device through the direct memory storage module of the first device.

8. The synchronous communication system according to claim 1, It is characterized in that The first device is specifically used for: Based on the timestamp of the second device, performing remote processing on the first data; The processed first data is copied to a file transfer buffer of the first device, and is transferred from the file transfer buffer of the first device to a first storage area of ​​the first device.

9. The synchronous communication system according to claim 8, It is characterized in that The first device is specifically used for: Acquire a time difference between the first device and the second device; The time period taken by the direct memory storage module of the first device to send the first data to the transmission buffer queue of the first device is added to the time difference to serve as a remote timestamp of the first data.

10. The synchronous communication system according to claim 1, It is characterized in that The first device is specifically used for: Based on the timestamp of the second device, localize the second data stored in the receiving buffer queue of the first device; The processed second data is sent to the second storage area of ​​the first device.

11. The synchronous communication system according to claim 10, It is characterized in that The first device is specifically used for: Acquire a time difference between the first device and the second device; The time period taken by the direct memory storage module of the second device to transmit the second data to the transmission buffer queue of the second device is added to the time difference to obtain a localized timestamp of the second data.

12. The synchronous communication system according to claim 9 or 11, It is characterized in that The first device is specifically used for: Add the most recently acquired timestamp of the second device to the time period taken for the synchronous serial communication bus between the second device and the first device to transmit the data packet, and subtract the timestamp of the first device to obtain the time difference between the first device and the second device; wherein the timestamp of the second device is carried in the second data.

13. The synchronous communication system according to claim 12, It is characterized in that The first device is specifically used for: Determining whether the accumulated number of the time differences exceeds a preset number; If it exceeds, the most recent preset number of time differences are accumulated and averaged; It is determined whether the absolute difference between the mean and the currently calculated time difference is greater than a set threshold; if so, the current time difference is adjusted to the mean.

14. A synchronous communication method, It is characterized in that Applied to a first device, comprising: After establishing a connection with the second device, copying the first data to the first storage area of ​​the first device; Adjust the output state of the general input and output interface to a high level; Sending the first data from a first storage area of ​​the first device to a receiving buffer queue of the second device; Sending second data from the receiving buffer queue of the first device to a second storage area of ​​the first device; Adjusting the output state of the universal input / output interface to a low level; The second data is read and parsed from a second storage area of ​​the first device.

15. A synchronous communication method, It is characterized in that Applied to the second device, comprising: When it is detected that the output state of the general input / output interface is at a high level, copying the second data to the first storage area of ​​the second device; sending the second data from the first storage area of ​​the second device to a receiving buffer queue of the first device; receiving first data sent from a first storage area of ​​the first device to a receiving buffer queue of the second device, and sending the first data from the receiving buffer queue of the second device to a second storage area of ​​the second device; The first data is read and parsed from a second storage area of ​​the second device.

16. A synchronous communication device, It is characterized in that Applied to a first device, comprising: A first transmission module, configured to copy first data to a first storage area of ​​the first device after establishing a connection with the second device; A first adjustment module, used for adjusting the output state of the general input and output interface to a high level; a second transmission module, configured to send the first data from the first storage area of ​​the first device to a receiving buffer queue of the second device; A third transmission module, configured to send second data from a receiving buffer queue of the first device to a second storage area of ​​the first device; A second adjustment module, used for adjusting the output state of the universal input and output interface to a low level; A fourth transmission module is used to read and parse the second data from the second storage area of ​​the first device.

17. A synchronous communication device, It is characterized in that Applied to the second device, comprising: A detection module, configured to copy the second data to the first storage area of ​​the second device when detecting that the output state of the general input / output interface is at a high level; A sending module, used for sending the second data from the first storage area of ​​the second device to the receiving buffer queue of the first device; A receiving module, configured to receive first data sent from a first storage area of ​​the first device to a receiving buffer queue of the second device, and send the first data from the receiving buffer queue of the second device to a second storage area of ​​the second device; A processing module is used to read and parse the first data from the second storage area of ​​the second device.

18. An electronic device, It is characterized in that include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the synchronous communication method as claimed in claim 14 or 15.

19. A computer-readable storage medium, It is characterized in that When the instructions in the computer-readable storage medium are executed by a processor of a synchronous communication electronic device, the synchronous communication electronic device is enabled to perform the synchronous communication method as claimed in claim 14 or 15.