Multi-node data sharing method, system and equipment based on synchronous serial bus
By sending data frames containing shared configuration information from the master station and using the JDAT2 bus protocol, efficient data exchange between the master and slave stations within a single communication cycle is achieved. This solves the problem of low efficiency in synchronous serial bus communication and improves the system's operating efficiency and stability.
Patent Information
- Application Number
- CN202511539745.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-27
- Publication Date
- 2026-02-13
AI Technical Summary
Existing synchronous serial bus communication protocols have low efficiency and long response times in synchronous communication between the master station and multiple slave stations. Furthermore, node scalability is limited, and communication costs and complexity increase with the addition of nodes.
A multi-node data sharing method based on a synchronous serial bus is adopted. The master station sends data frames containing shared configuration information, and the slave stations are uniformly scheduled to send data in sequence. Data exchange between all nodes within one communication cycle is achieved by using a shared clock signal line and a bidirectional data signal line. The data link layer and physical layer functions are implemented using the JDAT2 bus protocol and FPGA.
It enables data exchange between the master station and multiple slave stations within a single communication cycle, improving communication efficiency, simplifying synchronization and data transmission between nodes, reducing logical resource overhead and costs, and enhancing system stability and anti-interference capabilities.
Smart Images

Figure CN121530780A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of serial communication technology, in particular to a multi-node data sharing method, system and device based on a synchronous serial bus. BACKGROUND
[0002] The existing method is generally directly based on an industrial synchronous serial bus or a communication protocol such as Profibus, Modbus, etc. to implement the synchronous communication process between the master station and the plurality of slave stations. The existing communication process can only achieve a millisecond level of synchronization and has a long response time.
[0003] How to improve the communication efficiency of the synchronous communication between the master station and the plurality of slave stations is an important issue to be solved in the industry. SUMMARY
[0004] The present application provides a multi-node data sharing method, system and device based on a synchronous serial bus to improve the communication efficiency of the synchronous communication between the master station and the plurality of slave stations.
[0005] The present application provides a multi-node data sharing method based on a synchronous serial bus, applied to a serial sharing system including a master station and a plurality of slave stations, wherein the master station is connected with each slave station through a shared clock signal line and a bidirectional data signal line, and the method comprises: The master station sends a synchronous clock signal and a master station data frame to all slave stations; The synchronous clock signal is a reference clock for the communication of all nodes in the serial sharing system within a communication period; the master station data frame includes master station shared data and shared configuration information; the shared configuration information records address information of each slave station and slave station shared data of each slave station; and the shared configuration information is used for data sharing of each slave station within the communication period. The master station receives slave station data frames sent by each slave station in sequence, and acquires slave station shared data of each slave station based on the slave station data frames.
[0006] According to the multi-node data sharing method based on a synchronous serial bus provided by the present application, the master station sends the master station data frame to all slave stations at the falling edge of the synchronous clock signal. The master station receives slave station data frames sent by each slave station at the rising edge of the synchronous clock signal.
[0007] According to the multi-node data sharing method based on a synchronous serial bus provided by the present application, the shared configuration information further records a master station data check code. The master station data check code is used to perform a check process of the master station shared data.
[0008] The application further provides a multi-node data sharing method based on a synchronous serial bus, which is applied to a serial sharing system comprising one master station and multiple slave stations, wherein the master station is connected with each slave station through a shared clock signal line and a bidirectional data signal line, and the method comprises the following steps of: Each slave station receives a synchronous clock signal and a master station data frame sent by the master station, and acquires master station shared data from the master station data frame; the synchronous clock signal is a reference clock for communication of all nodes in the serial sharing system in one communication period; Each slave station sequentially executes a data sharing process in the communication period based on a preset order; The data sharing process comprises the following steps of: sending a slave station data frame of a current slave station to other nodes; the other nodes are nodes in the serial sharing system except the current slave station; the slave station data frame is used for other nodes to acquire slave station shared data of the current slave station.
[0009] According to the multi-node data sharing method based on the synchronous serial bus, at a rising edge of the synchronous clock signal, each slave station receives the synchronous clock signal and the master station data frame sent by the master station; At a falling edge of the synchronous clock signal, the current slave station sends the slave station data frame to the other nodes.
[0010] According to the multi-node data sharing method based on the synchronous serial bus, the sending of the slave station data frame of the current slave station to the other nodes comprises the following steps of: analyzing the master station data frame to determine sharing configuration information in the master station data frame; determining slave station shared data of the current slave station based on the sharing configuration information; generating a slave station data frame based on the slave station shared data of the current slave station, and sending the slave station data frame of the current slave station to the other nodes.
[0011] According to the multi-node data sharing method based on the synchronous serial bus, the method further comprises the following steps of: Each slave station determines a time phase deviation between an application layer synchronization signal and the reference of the synchronous clock signal sent by the master station; Each slave station adjusts a phase of the application layer synchronization signal of a next communication period based on the time phase deviation.
[0012] The application further provides a multi-node data sharing system based on a synchronous serial bus, which comprises one master station and multiple slave stations, wherein the master station is connected with each slave station through a shared clock signal line and a bidirectional data signal line; The master station is configured to send a synchronization clock signal and a master station data frame to all slave stations; The synchronization clock signal is a reference clock for all nodes in the system to communicate in a communication cycle. The master station data frame includes master station shared data and shared configuration information. The shared configuration information records address information of each slave station and slave station shared data of each slave station. The shared configuration information is used for each slave station to share data in the communication cycle. The master station is further configured to sequentially receive slave station data frames sent by each slave station, and obtain slave station shared data of each slave station based on the slave station data frames.
[0013] The application further provides a multi-node data sharing system based on a synchronous serial bus, which includes one master station and multiple slave stations. Each slave station is configured to receive a synchronization clock signal and a master station data frame sent by the master station, and obtain master station shared data from the master station data frame. The synchronization clock signal is a reference clock for all nodes in the system to communicate in a communication cycle. Each slave station is further configured to sequentially execute a data sharing process in the communication cycle based on a preset order. The data sharing process includes: Sending a slave station data frame of a current slave station to other nodes in the system. The slave station data frame is used for other nodes to obtain slave station shared data of the current slave station.
[0014] The application further provides an electronic device including a memory, a processor, and a computer program stored in the memory and running on the processor.
[0015] The application provides a multi-node data sharing method, system and device based on a synchronous serial bus. The master station sends a data frame containing shared configuration information to uniformly schedule, and each slave station sends data in sequence. The master station can collect shared data of all slave stations in a communication cycle. The shared configuration information clearly indicates the data content that each slave station needs to share, provides guidance for each slave station, avoids the inefficient way of polling each slave station by the master station, and enables data exchange of all nodes to be completed in a communication cycle. The working frequency of each slave station and the master station is synchronized, and the operation efficiency of the entire synchronous serial bus system is improved. BRIEF DESCRIPTION OF DRAWINGS
[0016] In order to make the technical solutions in the present application or prior art clearer, the accompanying drawings needed in the embodiments or prior art description will be briefly introduced. Obviously, the accompanying drawings in the following description are only some embodiments of the present application, and all other embodiments obtained by a person of ordinary skill in the art without creative work based on the embodiments in the present application shall fall within the protection scope of the present application.
[0017] Figure 1 is one of flow schematic diagrams of the multi-node data sharing method based on the synchronous serial bus provided by the present application.
[0018] Figure 2 is a connection structure schematic diagram of the serial sharing system provided by the present application.
[0019] Figure 3 is a data transmission timing diagram provided by the present application.
[0020] Figure 4 is the second flow schematic diagram of the multi-node data sharing method based on the synchronous serial bus provided by the present application.
[0021] Figure 5 is a general timing schematic diagram provided by the present application.
[0022] Figure 6 is a synchronous working schematic diagram provided by the present application.
[0023] Figure 7 is a sending flow schematic diagram provided by the present application.
[0024] Figure 8 is a receiving flow schematic diagram provided by the present application.
[0025] Figure 9 is a structure schematic diagram of the electronic device provided by the present application. DETAILED DESCRIPTION
[0026] In order to make the technical solutions in the present application or prior art clearer, the accompanying drawings needed in the embodiments or prior art description will be briefly introduced. Obviously, the accompanying drawings in the following description are only some embodiments of the present application, and all other embodiments obtained by a person of ordinary skill in the art without creative work based on the embodiments in the present application shall fall within the protection scope of the present application.
[0027] The defects of the related method based on the data sharing process between the master station and the plurality of slave stations include: Defects in protocol mechanism. In many communication protocols, such as the variant serial peripheral interface (SPI) protocol, there is usually no built-in hardware flow control signal and data reception confirmation mechanism. This will cause data reception abnormalities, data loss, or synchronization loss due to the delay of node processing when high-speed transmission is involved. In some protocols that transmit through a bus in a competitive manner, there is no definition of conflict detection or arbitration rules, and the field programmable gate array (FPGA) developer needs to customize the priority algorithm, which will increase the logic resource overhead or the uncertainty of timing. In some widely used industrial buses such as the EtherCAT bus, due to the use of a daisy chain connection method, when communication problems occur at any communication node, it may cause communication interruption of all nodes behind.
[0028] Clock synchronization performance. In some industrial synchronous serial buses or protocols such as Profibus and Modbus, only millisecond-level synchronization can be achieved, and the response time is relatively long. Although some buses like EtherCAT industrial Ethernet bus can provide sub-microsecond-level synchronization accuracy, they need the support of special chips, which is very costly.
[0029] Node expansion limitation. In some synchronous serial protocols such as SPI, when a master-slave architecture is used, each additional slave device requires an additional chip select line or a dedicated signal line for synchronization, increasing the overhead. After the number of communication nodes increases, the I / O resources of the FPGA and the wiring complexity will also increase, which will further increase the cost of the entire communication.
[0030] In view of the defects of the related methods, the present application provides a multi-node data sharing method based on a synchronous serial bus, Figure 1 is one of the flowcharts of the multi-node data sharing method based on a synchronous serial bus provided by the present application, applied to a serial sharing system including one master station and multiple slave stations, wherein the master station is connected with each slave station through a shared clock signal line and a bidirectional data signal line, as shown in Figure 1 The method comprises the following steps: Step 110, the master station sends a synchronization clock signal and a master station data frame to all slave stations; The synchronization clock signal is the reference clock for communication of all nodes in the serial sharing system within a communication period; the master station data frame includes master station shared data and shared configuration information; the shared configuration information records the address information of each slave station and the slave station shared data of each slave station; and the shared configuration information is used for data sharing of each slave station within the communication period. In step 120, the master station receives the slave data frames sent by the slave stations in sequence, and acquires the slave shared data of each slave station based on the slave data frames.
[0031] It should be noted that, as Figure 2 The serial sharing system provided by the application has a bus type topology structure, and includes a plurality of nodes, specifically, one master station (Master) and a plurality of slave stations (Slave1, Slave2,...).
[0032] The data communication process in the serial sharing system is realized based on the FPGA in the master station and the FPGA in the slave station, and a communication protocol used is a serial communication bus protocol based on the FPGA, named as JDAT2 bus protocol.
[0033] The JDAT2 bus protocol structure is defined according to the Open Systems Interconnection Reference Model (OSI) model, and mainly realizes the main functions of the data link layer in the communication system and part of the physical layer functions. The data link layer can be further divided into two sub-layers: (1) a logical link control sub-layer, referred to as an LLC layer, which mainly provides a host data interface and can directly interact with an application layer of a host, and also provides a function of realizing a serial bus operation management state machine; and (2) a media access control sub-layer, referred to as a MAC layer, which mainly realizes basic functions such as a transmission rule, a control frame structure, synchronization detection, data verification, bus fault definition, data collection during transmission and reception, serial-parallel conversion and the like.
[0034] The physical layer function mainly controls the level inversion of an external communication device, so that the actual transmission of data bits is realized between different nodes according to the electrical properties of the physical layer. The physical layers of all nodes in the same network must be the same, but the requirements for the electrical standards of the physical layer can be kept open according to the actual performance and cost.
[0035] The physical layer of the JDAT2 bus protocol adopts RS485 or Low-Voltage Differential Signaling (LVDS), which is composed of two differential signal pairs, namely a synchronous clock signal CLK and a data signal DATA. The CLK is a unidirectional signal, and the DATA signal is a bidirectional signal.
[0036] In the present application, the master station refers to the node responsible for generating and sending the synchronization clock signal in the serial shared system, which initiates and manages the entire communication process. There is only one master station in a serial shared system. The slave station refers to the node that receives the synchronization clock signal provided by the master station and transmits and receives data according to the clock signal. There can be one or more slave stations in a serial shared system. The master station and each slave station are connected through a physical line, which specifically can include a shared clock signal line (CLK) and a shared bidirectional data signal line (DATA).
[0037] The clock signal line is used to transmit the synchronization clock signal, which is unidirectional transmission (from the master station to all slave stations). The data signal line is bidirectional transmission, and all nodes (including the master station and the slave stations) transmit and receive data through the data line.
[0038] The multi-node data sharing method based on the synchronous serial bus can be executed by the master station, and the specific execution steps can include: In step 110, the master station sends the synchronization clock signal and the master station data frame to all slave stations.
[0039] The synchronization clock signal is the reference clock for all nodes in the serial shared system to communicate within a communication period. The master station, as the clock source, continuously outputs the clock signal, ensuring that the operation of all nodes in the system is based on the same time reference, thereby achieving precise synchronization at the bit level. The frequency of the synchronization clock signal can be configured according to application requirements, for example, it can be optionally configured as 10MHz, 20MHz or 50MHz.
[0040] The master station data frame is the data packet sent by the master station at the beginning of each communication period. The master station data frame can include the shared data of the master station itself and the shared configuration information. The master station shared data refers to the data that the master station needs to share with other nodes in the system, such as the status information of the master station, control instructions, etc.
[0041] The shared configuration information is used for data sharing by each slave station within the communication period, and is used to plan and guide the data interaction behavior within the communication period. Specifically, the shared configuration information can record the address information of each slave station and the type or index of the slave station shared data that each slave station should send. For example, the shared configuration information can specify that the slave station with address 2 needs to send the content in its data register DAT1, and the slave station with address 3 needs to send the content in its data register DAT2. In this way, the master station can dynamically configure and schedule the shared data content on the entire bus.
[0042] It can be understood that after a slave station receives the master station data frame sent by the master station, the master station data frame is parsed to obtain the sharing configuration information in the master station data frame. Since the sharing configuration information records the slave station shared data of each slave station, for each slave station, the data sharing process with other nodes is implemented based on the parsed sharing configuration information.
[0043] Specifically, for any slave station of the serial sharing system, the slave station shared data that needs to be shared can be determined based on the sharing configuration information, and the synchronization process of the slave station shared data to all other nodes is implemented. After each slave station completes the synchronization process in turn, all nodes of the serial sharing system complete the data sharing process of all nodes within one communication cycle.
[0044] In step 120, the master station receives the slave station data frames sent by each slave station in turn, and obtains the slave station shared data of each slave station based on the slave station data frames.
[0045] After the master station sends the master station data frame, the data transmission right of the bus is transferred to each slave station in turn according to a preset order (for example, in the order of increasing address of the slave station). When each slave station obtains the transmission right, it sends its own slave station data frame to the bus. Since the master station is always listening to the data bus, it can receive the data frame sent by each slave station in turn. By parsing the received slave station data frame, the master station can extract the slave station shared data contained therein and store it in the local shared data storage area for use by the application layer program.
[0046] The multi-node data sharing method based on the synchronous serial bus provided by the application unifies the scheduling by the master station sending a data frame containing sharing configuration information, and lets each slave station send data in order, so that the master station can collect the shared data of all slave stations within one communication cycle. The sharing configuration information clearly indicates the data content that each slave station needs to share, provides guidance for each slave station, avoids the inefficient way of polling each slave station by the master station, enables the data exchange of all nodes to be completed within one communication cycle, synchronizes the working frequency of each slave station with the master station, and improves the data sharing operation efficiency of the synchronous serial bus system of the entire serial sharing system.
[0047] In one embodiment, the master station sends the master station data frame to all slave stations at the falling edge of the synchronization clock signal. The master station receives the slave station data frames sent by each slave station at the rising edge of the synchronization clock signal.
[0048] In order to ensure the stability and reliability of data transmission, the timing of data transmission and reception is specified. Specifically, the data transmission between the master station and each slave station can be associated with the edge of the synchronization clock signal.
[0049] As Figure 3 The data transmission timing diagram provided by the application shows that the master station sends one bit of data on the data signal (DATA) line at each falling edge of the clock synchronization signal (CLK). All receiving nodes (including all slave stations) sample the data signal line at each rising edge of the clock signal to read one bit of data. The SYNC is a start bit, containing three parameters, and the specific value is "1, 1, 0"; the Header is a data frame configuration description, containing 32 parameters, and is the core of the dynamic data sharing. It contains the index of the data (DATA1, DATA2) to be sent by the master station; CRC1 is the first cyclic redundancy check; DATA1 and DATA2 are the master station shared data; CRC2 is the second cyclic redundancy check; and STOP is the stop bit. First, the master station starts sending at the falling edge, and after the master station finishes sending, the master station switches to the receiving state, and the No. 1 slave station (the first slave station according to the preset order) switches to the sending state. This mechanism of sending at the falling edge and receiving at the rising edge provides sufficient time margin for the establishment and stabilization of the data signal between the clock edges, effectively avoids sampling errors that may be caused by clock offset or signal transmission delay, and thus ensures the accuracy of data transmission between all nodes.
[0050] In one embodiment, the shared configuration information also records the master station data check code; The master station data check code is used to perform a check process on the master station shared data.
[0051] Specifically, the master station data check code is used by the receiving party (i.e. all slave stations) to perform a check process on the key part in the received master station data frame.
[0052] For example, a cyclic redundancy check (CRC) algorithm can be used to generate the check code. For example, a CRC check code can be calculated by merging the shared configuration information field and the master station state field in the master station data frame, and placed in a specific position in the frame as the master station data check code. After receiving the master station data frame, the slave station calculates the same data field using the same CRC generator polynomial, and compares the calculation result with the received check code. If they are consistent, it is considered that the data transmission is correct; if they are not consistent, it indicates that an error has occurred in the data transmission process.
[0053] In order to protect the master station shared data itself, the master station data frame can also contain a second data check code for the master station shared data field (such as DATA1, DATA2).
[0054] By adding the master station data check code in the shared configuration information, the slave station can verify the integrity and accuracy of the received instruction and configuration information, and can take error correction or error reporting measures in time once an error is found, thereby greatly enhancing the stability and anti-interference capability of the entire serial sharing system.
[0055] The application further provides a multi-node data sharing method based on a synchronous serial bus, which is executed by a slave station and applied to a serial sharing system, Figure 4 Figure 2 is a flowchart of a multi-node data sharing method based on a synchronous serial bus according to the application, which is applied to a serial sharing system including one master station and multiple slave stations, wherein the master station is connected with each slave station through a shared clock signal line and a bidirectional data signal line, as shown in Figure 1, and the method comprises the following steps. Figure 4 In step 410, each slave station receives the synchronous clock signal and the master station data frame sent by the master station, and obtains the master station shared data from the master station data frame. In step 420, each slave station executes a data sharing process in turn within the communication period based on a preset order. The data sharing process comprises the following steps. The slave station data frame of the current slave station is sent to other nodes, wherein the other nodes are nodes in the serial sharing system except the current slave station, and the slave station data frame is used for other nodes to obtain the slave station shared data of the current slave station.
[0056] In the application, the master station refers to a node responsible for generating and sending a synchronous clock signal in a serial sharing system, which initiates and manages the entire communication process. There is only one master station in a serial sharing system. The slave station refers to a node receiving the synchronous clock signal provided by the master station and performing data transmission and reception according to the clock signal. There can be one or more slave stations in a serial sharing system. The master station is connected with each slave station through a physical line, specifically, can include a shared clock signal line (CLK) and a shared bidirectional data signal line (DATA).
[0057] The clock signal line is used for transmitting the synchronous clock signal, which is unidirectional transmission (from the master station to all slave stations). The data signal line is bidirectional transmission, and all nodes (including the master station and the slave station) transmit and receive data through the data line.
[0058] The multi-node data sharing method based on the synchronous serial bus can be executed by the slave station, and the specific execution steps can include the following steps. In step 410, each slave station receives the synchronous clock signal and the master station data frame sent by the master station, and obtains the master station shared data from the master station data frame.
[0059] The synchronization clock signal is the communication reference of the whole system. After the power-on configuration is completed, the slave station continuously monitors the clock signal line and the data signal line. When detecting that the master station starts to send a data frame (for example, by detecting a specific start bit sequence), the slave station receives the master station data frame bit by bit under the driving of the synchronization clock signal.
[0060] After the reception is completed, the slave station can parse the master station data frame, thereby extracting the shared data of the master station and the shared configuration information for guiding the subsequent synchronization process of the slave station.
[0061] In step 420, each slave station sequentially executes the data sharing process in the communication period based on a preset order.
[0062] The preset order refers to a deterministic sending order followed by all nodes. The preset order can be determined based on the address of the slave station or a pre-arranged station number, for example, the node with the smallest slave station address sends first, then the node with the second smallest address, and so on, until the slave station with the largest address sends. This fixed round-robin sending mechanism avoids bus conflicts and ensures the orderly communication.
[0063] For example, the master station and the slave station jointly constitute the subject of synchronous communication, and the master station is responsible for initiating communication. There can be only one master station in a bus network. The master station can be fixedly addressed as 1. The slave station node is also a member of the synchronous communication subject like the master station node, and the slave station responds to each communication process initiated by the master station according to the rules. The bus attribute configuration of the slave station must be the same as that of the master station. For example, there can be at most 30 slave stations in a bus network. The address range of the slave station is 2-31.
[0064] The bus network can also include a listening node and a silent node. The listening node is an observer participant of bus communication, and the node bus attribute configuration must also be the same as that of the master station. The listening node can only listen and is not allowed to send, and does not occupy the actual transmission bandwidth of the bus. Multiple listening nodes can be allowed to exist at the same time. The listening node can be fixedly addressed as 0.
[0065] The silent node is connected in the bus network, but neither participates in data reception nor participates in data sending.
[0066] The station number of each node participating in communication can be configured through external parameters. The master station station number is set to 1, and the slave station station number must start from 2 and be continuously addressed. Based on the numbering order, the preset order for subsequent sequential implementation of the synchronization process can be determined.
[0067] The core of the data sharing process is the current slave station that has the right to send. It shares its data with all other nodes in the serial sharing system. Specifically, it sends the slave station data frame of the current slave station to all other nodes. The other nodes refer to all nodes in the serial sharing system except the current slave station, which includes both the master station and all other slave stations. The slave station data frame sent by the current slave station contains its own slave station sharing data (i.e. data that needs to be shared with other nodes). Since the data signal line is shared, the data frame sent by the current slave station can be listened to and received by all other nodes on the bus.
[0068] Through the above process, each slave station not only obtains data from the master station, but also actively broadcasts its own data to all members (master station and other slave stations) in the system during the communication period. This process is completed in a single communication period, so that data exchange between any nodes can be completed in a very short time, forming a multi-node data sharing network.
[0069] In an embodiment, at the rising edge of the synchronization clock signal, each slave station receives the synchronization clock signal and the master station data frame sent by the master station. At the falling edge of the synchronization clock signal, the current slave station sends the slave station data frame to other nodes.
[0070] By uniformly stipulating that all nodes in the serial sharing system follow the rule of receiving at the rising edge and sending at the falling edge, it is ensured that data interaction between the master station and the slave station, or between the slave stations, has the same timing margin and stability. This consistent timing design simplifies the implementation logic of the physical layer and the data link layer of each node, and maximizes the data transmission reliability of the entire serial sharing system under high-speed operation.
[0071] In an embodiment, the sending of the slave station data frame of the current slave station to other nodes includes: parsing the master station data frame to determine the sharing configuration information in the master station data frame; determining the slave station sharing data of the current slave station based on the sharing configuration information; generating a slave station data frame based on the slave station sharing data of the current slave station, and sending the slave station data frame of the current slave station to other nodes.
[0072] The master station data frame is parsed to determine the sharing configuration information in the master station data frame. After receiving the complete master station data frame, the data link layer logic of the slave station locates and extracts the field carrying the sharing configuration information according to the predefined frame structure.
[0073] Based on the shared configuration information, the slave station shared data of the current slave station is determined. The shared configuration information contains data requests for each slave station, usually in the form of data index. The current slave station will find the part corresponding to its own address from the parsed shared configuration information, and read the corresponding data from its local application layer data area according to the data index specified therein as the slave station shared data to be sent this time. For example, if the data index requested by the master station is position information, the slave station will read its real-time position data.
[0074] Based on the slave station shared data of the current slave station, a slave station data frame is generated, and the slave station data frame of the current slave station is sent to other nodes. The slave station shared data obtained is assembled together with the address information, state information, etc. of the slave station itself according to the predetermined slave station data frame format, and a check code is calculated. The complete slave station data frame generated is then serially transmitted to the data bus on the falling edge of the synchronous clock signal.
[0075] In one embodiment, it further comprises: Each slave station determines the time phase deviation between the application layer synchronization signal and the synchronous clock signal reference sent by the master station; Each slave station adjusts the phase of the application layer synchronization signal of the next communication period based on the time phase deviation.
[0076] The upper application layer program of each node (including the master station and the slave station) in the serial sharing system usually has a periodic synchronization signal, which is used to trigger the tasks of the period, such as position loop calculation, etc.
[0077] In order to realize the close synchronization of the application layers of all nodes, a unified reference needs to be aligned. The physical signal with deterministic timing sent by the master station can be used as the reference.
[0078] Specifically, the slave station can monitor a specific position of the master station data frame as a time reference point, and use an internal high-frequency counter to measure the time interval between the reference point and its own application layer synchronization signal, which is the time phase deviation. The deviation value can be recorded in a specific register.
[0079] Each slave station adjusts the phase of the application layer synchronization signal of the next communication period based on the time phase deviation. After reading the time phase deviation value, the application layer processor of the slave station can adjust the count value or trigger time of its internal timer to advance or delay the generation of the application layer synchronization signal of the next period, so as to compensate for the deviation.
[0080] The application also provides a multi-node data sharing system based on a synchronous serial bus, which comprises a master station and a plurality of slave stations, and the master station and each slave station are connected through a shared clock signal line and a bidirectional data signal line. The master station is configured to send a synchronization clock signal and a master station data frame to all slave stations; The synchronization clock signal is a reference clock for all nodes in the system to communicate in a communication cycle; the master station data frame includes master station shared data and shared configuration information; the shared configuration information records address information of each slave station and slave station shared data of each slave station; and the shared configuration information is used for data sharing of each slave station in the communication cycle. The master station is further configured to sequentially receive slave station data frames sent by each slave station, and based on the slave station data frames, obtain slave station shared data of each slave station.
[0081] Specifically, the synchronization clock signal is a reference clock for all nodes in the serial sharing system to communicate in a communication cycle. The master station, as a clock source, continuously outputs the clock signal, ensuring that the operation of all nodes in the system is based on the same time reference, thereby achieving precise synchronization at the bit level. The frequency of the synchronization clock signal can be configured according to application requirements, for example, it can be optionally configured as 10MHz, 20MHz or 50MHz.
[0082] The master station data frame is a data packet sent by the master station at the beginning of each communication cycle. The master station data frame can include shared data of the master station itself and shared configuration information. The master station shared data refers to data that the master station needs to share with other nodes in the system, such as state information and control instructions of the master station.
[0083] The shared configuration information is used for data sharing of each slave station in the communication cycle, and is used to plan and guide the data interaction behavior in the communication cycle. Specifically, the shared configuration information can record address information of each slave station and types or indexes of slave station shared data to be sent by each slave station. For example, the shared configuration information can specify that the slave station with address 2 needs to send the content in its data register DAT1, and the slave station with address 3 needs to send the content in its data register DAT2. In this way, the master station can dynamically configure and schedule the shared data content on the entire bus.
[0084] After the master station sends the master station data frame, the data transmission right of the bus is transferred to each slave station in a predetermined order (for example, in the order of increasing address of the slave station). When each slave station obtains the transmission right, it sends its own slave station data frame to the bus. Since the master station is always listening to the data bus, it can sequentially receive the data frame sent by each slave station. By analyzing the received slave station data frame, the master station can extract the slave station shared data contained therein and store it in the local shared data storage area for use by the application layer program.
[0085] The application also provides a multi-node data sharing system based on a synchronous serial bus, which comprises a master station and a plurality of slave stations, wherein the master station is connected with each slave station through a shared clock signal line and a bidirectional data signal line; Each slave station is configured to receive a synchronous clock signal and a master station data frame sent by the master station, and obtain master station shared data from the master station data frame; the synchronous clock signal is a reference clock for communication of all nodes in the system within a communication period; Each slave station is further configured to sequentially execute a data sharing process within the communication period based on a preset order; The data sharing process comprises: sending a slave station data frame of a current slave station to other nodes; the other nodes are nodes in the system except the current slave station; the slave station data frame is used for the other nodes to obtain slave station shared data of the current slave station.
[0086] The synchronous clock signal is a communication reference of the whole system. After a slave station is powered on and configured, it continuously monitors the clock signal line and the data signal line. When detecting that the master station starts to send a data frame (for example, by detecting a specific start bit sequence), the slave station receives the master station data frame bit by bit under the driving of the synchronous clock signal.
[0087] After the reception is completed, the slave station can parse the master station data frame, thereby extracting the master station shared data contained therein and shared configuration information used to guide subsequent slave station synchronization processes.
[0088] The preset order refers to a deterministic sending order followed by all nodes. The preset order can be determined based on the address of the slave station or a pre-arranged station number, for example, the node with the smallest address sends first, then the node with the second smallest address, and so on until the slave station with the largest address sends. This fixed round-robin sending mechanism avoids bus conflicts and ensures the orderly communication.
[0089] The core of the data sharing process is the slave station currently obtaining the sending right. It shares its data with all other nodes in the serial sharing system. Specifically, it sends a slave station data frame of the current slave station to other nodes. The other nodes refer to all nodes in the serial sharing system except the current slave station, which includes the master station and all other slave stations. The slave station data frame sent by the current slave station contains its own slave station shared data (i.e. data that needs to be shared with other nodes). Since the data signal line is shared, the data frame sent by the current slave station can be monitored and received by all other nodes on the bus.
[0090] Through the above process, each slave station not only can obtain data from the master station, but also can actively broadcast its own data to all members (master station and other slave stations) in the system in the communication cycle. This process is completed in a single communication cycle, so that the data exchange between any nodes can be completed in a very short time, and a multi-node data sharing network is formed.
[0091] The application also provides a synchronization process based on the JDAT2 bus protocol, which specifically comprises: The bus for data sharing using the JDAT2 bus protocol can be referred to as a JDAT2 bus.
[0092] To normally use the JDAT2 bus protocol, the synchronization process related code needs to be transplanted and comprehensively implemented in the FPGA program of the master station and the slave station. Then, the protocol is configured by the upper control chip (such as CPU, MCU, etc.) through on-board communication for use. If there is no upper control chip, the code can be configured for communication between FPGAs.
[0093] The station number allocation rule of the JDAT2 bus protocol is to use a pre-set addressing mode. The master station and the listening node use fixed addressing, and the slave station must be sequentially and continuously addressed according to the rule. The fixed addressing of the master station is 1. The slave station is sequentially addressed from 2, and the maximum is 31.
[0094] In the JDAT2 bus protocol attribute configuration, JDAT2_node_count is the number of effective nodes, and its value and the maximum effective slave station node addressing must be equal. Nodes with an addressing exceeding JDAT2_node_count will not be allowed to participate in JDAT2 communication and become silent nodes in the bus network. The addressing of the slave station participating in the JDAT2 bus protocol effective data communication must be unique, and the addressing of the silent node not participating in the JDAT2 bus protocol effective data communication can be the same. The listening node is fixedly addressed as 0. Generally, the addressing of all nodes before the establishment of the JDAT2 bus network is 0 by default. Multiple listening nodes can exist simultaneously in the JDAT2 bus network, and all nodes connected to the JDAT2 bus are listening nodes if the addressing is 0.
[0095] The node quantity rule of the JDAT2 bus protocol is that the physical layer of the JDAT2 bus protocol limits a maximum of 32 nodes, that is, the total number of nodes connected to the physical bus should not exceed 32. In the JDAT2 data link layer addressing, the default address 0 is a listening node, and multiple listening nodes are allowed to exist, and the addresses 1-31 are valid nodes, that is, the total number of nodes participating in the data bidirectional transmission is a maximum of 31. The register JDAT2_node_count is defined in the program to represent the number of valid nodes participating in the communication in the JDAT2 bus network. The default value is 0, the minimum valid value for starting the bus communication is 2, and the maximum value is 31.
[0096] The node types of the JDAT2 bus are divided into: Master station: The master station and the slave station jointly constitute the main body of the JDAT2 communication, and the master station is responsible for initiating the communication. There can be only one master station in a JDAT2 bus network. The master station is fixedly addressed as 1.
[0097] Slave station: The slave station is also a main body member of the JDAT2 communication as the master station, and the slave station responds to each communication process initiated by the master station according to the rules. The bus attribute configuration of the slave station must be the same as that of the master station. A maximum of 30 slave stations are allowed to exist in a JDAT2 bus network. The address range of the slave station is 2-31.
[0098] Listening node: The listening node is not necessarily a member of the JDAT2 communication, but as an observer participant in the bus communication, the node bus attribute configuration must also be the same as that of the master station. The listening node can only listen and is not allowed to send and does not occupy the actual transmission bandwidth of the bus. Multiple listening nodes are allowed to exist at the same time under the node quantity rule limit of the JDAT2. The listening node is fixedly addressed as 0.
[0099] Silent node: The silent node is a slave station node whose address exceeds the JDAT2_node_count range in the JDAT2 bus attribute configuration and does not participate in data reception or data transmission.
[0100] The station number configuration application layer operation flow of the JDAT2 bus mainly configures the station numbers of the nodes participating in the communication through external parameters. The station number of the master station must be 1 (the default value of the parameter is 0), and the station number of the slave station must start from 2 and be continuously addressed. From the application point of view, only setting the station number of the JDAT2 bus does not make the JDAT2 bus start to work immediately, and it is also necessary to configure the working mode of each node at the application level to start the configuration and call of the JDAT2 bus.
[0101] The working flow of the master station of the JDAT2 bus is taken as an example of the JDAT2 bus communication of 4 nodes.
[0102] Master station configuration: (1) Configure the master station number by external parameters: 1.
[0103] (2) Configure the number of nodes by external parameters: 4. Determine the slave address list: ADDR-2, ADDR-3, ADDR-4; calculate the frame length, and determine the frame header content. The number of slave nodes is configured in the value range (2-4), and values outside the range are invalid configurations.
[0104] (3) Configure the JDAT2 bus synchronization clock frequency by external parameters: 10MHz / 20MHz / 50MHz, other values are invalid.
[0105] (4) Configure the shared data index table by external parameters. The data information exchanged by each node (including the master station) can be externally configured, or dynamically configured by the application program according to the internal working mechanism.
[0106] (5) Configure the master station working mode by external parameters: master mode (combined with system position / speed / current / open loop application mode to form a new working mode). After completing the above 5 master station configurations, if it is online, it is effective (recommended, it can also be effective by power-on), the system and JDAT2 bus immediately start working according to the configured mode. The system will retain the above configuration and continue to work according to it when it is powered off and powered on again. In the overall configuration process of the JDAT2 bus multi-node communication system, it is recommended to follow a fixed order from large to small station number, starting from the slave station with the largest station number, and finally completing the configuration of the No. 1 master station. In this way, the master station can immediately start JDAT2 communication and enter the normal working state after completing the configuration.
[0107] Master station sending phase The master station starts the sending process in the foreground or background of the application program loop. It usually performs JDAT2 bus communication operations in a fixed period, or it may be required to maintain a certain synchronization relationship with a certain signal. The master station sets JDAT2_TXEN to 1, and simultaneously starts JDAT2_CLK output according to the JDAT2 synchronization clock configuration, and begins to send shared configuration information and the master station's own master station shared data. Two groups of 32-bit registers DAT1 and DAT2 can be used for data transmission of the master station shared data. For requirements that require both synchronization and large data transmission, DAT registers can be added as needed under the condition that the bandwidth and synchronization requirements allow.
[0108] The content of the master station data frame sent by the master station is shown in Table 1 Master Station Data Frame Content Table: Table 1 Master Station Data Frame Content Table Among them, the explanation of the content of the master station data frame can be shown in Table 2 Master Station Data Frame Content Explanation Table: Table 2 Master Station Data Frame Content Explanation Table The interpretation of the Header field of the master station data frame can be shown in Table 3 Header field content interpretation table: Table 3 Header field content interpretation table In the master station receiving stage, the master station keeps the JDAT2 CLK output, and at the same time, the JDAT2 TXEN is cleared to 0 in the IDLE bit to convert to the receiving state, and starts to continuously monitor the JDAT2 bus from the station information. In this stage, the master station will actively judge the response of the slave station, process normal response, no response communication timeout, slave station node address error, slave station node data CRC error, stop bit error and other bus states. The normally received information is: Receive ADDR1 data information: ADDR1, STATUS, DAT1, DAT2, CRC, STOP, IDLE; Receive ADDR2 data information: ADDR2, STATUS, DAT1, DAT2, CRC, STOP, IDLE; Receive ADDR3 data information: ADDR3, STATUS, DAT1, DAT2, CRC, STOP, IDLE.
[0109] Master station completion stage: (1) Data verification: respectively verify the information received from each slave station node.
[0110] (2) State update and fault processing.
[0111] (3) Update data RAM: update the normal data verified to the shared data RAM.
[0112] The working process of the slave station is illustrated by taking the JDAT2 bus communication of four nodes as an example.
[0113] (1) Respectively configure the slave station number through external parameters: 2 / 3 / 4. The slave station number in the JDAT2 bus must start from 2 and be continuously coded, and the non-continuous address does not participate in communication.
[0114] (2) Respectively configure the node number through external parameters: 4. Each slave station must know the total number of nodes participating in communication in advance. The node number must be equal to the maximum value of the slave station number, and the slave station node exceeding the node number value will become a silent node.
[0115] (3) Slave mode configuration by external parameters: follow mode (combined with system position / speed / current / feedback application mode to form new working mode). After the above three slave configurations are completed, the JDAT2 bus immediately starts working according to the configured mode.
[0116] Slave receiving stage: the slave immediately sets JDAT2_TXEN to 0 after the configuration is completed, and enters the receiving listening state. Once the SYNC field sent by the master is detected on the JDAT2 bus, the data receiving process will start. The receiving process of the slave is divided into two stages: the first stage is the reception of master information, and the second stage is the reception of information of all other slaves except itself. All nodes in the JDAT2 bus are always in the listening state of bus information during the communication transmission time except for the transmission of their own data.
[0117] Slave sending stage: the first slave sets JDAT2_TXEN to 1 immediately after completing the master information receiving stage, and enters the sending stage, and the subsequent slave continues to remain in the receiving state; the second slave enters the sending stage after completing the information receiving of the first slave; and so on until the maximum slave. Among them, all slaves must provide corresponding slave shared data according to the data index in the master frame header information, otherwise an application layer execution error will be caused.
[0118] The content of the slave data frame sent by the slave is shown in Table 4 Slave Data Frame Content Table: Table 4 Slave Data Frame Content Table Among them, the explanation of the content of the slave data frame can be shown in Table 5 Slave Data Frame Content Explanation Table: Table 5 Slave Data Frame Content Explanation Table Slave completion stage: (1) Data verification: the information received from the master and other slave nodes is verified respectively.
[0119] (2) State update and fault handling.
[0120] (3) Update data RAM: update the normal data verified by the data verification to the shared data RAM.
[0121] The data verification of the JDAT2 bus adopts a segmented CRC-8 verification mode to ensure the accuracy of the effective data of each node.
[0122] The generating polynomial for CRC-8 is: x8+x6+x4+x3+x2+x1 (0x5E); CRC check code calculation range Master station sends information CRC1: Header+Status (40-bit) Master station sends information CRC2: DATA1+DATA2 (64-bit) Slave station sends information CRC: ADDRx+STATUS+DATA1+DATA2 (76-bit) JDAT2 Master station and slave station send data at falling edge and receive data at rising edge; sending data all follow the principle of high bit first out.
[0123] JDAT2 bus clock line and data line are kept at high level in idle state. After each communication frame transmission is completed, at least 2 JDAT2 CLK time delay is kept before starting the next data transmission.
[0124] The bus status word of JDAT2 bus is used to represent the overall status of the current bus, which is updated by a 16-bit status register Jdat2_bus_status of JDAT2 data link layer according to the current bus status. The bus status that can be represented includes: bus cycle not established / bus cycle established / bus cycle deviation out of limit / bus not synchronized / bus synchronization completed / bus synchronization deviation out of limit / bus clock normal / bus clock status error.
[0125] The error detection corresponding to the bus communication status word Jdat2_bus_status is shown in Table 6 Bus Error Detection Table: Table 6 Bus Error Detection Table The bus node working status word of JDAT2 bus is used to represent the working status of the current bus node. Jdat2_master_status is the working status word of master node, which is sent by master station and received by other nodes. The status is the working status (including communication status) of master station broadcast, which is defined by application layer. JDAT2 does not process this status word. Jdat2_slave_status[n] is the working status word of slave station [n], which is sent by slave station [n] and received by other nodes (including master node). The status is the working status (including communication status) of slave station [n] broadcast, which is defined by application layer. JDAT2 bus does not process this status word.
[0126] The bus reception status word of the JDAT2 bus is used to represent the current bus master and slave reception data status. The Jdat2_master_rx_status is the slave reception master information status word, the slave reception master information status, whether timeout, whether CRC check error, and waiting. The Jdat2_slave_rx_status[n] is the reception slave [n] information generated status word, which represents the reception slave [n] information status, whether timeout, whether CRC check error, and waiting.
[0127] The error detection and processing corresponding to the slave reception master information status word Jdat2_master_rx_status is shown in Table 7, slave reception master information status word error detection and processing table: Table 7, slave reception master information status word error detection and processing table The error detection and processing corresponding to the reception slave [n] information generated status word Jdat2_slave_rx_status[n] is shown in Table 8, reception slave information generated status word error detection and processing table: Table 8, reception slave information generated status word error detection and processing table The register and data storage space definition of the JDAT2 bus is described in the initialization phase before establishing the JDAT2 communication. The master needs to complete all register settings of the JDAT2 bus configuration, and the slave needs to complete the JDAT2 bus configuration settings related to itself.
[0128] The configuration process of the JDAT2 bus control register group is as follows: I. Configure the node number setting register Jdat2_node_count The total number of nodes participating in master-slave communication on the bus, the value should be equal to the maximum slave node station number. All nodes need to be configured.
[0129] II. Configure the node number setting register Jdat2_node_count The total number of nodes participating in master-slave communication on the bus, the value should be equal to the maximum slave node station number. All nodes need to be configured.
[0130] III. Configure the synchronization clock frequency setting register Jdat2_baud_rate Set the frequency of the Jdat2 master clock, unit: Hz. Only the master node writes valid, other nodes are invalid.
[0131] IV. Configure the bus working mode setting register Jdat2_bus_mode Single immediate execution mode, cyclic synchronous execution mode, data expansion mode, etc.
[0132] V. The JDAT2 bus working state monitoring register group includes: Bus state register Jdat2_bus_status Current communication state of the bus.
[0133] Clock synchronization register Jdat2_phase_error All nodes automatically monitor and calculate the JDAT2 synchronization time constant, which is the number of system clocks. It is only valid in the synchronization mode.
[0134] Synchronization cycle measurement register Jdat2_cycle_error All nodes automatically monitor and calculate the Jdat2 synchronization cycle, which is the number of system clocks. It is only valid in the synchronization mode.
[0135] JDAT2 bus data index register group configuration process: I. The JDAT2 node application layer program should establish the same JDAT2 shared data index table in the initialization. The data table is visible to the user after external parameterization, and the user can configure it according to the different application requirements.
[0136] II. Dynamic configuration and real-time configuration The JDAT2 master node adjusts the shared data index of the specified node through the HEADER configuration, and the adjustment can take effect immediately in the current period or be delayed for 1 period to take effect in the next period.
[0137] The overall timing of JDAT2 describes the execution sequence relationship between the main links of the bus operation between the multi-node communication system working based on the JDAT2 bus, and gives the key time parameters.
[0138] The overall timing diagram of the 4-node JDAT2 (synchronization mode) is shown in the following figure: Figure 5 The overall timing diagram provided by the present application is shown in the following figure: In one communication period, the data real-time sharing between all nodes (master and slave) is realized. The whole process is performed in a fixed period T (T=62.5us), and the beginning of each period is marked by a sync signal.
[0139] Period start (sync): In At the beginning of the period, the processor (M0_DSP, S1_DSP, S2_DSP, S3_DSP) in the FPGA of all nodes (master M0, slave S1, slave S2, slave S3) will receive a synchronization signal sync.
[0140] Read data (R): The DSP of each node will first read (R) the data in the previous period (T-1) and the current period (T). data shared by the other nodes in the previous period (t2) through the JDAT2 bus. This data is the state or result fed back by the other nodes after the execution of the commands in the previous period (t2) and can be used as command data in the current period (t3).
[0141] Process and write data (WPos-Vel-Cur): The DSP performs calculation processing according to the read command data and then writes the feedback data (e.g., WPos-Vel-Cur) to be shared in the current period into the sending register in the FPGA, ready for sending.
[0142] After a short preparation time t1, the JDAT2 bus starts data transmission in the preset order.
[0143] First, the master station M0 obtains the bus usage right and enters the sending state (M0_JSM row shows T) to send its data packet to the bus. At this time, all slave stations are in the receiving state (S1_JSM to S3_JSM rows show R).
[0144] After the master station finishes sending, it immediately transfers the bus control right to the slave station S1. S1 enters the sending state (T), and all other nodes including the master station enter the receiving state (R).
[0145] This process is performed in turn until the last slave station S3 finishes sending. The entire data transmission process takes t2.
[0146] After the transmission is completed, the bus has an idle time t3 until the next sync signal arrives to start the period.
[0147] Shared data: The shared data written by all nodes in the nth period can be used by all nodes in the n+1 period. The shared data itself does not distinguish between feedback data and command data.
[0148] Feedback data: All nodes write the feedback data (the result of the command execution in the period) obtained in the nth period to the register for storing data in the JDAT2 and transmit it to all nodes through the JDAT2 in the current period, which is available to all nodes in the n+1 period. Therefore, the total delay of the feedback data is 2 periods (1 period for each node itself).
[0149] Command data: If the shared data in the nth period of any node is used as the command data for all nodes (including itself), the command data of other nodes will not be available until the n+1 period, and the command data of itself will be available in the current period (the nth period).
[0150] JDAT2 synchronous mode requires all nodes foreground cycle must be synchronized, such as Figure 6 The present application provides a schematic diagram of synchronous work.
[0151] JDAT2 synchronization mechanism: all nodes with M0_sync as the reference, calculate their own time deviation, as the basis for the adjustment of the upper SYNC time. Synchronization calculation does not consume CPU time, can be executed every cycle or periodic execution, to eliminate the accumulation of differences due to the differences between the system clock of each node.
[0152] Each slave node synchronization time calculation method (illustrated by s1 node) (1) t0 for all nodes known (default or given by external parameters); (2) slave node from monitoring the data frame sync head last bit (start with its own system clock timing, calculate the next sync signal to the time t1, and update the results to the JDAT2 bus control register jdat2_phase_error.
[0153] (3) the upper processor can be integrated to calculate the time difference between M0_sync and S1_sync, S1_phase_error = t0 + t1, and adjust the S1_sync phase before the next cycle begins, in order to achieve the purpose of synchronization between the upper processor. Synchronization accuracy: cable transmission delay + between slave and master station system clock accuracy deviation. In the short distance distribution of each node transmission conditions, the slave and master station using the same 30ppm accuracy clock source, is expected to ultimately can do 10ns level of synchronization accuracy.
[0154] Wherein, t1, t2, t3 is the measurement of each slave. For example, slave 1, t1 is the time from the detection of the end of the sync frame on the JDAT2_DATA line to the arrival of its own application synchronization signal S1_sync.
[0155] JDAT2 bus transmission process as Figure 7The sending flowchart provided by the application is shown. The sending flow of the JDAT2 bus first writes the data to be sent into the sending register in the synchronization mode, and then calculates the CRC check code of the sending data to ensure the data integrity. Next, it is judged whether the current node is the master station. If it is the master station, the node waits for the arrival of the synchronization signal to ensure the time synchronization of the whole communication; if it is not the master station, it waits for the data receiving of the last node to be completed or the sending timeout, and then prepares to switch to the sending state. After that, the data interface is switched to the sending state, and the data is converted into the serial form and sent bit by bit. After the data sending of the current node is completed, the sending interface is immediately switched to the receiving state to prepare to receive the data of the next node. The flow ensures the strict timing control and communication synchronization among the nodes, and realizes the reliable and efficient data transmission among the multiple nodes.
[0156] The receiving flow of the JDAT2 bus is shown in the following Figure 8 The receiving flowchart provided by the application is shown. The receiving flow of the JDAT2 bus first waits for the node data, and continuously listens to the bus data. When the data is received, the corresponding slave synchronization signal is generated to indicate the occurrence of the receiving event. Then, the received clock signal and data signal are aligned to ensure the time synchronization of the data. It is judged whether the data frame is complete. If it is not complete, the data receiving error is identified, and the current receiving process is terminated. After the complete data is converted in parallel, the CRC check is performed to judge the validity of the data. If the CRC check fails, the node identity is distinguished for processing: the master station receiving error is recorded as the master station data error, and the non-master station is recorded as the receiving error. For the data passing the check, the data is stored into the RAM at the corresponding address. If the current node is not the last node, the next node data is continuously received; if it is the last node, the logic layer state reading is entered to prepare to receive the next round of starting signal, and the robust and synchronous data receiving management of the multiple nodes is realized.
[0157] Figure 9 An example of the physical structure schematic diagram of an electronic device is shown in the following Figure 9 As shown in the figure, the electronic device can include a processor 910, a communications interface 920, a memory 930 and a communications bus 840, wherein the processor 910, the communications interface 920 and the memory 930 complete the communication among each other through the communications bus 940. The processor 910 can call the logic instruction in the memory 930 to execute the multiple node data sharing method based on the synchronization serial bus, which includes that the master station sends the synchronization clock signal and the master station data frame to all slave stations; The synchronization clock signal is a reference clock for communication of all nodes in the serial shared system in a communication period; the master station data frame comprises master station shared data and shared configuration information; the shared configuration information records address information of each slave station and slave station shared data of each slave station; and the shared configuration information is used for data sharing of each slave station in the communication period. The master station sequentially receives slave station data frames sent by each slave station, and acquires slave station shared data of each slave station based on the slave station data frames.
[0158] In addition, the logical instructions in the memory 930 described above can be implemented in the form of a software function unit and sold or used as an independent product, and can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in the various embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0159] On the other hand, the present application also provides a computer program product, which comprises a computer program, the computer program can be stored on a non-transitory computer readable storage medium, and the computer program is executed by a processor, so that the computer can execute the multi-node data sharing method based on a synchronous serial bus provided by the above-mentioned method, the method comprises: the master station sends a synchronization clock signal and a master station data frame to all slave stations; The synchronization clock signal is a reference clock for communication of all nodes in the serial shared system in a communication period; the master station data frame comprises master station shared data and shared configuration information; the shared configuration information records address information of each slave station and slave station shared data of each slave station; and the shared configuration information is used for data sharing of each slave station in the communication period. The master station sequentially receives slave station data frames sent by each slave station, and acquires slave station shared data of each slave station based on the slave station data frames.
[0160] In yet another aspect, the application also provides a non-transitory computer readable storage medium having stored thereon a computer program, which, when executed by a processor, implements a method for sharing data among multiple nodes based on a synchronous serial bus, the method comprising: sending, by a master station, a synchronization clock signal and a master station data frame to all slave stations; The synchronization clock signal is a reference clock for all nodes in the serial sharing system to communicate in a communication cycle; the master station data frame comprises master station shared data and sharing configuration information; the sharing configuration information records address information of each slave station and slave station shared data of each slave station; and the sharing configuration information is used for data sharing of each slave station in the communication cycle. The master station sequentially receives slave station data frames sent by each slave station, and acquires slave station shared data of each slave station based on the slave station data frames.
[0161] The device embodiments described above are merely illustrative, wherein the units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e., can be located in one place, or can be distributed on multiple network units. Part or all of the modules can be selected to achieve the purpose of the embodiment according to actual needs. Those skilled in the art can understand and implement without creative labor.
[0162] From the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be realized by means of software and necessary general hardware platform, and of course can also be realized by hardware. Based on such understanding, the above technical solutions can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes a plurality of instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) to execute the method described in each embodiment or some part of the embodiment.
[0163] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the application, and not to limit them; although the application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement to some technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the application.
Claims
1. A multi-node data sharing method based on a synchronous serial bus, applied to a serial sharing system including one master station and multiple slave stations, wherein the master station and each slave station are connected via a shared clock signal line and a bidirectional data signal line, characterized in that, The method includes: The master station sends a synchronization clock signal and a master station data frame to all slave stations. The synchronization clock signal is the reference clock for all nodes in the serial sharing system to communicate within one communication cycle; the master station data frame includes master station shared data and shared configuration information; the shared configuration information records the address information of each slave station and the slave station shared data of each slave station; the shared configuration information is used by each slave station to share data within the communication cycle; The master station sequentially receives slave data frames sent by each slave station, and obtains the slave-shared data of each slave station based on the slave data frames.
2. The multi-node data sharing method based on a synchronous serial bus according to claim 1, characterized in that, The master station sends the master station data frame to all slave stations on the falling edge of the synchronization clock signal; The master station receives slave data frames sent by each slave station on the rising edge of the synchronization clock signal.
3. The multi-node data sharing method based on a synchronous serial bus according to claim 1, characterized in that, The shared configuration information also records the main station data verification code; The master station data verification code is used to perform the verification process of the master station shared data.
4. A multi-node data sharing method based on a synchronous serial bus, applied to a serial sharing system including one master station and multiple slave stations, wherein the master station and each slave station are connected via a shared clock signal line and a bidirectional data signal line, characterized in that, The method includes: Each slave station receives the synchronization clock signal and master station data frame sent by the master station, and obtains the master station shared data from the master station data frame; the synchronization clock signal is the reference clock for all nodes in the serial sharing system to communicate within one communication cycle; Each slave station executes the data sharing process sequentially within the communication cycle based on a preset order; The data sharing process includes: The slave data frame of the current slave station is sent to other nodes; the other nodes are nodes in the serial sharing system other than the current slave station; the slave data frame is used by other nodes to obtain the slave shared data of the current slave station.
5. The multi-node data sharing method based on a synchronous serial bus according to claim 4, characterized in that, At the rising edge of the synchronization clock signal, each slave station receives the synchronization clock signal and the master station data frame sent by the master station. On the falling edge of the synchronization clock signal, the current slave station sends slave data frames to other nodes.
6. The multi-node data sharing method based on a synchronous serial bus according to claim 4, characterized in that, The step of sending the current slave data frame to other nodes includes: The master station data frame is parsed to determine the shared configuration information in the master station data frame; Based on the shared configuration information, determine the slave-site shared data of the current slave station; A slave data frame is generated based on the slave shared data of the current slave station, and the slave data frame of the current slave station is sent to other nodes.
7. The multi-node data sharing method based on a synchronous serial bus according to claim 4, characterized in that, Also includes: Each slave station determines the time phase deviation between the application layer synchronization signal and the synchronization clock signal reference sent by the master station; Each slave station adjusts the phase of the application layer synchronization signal for the next communication cycle based on the aforementioned time phase deviation.
8. A multi-node data sharing system based on a synchronous serial bus, characterized in that, The system includes a master station and multiple slave stations, with the master station and each slave station connected via a shared clock signal line and a bidirectional data signal line; The master station is used to send synchronization clock signals and master station data frames to all slave stations; The synchronization clock signal is the reference clock for all nodes in the system to communicate within one communication cycle; the master station data frame includes master station shared data and shared configuration information; the shared configuration information records the address information of each slave station and the slave station shared data of each slave station; the shared configuration information is used for each slave station to share data within the communication cycle; The master station is also used to receive slave data frames sent by each slave station in sequence, and to obtain slave-shared data of each slave station based on the slave data frames.
9. A multi-node data sharing system based on a synchronous serial bus, characterized in that, The system includes a master station and multiple slave stations, with the master station and each slave station connected via a shared clock signal line and a bidirectional data signal line; Each slave station is used to receive the synchronization clock signal and master station data frame sent by the master station, and to obtain the master station shared data from the master station data frame; The synchronization clock signal is the reference clock for all nodes in the system to communicate within one communication cycle; Each slave station is also used to execute the data sharing process sequentially within the communication cycle based on a preset order; The data sharing process includes: The slave data frame of the current slave station is sent to other nodes; the other nodes are nodes in the system other than the current slave station; the slave data frame is used by other nodes to obtain the slave shared data of the current slave station.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the multi-node data sharing method based on a synchronous serial bus as described in any one of claims 1 to 3, or implements the multi-node data sharing method based on a synchronous serial bus as described in any one of claims 4 to 7.