A highly reliable serial communication method for dual-machine joint control
By adopting a high-reliability serial port communication method with dual channels between the master and slave, the problem of unreliable serial port communication under asynchronous operation is solved, and high-reliability communication in the aerospace field is achieved, the risks brought by the cutter are avoided, and the stability and security of communication are ensured.
Patent Information
- Application Number
- CN202210821697.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-12
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2042-07-12
AI Technical Summary
In the aerospace field, when the asynchronously operated master and slave computer communication failure occurs, the traditional reset or cut-off method cannot ensure that the opponent's machine is not sending data, resulting in unreliable communication and cannot effectively handle serial communication failures.
The host and slave are equipped with a highly reliable serial communication method with the same control cycle but running asynchronously. By cyclically performing communication tasks and autonomous query and diagnosis tasks within each control cycle, data transmission and reception are used using the master and slave dual channels, and data is not read when the received FIFO data is incomplete, ensuring data integrity.
It improves the reliability of serial port communication, avoids risks caused by machine cutting, ensures the stability and security of communication, and is suitable for dual-machine joint control in the aerospace field.
Smart Images

Figure CN115408326B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of aerospace and relates to a highly reliable serial port communication mechanism for dual-machine joint control. Background Art
[0002] Serial communication is widely used in industrial control, measurement equipment, and some communication equipment due to its simple lines, easy long-distance communication, and the ability to send data using one line while receiving data using another line.
[0003] Serial communication is widely used in the aerospace field. Typically, when a serial communication failure occurs, the problem is resolved by resetting the slave device, resetting the master serial port, or disconnecting the master. However, if the slave device has the same priority or importance as the master, or if the master or slave cannot afford the risks of resetting or disconnecting the slave, traditional methods cannot be used. Furthermore, when the master and slave devices are operating asynchronously, traditional serial port resets are no longer suitable, as there is no guarantee that the other device will not be transmitting data at the time of reset.
[0004] Therefore, it is necessary to design highly reliable serial communication methods and fault handling methods to meet the high reliability requirements of serial communication in the aerospace field. Summary of the Invention
[0005] The technology of the present invention solves the problem: overcomes the shortcomings of the existing technology, provides a high-reliability serial port communication method for dual-machine joint control, and improves the reliability of dual-machine serial port communication.
[0006] The technical solution of the present invention is a highly reliable serial communication method for dual-machine joint control, wherein the dual machines are a master and a slave, each of which is provided with a transmit FIFO and a receive FIFO, and the master and the slave have the same control cycle length but operate asynchronously. The method comprises the following steps:
[0007] S1. After the host is powered on and initialized, the receive FIFO and transmit FIFO are cleared;
[0008] S2: After the slave is powered on and initialized, it clears the receive FIFO and transmit FIFO and starts the autonomous query diagnostic task;
[0009] S3. The host starts the communication task with the slave. According to the preset communication protocol, the host writes the information indicating "communication task with the slave has been established" into the characteristic data bit of the data sent to the slave. At the same time, the autonomous query diagnosis task is started.
[0010] S4. After the slave receives the data for the first time and parses it to obtain the information indicating that "communication task with the slave has been established", it starts the communication task with the master;
[0011] After that, in each local control cycle, the master and slave cyclically execute the following communication tasks and autonomous query and diagnosis tasks:
[0012] The communication task is: the master and the slave send a single data frame of preset fixed length to each other according to the preset communication protocol in each local control cycle;
[0013] The autonomous query diagnostic task is: the master and slave query the data in the receive FIFO at least twice in each local control cycle, and perform the following data processing based on the query results:
[0014] When the data length in the receive FIFO is found to be greater than the preset fixed length, the receive FIFO is cleared by reading the data in the receive FIFO without parsing the read data;
[0015] When the data length in the receive FIFO is equal to the preset fixed length, the receive FIFO is cleared by reading the data in the receive FIFO and the read data is parsed;
[0016] When it is found that the data length in the receive FIFO is less than the preset fixed length, it is considered that the data is being transmitted and no operation is performed on the receive FIFO.
[0017] The above-mentioned high-reliability serial communication method for dual-machine joint control further includes the step of canceling the communication task:
[0018] S7. After receiving the external input "stop the communication task between the master and the slave" data instruction, the master stops executing the autonomous query diagnosis task, writes the information indicating "no communication task with the slave" in the characteristic data bits of the next three data sent to the slave, and then stops sending data to the slave;
[0019] S8: After receiving the "communication task with the slave is not established" message from the master, the slave stops sending data to the master, but continues to perform the autonomous query and diagnosis task in each control cycle;
[0020] S8. The host queries the data status of the receiving FIFO in each control cycle until it confirms that the standby receiving FIFO is empty for N consecutive times, then immediately stops executing the autonomous query diagnosis task, where N is greater than or equal to 6.
[0021] Preferably, the high-reliability serial port communication method for dual-machine joint control as described in claim 2 is characterized in that the communication protocol stipulates that the same characteristic data bit is used to represent the information of "a communication task has been established with the slave" and "a communication task has not been established with the slave", and the data of the characteristic data bit is 1, indicating that "a communication task has been established with the slave", and 0, indicating that "a communication task has not been established with the slave".
[0022] Preferably, both the master and slave devices use primary and backup dual channels for data transmission and reception, specifically as follows:
[0023] The master device simultaneously sends data outward using the primary and backup transmission FIFOs;
[0024] The master device simultaneously queries the data in the primary and backup reception FIFOs and processes the data according to the query results;
[0025] The slave device simultaneously sends data outward using the primary and backup transmission FIFOs;
[0026] The slave device simultaneously queries the data in the primary and backup reception FIFOs and processes the data according to the query results.
[0027] Preferably, the master and slave devices also perform the following fault monitoring steps:
[0028] Synchronously query the data status of the primary and backup reception FIFOs. If both the primary and backup reception FIFOs are empty, record that the reception FIFO is empty. If the situation where the reception FIFO is empty continuously occurs and accumulates to be greater than or equal to M1 times, it is considered that there is a dual-machine communication fault, and record that the communication fault count is incremented by 1; otherwise, if the reception FIFO is empty, but the number of times the reception FIFO is empty accumulates to be less than M1 times, no data reading operation is performed, where M1≥20. If the reception FIFO is not empty, clear the number of times the reception FIFO is empty.
[0029] Preferably, the master and slave devices also perform the following fault monitoring steps:
[0030] Query the data status of the primary and backup reception FIFOs. If "0 < the data length of the primary reception FIFO < the preset fixed length" or "0 < the data length of the backup reception FIFO < the preset fixed length", both are recorded as "0 < the data length of the reception FIFO < the preset fixed length". If the number of times of "0 < the data length of the reception FIFO < the preset fixed length" < M2, it is considered that data is being transmitted, and no data reading operation is performed; if the number of times of "0 < the data length of the reception FIFO < the preset fixed length" ≥ M2 times, it is considered that there is a dual-machine communication fault, and record that the communication fault count is incremented by 1, where M2≥20.
[0031] Preferably, the master and slave devices also perform the following fault monitoring steps:
[0032] Query the data status of the main receive FIFO and the backup receive FIFO. If either "the data length of the main receive FIFO is greater than the preset fixed length" or "the data length of the backup receive FIFO is greater than the preset fixed length", record it as "the data length of the receive FIFO is greater than the preset fixed length". If the number of times that "the data length of the receive FIFO is greater than the preset fixed length" < M3, read all the data in the receive FIFO and clear the data in the receive FIFO, but do not perform parsing; if the number of times that "the data length of the receive FIFO is greater than the preset fixed length" ≥ M3, do not perform the data reading operation, consider the dual-machine communication faulty, and record that the communication fault count is incremented by 1, where M3 ≥ 10.
[0033] Preferably, the host and the slave also perform the following fault monitoring steps:
[0034] Query the data status of the main receive FIFO and the backup receive FIFO. If either "the data length in the main receive FIFO is the fixed length" or "the data length in the backup receive FIFO is the fixed length", record it as "the data length in the receive FIFO is the fixed length". When "the data length in the receive FIFO is the fixed length", check whether the frame header or the checksum is correct. If it is incorrect, consider the dual-machine communication faulty and record that the communication fault count is incremented by 1. Otherwise, parse the data in the corresponding main receive FIFO or backup receive FIFO and clear the communication fault count.
[0035] Preferably, the host also performs the following fault monitoring steps:
[0036] When the communication fault count recorded by the host ≥ M4 times, set "the communication between the host and the slave fails" and stop sending any data to the slave, where M4 ≥ 10.
[0037] Preferably, the slave also performs the following fault monitoring steps:
[0038] When the communication fault count recorded by the slave ≥ M5 times, the slave stops sending data to the host, where M5 ≥ 10.
[0039] The advantages of the present invention compared with the prior art are as follows:
[0040] (1) The present invention uses the main and backup dual channels for data sending and receiving;
[0041] (2) The present invention queries the data in the FIFO twice per cycle to avoid incomplete data reception;
[0042] (3) When the data in the receive FIFO is incomplete (less than 255 bytes), the present invention does not read the data, that is, does not clear the data in the FIFO, avoiding incomplete reading caused by reading during data transmission;
[0043] (4) When the data in the receiving FIFO is 256 bytes, the present invention reads the data but does not parse it. Reading the data means clearing the data in the FIFO to prepare for the FIFO to receive the correct data in the next cycle. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 The serial port connection relationship between the satellite platform control computer AOCC sending and the payload platform control computer PRCC receiving in the embodiment of the present invention;
[0045] Figure 2 This is the timing relationship between the satellite platform control computer AOCC and the payload platform control computer PRCC sending and querying data in an embodiment of the present invention. DETAILED DESCRIPTION
[0046] The present invention is described in detail below with reference to the accompanying drawings and embodiments.
[0047] The present invention provides a highly reliable serial communication method for dual-machine joint control, wherein the dual machines are a master and a slave, each of the master and the slave is provided with a transmit FIFO and a receive FIFO, and the master and the slave have the same control cycle length but operate asynchronously. The method comprises the following communication steps:
[0048] S1. After the host is powered on and initialized, it clears the receive FIFO and transmit FIFO and does not send or receive any data from the slave.
[0049] S2: After the slave is powered on and initialized, it clears the receive FIFO and transmit FIFO and starts the autonomous query diagnostic task;
[0050] S3. The host starts the communication task with the slave. According to the preset communication protocol, the host writes the information indicating "communication task with the slave has been established" into the characteristic data bit of the data sent to the slave. At the same time, the autonomous query diagnosis task is started.
[0051] S4. After the slave receives the data for the first time and parses it to obtain the information indicating that "communication task with the slave has been established", it starts the communication task with the master;
[0052] After that, in each local control cycle, the master and slave cyclically execute the following communication tasks and autonomous query and diagnosis tasks:
[0053] The communication task is: the master and the slave send a single data frame of preset fixed length to each other according to the preset communication protocol in each local control cycle;
[0054] The autonomous query diagnostic task is: the master and slave query the data in the receive FIFO at least twice in each local control cycle, and process the data according to the query results:
[0055] When the data length in the receive FIFO is found to be greater than the preset fixed length, the receive FIFO is cleared by reading the data in the receive FIFO without parsing the read data;
[0056] When the length of the data in the receive FIFO is equal to the preset fixed length, the receive FIFO is cleared by reading the data in the receive FIFO and the read data is parsed;
[0057] When it is found that the data length in the receive FIFO is less than the preset fixed length, it is considered that the data is being transmitted and no operation is performed on the receive FIFO.
[0058] Preferably, the highly reliable serial communication method for dual-machine joint control further includes the step of canceling the communication task:
[0059] S7. After receiving the external input "stop the communication task between the master and the slave" data instruction, the master stops executing the autonomous query diagnosis task, writes the information indicating "no communication task with the slave" in the characteristic data bits of the next three data sent to the slave, and then stops sending data to the slave;
[0060] S8: After receiving the "communication task with the slave is not established" message from the master, the slave stops sending data to the master, but continues to perform the autonomous query and diagnosis task in each control cycle;
[0061] S8. The host queries the data status of the receive FIFO in each control cycle until it confirms that the main and standby receive FIFOs are empty for N consecutive times, then immediately stops executing the autonomous query diagnosis task, where N is greater than or equal to 6.
[0062] Preferably, the communication protocol stipulates that the same characteristic data bit is used to represent the information of "communication task has been established with the slave" and "communication task has not been established with the slave", and the data of this characteristic data bit is 1 to indicate "communication task has been established with the slave", and 0 to indicate "communication task has not been established with the PRCC".
[0063] Preferably, the host and the slave both use a master and a standby dual channel to send and receive data, specifically:
[0064] The host uses the main and standby transmit FIFOs to send data outward at the same time;
[0065] The host queries the data in the main and standby receive FIFOs at the same time and processes the data according to the query results;
[0066] The slave uses the master and standby transmit FIFOs to send data out simultaneously;
[0067] The slave device queries the data in the master and standby receive FIFOs simultaneously and processes the data according to the query results.
[0068] Preferably, in the above high-reliability serial communication method for dual-machine joint control, the host and the slave also perform the following fault monitoring steps:
[0069] S3.1. Statistically analyze the query results of the data status of the primary receive FIFO and the standby receive FIFO. If either the primary receive FIFO or the standby receive FIFO is empty, record that the receive FIFO is empty. If the situation where the receive FIFO is empty continuously appears and accumulates to be greater than or equal to M1 times, it is considered that there is a dual-machine communication fault, and record that the communication fault count is incremented by 1; otherwise, if the receive FIFO is empty, but the number of times the receive FIFO is empty accumulates to be less than M1 times, no data reading operation is performed, where M1 ≥ 20.
[0070] Preferably, in the above high-reliability serial communication method for dual-machine joint control, the host and the slave also perform the following fault monitoring steps:
[0071] Query the data status of the primary receive FIFO and the standby receive FIFO. If "0 < the data length of the primary receive FIFO < the preset fixed length" or "0 < the data length of the standby receive FIFO < the preset fixed length", both are recorded as "0 < the data length of the receive FIFO < the preset fixed length". If the number of times of "0 < the data length of the receive FIFO < the preset fixed length" < M2, it is considered that data is being transmitted, and no data reading operation is performed; if the number of times of "0 < the data length of the receive FIFO < the preset fixed length" ≥ M2 times, it is considered that there is a dual-machine communication fault, and record that the communication fault count is incremented by 1, where M2 ≥ 20.
[0072] Preferably, in the above high-reliability serial communication method for dual-machine joint control, the host and the slave also perform the following fault monitoring steps:
[0073] Query the data status of the primary receive FIFO and the standby receive FIFO. If "the data length of the primary receive FIFO is greater than the preset fixed length" or "the data length of the standby receive FIFO is greater than the preset fixed length", both are recorded as "the data length of the receive FIFO is greater than the preset fixed length". If the number of times of "the data length of the receive FIFO is greater than the preset fixed length" < M3, read all the data in the receive FIFO and clear the data in the receive FIFO, but do not perform parsing; if the number of times of "the data length of the receive FIFO is greater than the preset fixed length" ≥ M3, no data reading operation is performed, it is considered that there is a dual-machine communication fault, and record that the communication fault count is incremented by 1, where M3 ≥ 10.
[0074] Preferably, in the above high-reliability serial communication method for dual-machine joint control, the host and the slave also perform the following fault monitoring steps:
[0075] Query the data status of the main receive FIFO and the backup receive FIFO. If "the data length in the main receive FIFO is fixed length" or "the data length in the backup receive FIFO is fixed length" is recorded as "the data length in the receive FIFO is fixed length". When "the data length in the receive FIFO is fixed length", check whether the frame header or checksum is correct. If not, it is considered that the two-machine communication has failed, and the number of communication failures is recorded plus 1. Otherwise, parse the data in the corresponding main receive FIFO or slave receive FIFO, and clear the number of communication failures.
[0076] Preferably, in the above-mentioned high-reliability serial communication method for dual-machine joint control, the host further performs the following fault monitoring steps:
[0077] When the number of communication failures recorded by the host is ≥ M4, the “communication failure between the host and the slave” is set and any data transmission to the slave is stopped. M4 ≥ 10.
[0078] Preferably, the slave device further performs the following fault monitoring steps:
[0079] When the number of communication failures recorded by the slave is ≥ M5, the slave will no longer send data to the host.
[0080] M5≥10.
[0081] Example:
[0082] In a specific embodiment of the present invention, a highly reliable serial communication method for dual-machine joint control is provided. In this embodiment, the master is a satellite platform control computer (AOCC), and the slave is a payload platform control computer (PRCC).
[0083] AOCC and PRCC exchange data via RS422, wireless transmission channel, and RS422. The connection relationship between them is as follows: Figure 1 shown.
[0084] The wireless transmission module uses a "master or backup" mode, meaning only one of the master or backup modules is powered on. Therefore, only one of the transmission channels between the AOCC and PRCC is active. The data length of both the AOCC and PRCC transmissions is 255 bytes.
[0085] (1) Status of AOCC primary and backup communication channels
[0086] AOCC uses both the main and backup transmit FIFOs to send data outwards;
[0087] AOCC simultaneously queries the data status in the main and standby receive FIFOs;
[0088] (2) Status of PRCC master and backup communication channels
[0089] PRCC uses both the main and standby transmit FIFOs to send data outwards;
[0090] PRCC simultaneously queries the data status in the main and standby receive FIFOs;
[0091] Both the AOCC and the PRCC use the primary and backup transmit FIFOs to send data outward, and also query the data status in the primary and backup receive FIFOs at the beginning and end of Task 1 of their control cycles.
[0092] The establishment of a communication task, the cancellation of a communication task, and the handling of communication failures in the embodiment are described in detail below.
[0093] 1. Establishment of communication tasks
[0094] (1) Step 1:
[0095] After the AOCC is powered on and initialized, the receive FIFO and transmit FIFO are cleared; no data is sent to or received from the PRCC; the AOCC is initialized to not start the autonomous query diagnostic task.
[0096] (2) Step 2:
[0097] After the PRCC is powered on and initialized, the receive FIFO and transmit FIFO are cleared, and then the autonomous query diagnostic task is started;
[0098] (3) Step 3:
[0099] The AOCC starts the communication task with the PRCC through data instructions (i.e., starts the receiving and sending tasks at the same time), writes the information indicating that "communication task with PRCC has been established" into the first specific data bit of the data sent to the slave, and at the same time, starts the autonomous query diagnosis task;
[0100] (4) Step 4:
[0101] When the PRCC receives the correct AOCC protocol data for the first time and parses it to obtain the information indicating that "a communication task has been established with the slave", it starts the communication task with the AOCC.
[0102] (5) Step 5:
[0103] When communicating, the AOCC and PRCC independently transmit data to each other: the AOCC sends data such as data acquisition instructions and control parameter injection to the PRCC every cycle; the PRCC sends data such as its telemetry data to the AOCC every cycle. According to the preset communication protocol, the master and slave devices each send a single data frame of a preset fixed length to each other during each local control cycle.
[0104] (6) Step 6:
[0105] After starting the communication task, AOCC queries the data sent by PRCC at the beginning and middle of its control cycle respectively; and regardless of whether there is a communication task or not, PRCC queries the data sent by AOCC at the beginning and middle of its control cycle respectively. The timing relationship between AOCC sending data and the two query tasks and PRCC sending data and the two query tasks is as follows Figure 2 shown.
[0106] If the AOCC or PRCC finds that the data length in the receive FIFO is ≥ 255 bytes, the data in the receive FIFO is read. Otherwise, it is considered that data transmission is in progress and no reading is performed. When the data length is 255, the retrieved data is parsed. When the data length is greater than 255, the receive FIFO is cleared by reading the data in the receive FIFO, and the read data is not parsed.
[0107] When the data sent by AOCC (PRCC) in the previous cycle, after two queries by PRCC (AOCC) in this cycle, if "data length is 0 bytes < receive FIFO data length < 255 bytes", the data in the receive FIFO will not be read (that is, the data in the receive FIFO will be cleared). At this time, AOCC (PRCC) in this cycle still executes the sending task, then the data length in the receive FIFO of PRCC (AOCC) will gradually increase and fill up the receive FIFO (256 bytes), but at this time the data in the receive FIFO is unavailable (mixed with 1 byte from the previous cycle + 255 bytes from this cycle). The two query tasks of PRCC (AOCC) in the next cycle, after querying that the data in the receive FIFO is 256 bytes, perform a read operation, that is, clear the unavailable data in the receive FIFO to receive data in the new task cycle. The method proposed in the present invention utilizes the characteristics of FIFO to clear erroneous data, thereby improving the reliability of communication tasks.
[0108] In this embodiment, the communication protocol stipulates that the same characteristic data bit is used to represent the information of "communication task has been established with the slave" and "communication task has not been established with the slave". The data of this characteristic data bit is 1, which means "communication task has been established with the slave", and 0 means "communication task has not been established with the PRCC".
[0109] 2. Cancellation of communication tasks
[0110] (1) Step 1:
[0111] After receiving the "stop AOCC and PRCC communication task" data instruction, AOCC stops executing the autonomous query diagnosis task, and writes "no communication task established with PRCC" into the feature data of the next three uplink data frames sent to PRCC, and then stops sending data to PRCC.
[0112] The communication protocol stipulates that the same characteristic data bit is used to represent the information of "communication task has been established with the slave" and "communication task has not been established with the PRCC". The data of this characteristic data bit is 1, which means "communication task has been established with the slave", and 0 means "communication task has not been established with the PRCC".
[0113] (2) Step 2:
[0114] When the PRCC receives the "communication task not established with PRCC" message from the AOCC, it stops sending data information to the AOCC, but continues to perform the autonomous query diagnosis task in each control cycle: that is, it keeps the query status of its main and standby RS422 receive FIFOs unchanged.
[0115] (3) Step 3:
[0116] AOCC keeps querying the RS422 receive FIFO of the channel it uses until it confirms that its receive FIFO is empty for 6 consecutive times, then it immediately stops querying the PRCC.
[0117] Communication failure handling countermeasures:
[0118] (1) AOCC terminal
[0119] Troubleshooting 1: Collect statistics on the data status query results of the main receive FIFO and the backup receive FIFO. If either the main receive FIFO or the backup receive FIFO is empty, the receive FIFO is recorded as empty. If the receive FIFO is empty for 20 or more consecutive times, it is considered a dual-machine communication failure, and the number of communication failures is increased by 1. Otherwise, if the receive FIFO is empty, but the cumulative number of times the receive FIFO is empty is less than 20 times, the data read operation is not performed (that is, the FIFO data is not cleared), where M1 ≥ 20.
[0120] Fault handling 2: Query the data status of the main receive FIFO and the backup receive FIFO. If "0 < length of data in main receive FIFO < 255" or "0 < length of data in backup receive FIFO < 255", both are recorded as "0 < length of data in receive FIFO < 255". If the number of times of "0 < length of data in receive FIFO < 255" < M2, it is considered that data is being transmitted and no data reading operation is performed; if the number of times of "0 < length of data in receive FIFO < 255" ≥ M2 times, it is considered that there is a dual-machine communication fault, and the communication fault count is incremented by 1, where M2 ≥ 20.
[0121] Fault handling 3: Query the status of the main and backup receive FIFOs. If "the length of data in the main receive FIFO is 256" or "the length of data in the backup receive FIFO is 256", both are recorded as "the length of data in the receive FIFO is 256". If the number of times of "the length of data in the receive FIFO is 256 bytes" < 10 times, read 256 bytes of data in the FIFO (i.e., clear the FIFO data), but do not perform parsing; at the same time, start recording communication faults.
[0122] Fault handling 4: When it is queried that "there is data in both the main and backup receive FIFOs", and in the 255 bytes of data returned by PRCC, if the frame header or checksum is incorrect, record a communication fault.
[0123] Fault handling 5: When the continuous "communication fault count" ≥ 10 times, set "communication between AOCC and PRCC fails", and stop sending any data to PRCC.
[0124] (2) PRCC side
[0125] Fault handling 1: Statistically analyze the query results of the data status of the main receive FIFO and the backup receive FIFO. If either the main receive FIFO or the backup receive FIFO is empty, record that the receive FIFO is empty. If the receive FIFO being empty continuously appears and accumulatively is greater than or equal to 20 times, it is considered that there is a dual-machine communication fault, and the communication fault count is incremented by 1; otherwise, if the receive FIFO is empty, but the accumulative number of times the receive FIFO is empty is less than 20 times, no data reading operation is performed (i.e., do not clear the FIFO data), where M1 ≥ 20.
[0126] Fault handling 2: Query the data status of the main receive FIFO and the backup receive FIFO. If "0 < length of data in main receive FIFO < 255" or "0 < length of data in backup receive FIFO < 255", both are recorded as "0 < length of data in receive FIFO < 255". If the number of times of "0 < length of data in receive FIFO < 255" < M2, it is considered that data is being transmitted and no data reading operation is performed; if the number of times of "0 < length of data in receive FIFO < 255" ≥ M2 times, it is considered that there is a dual-machine communication fault, and the communication fault count is incremented by 1, where M2 ≥ 20.
[0127] Fault handling 3: Query the status of the main and backup receive FIFOs. If "the length of data in the main receive FIFO is 256" or "the length of data in the backup receive FIFO is 256", both are recorded as "the length of data in the receive FIFO is 256". If the number of times of "the length of data in the receive FIFO is 256 bytes" < 10 times, read 256 bytes of data in the FIFO (i.e., clear the FIFO data), but do not perform parsing; at the same time, start recording communication faults.
[0128] Fault handling 4: When it is queried that "there is data in both the main and backup receive FIFOs", and in the 255 bytes of data returned by PRCC, if the frame header or checksum is incorrect, record a communication fault.
[0129] Fault handling 5: When the "continuous communication fault count" ≥ 10 times, PRCC no longer returns numbers to AOCC and waits for AOCC to set the communication failure state.
[0130] In summary, compared with the existing serial communication method and fault handling method, a highly reliable serial communication mechanism for dual-machine joint control proposed by the present invention has the following creativity:
[0131] (1) Adopt main and backup dual channels for data sending and receiving;
[0132] (2) Query the data in the FIFO twice per cycle to avoid incomplete data reception, as Figure 2 shown;
[0133] (3) When the data in the receive FIFO is incomplete (less than 255 bytes), do not read the data, that is, do not clear the data in the FIFO, avoiding incomplete reading caused by reading during data transmission;
[0134] (4) When the data in the receive FIFO is 256 bytes, read the data but do not parse it. Reading the data clears the data in the FIFO to prepare for correct data reception in the FIFO in the next cycle.
[0135] Typically, when a serial communication failure occurs, a computer is used to disconnect the satellite. The highly reliable serial communication mechanism for dual-satellite joint control proposed in this invention avoids the risk of satellite loss of control due to disconnection, and offers high reliability and safety.
[0136] Although the present invention has been disclosed above in terms of preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art may make possible changes and modifications to the technical solutions of the present invention by using the methods and technical contents disclosed above without departing from the spirit and scope of the present invention. Therefore, any simple modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solutions of the present invention shall fall within the scope of protection of the technical solutions of the present invention.
Claims
1. A highly reliable serial communication method for dual-machine joint control, wherein the dual machines are a master and a slave, each of which is provided with a transmit FIFO and a receive FIFO, and the master and the slave have the same control cycle length but operate asynchronously, characterized in that The steps include: S1. After the host is powered on and initialized, the receive FIFO and transmit FIFO are cleared; S2: After the slave is powered on and initialized, it clears the receive FIFO and transmit FIFO and starts the autonomous query diagnostic task; S3. The host starts the communication task with the slave. According to the preset communication protocol, the host writes the information indicating that the communication task with the slave has been established into the characteristic data bit of the data sent to the slave. At the same time, the autonomous query diagnosis task is started. S4. After the slave receives the data for the first time and parses it to obtain the information indicating that "communication task with the slave has been established", it starts the communication task with the master. After that, in each local control cycle, the master and slave cyclically execute the following communication tasks and autonomous query and diagnosis tasks: The communication task is: the master and the slave send a single data frame of preset fixed length to each other according to the preset communication protocol in each local control cycle; The autonomous query diagnostic task is: the master and slave query the data in the receive FIFO at least twice in each local control cycle, and perform the following data processing based on the query results: When the data length in the receive FIFO is found to be greater than the preset fixed length, the receive FIFO is cleared by reading the data in the receive FIFO without parsing the read data; When the data length in the receive FIFO is equal to the preset fixed length, the receive FIFO is cleared by reading the data in the receive FIFO and the read data is parsed; When it is found that the data length in the receive FIFO is less than the preset fixed length, it is considered that the data is being transmitted and no operation is performed on the receive FIFO.
2. A high-reliability serial communication method for dual-machine joint control according to claim 1, characterized in that It also includes the steps for communication task cancellation: S7. After receiving the external input "stop the communication task between the master and the slave" data instruction, the master stops executing the autonomous query diagnosis task, writes the information indicating "no communication task with the slave" in the characteristic data bits of the next three data sent to the slave, and then stops sending data to the slave; S8: After receiving the "communication task with the slave not established" message from the master, the slave stops sending data to the master, but continues to perform the autonomous query and diagnosis task in each control cycle; S8. The host queries the data status of the receiving FIFO in each control cycle until it confirms that the standby receiving FIFO is empty for N consecutive times, then immediately stops executing the autonomous query diagnosis task, where N is greater than or equal to 6.
3. A high-reliability serial communication method for dual-machine joint control according to claim 2, characterized in that The communication protocol stipulates that the same characteristic data bit is used to represent the information of "communication task has been established with the slave" and "communication task has not been established with the slave". The data of this characteristic data bit is 1, which means "communication task has been established with the slave", and 0, which means "communication task has not been established with the slave".
4. A highly reliable serial communication method for dual-machine joint control according to any one of claims 1 to 3, characterized in that The host and slave both use master and backup dual channels to send and receive data, specifically: The host uses the main and standby transmit FIFOs to send data outward at the same time; The host queries the data in the main and standby receive FIFOs at the same time and processes the data according to the query results; The slave uses the master and standby transmit FIFOs to send data out simultaneously; The slave device queries the data in the master and standby receive FIFOs simultaneously and processes the data according to the query results.
5. A high-reliability serial communication method for dual-machine joint control according to claim 4, characterized in that The master and slave also perform the following fault monitoring steps: S3.
1. Statistically analyze the query results of the data status of the primary receive FIFO and the backup receive FIFO. If both the primary receive FIFO and the backup receive FIFO are empty, record that the receive FIFO is empty. If the situation that the receive FIFO is empty occurs continuously and accumulatively is greater than or equal to M1 times, it is considered that there is a dual-machine communication failure, and the communication failure count is incremented by 1; Otherwise, if the receive FIFO is empty, but the cumulative number of times the receive FIFO is empty is less than M1 times, no data reading operation is performed, where M1≥20. If the receive FIFO is not empty, the number of times the receive FIFO is empty is cleared.
6. A highly reliable serial communication method for dual-machine joint control according to claim 4, characterized in that The host and the slave also perform the following fault monitoring steps: Query the data status of the primary receive FIFO and the backup receive FIFO. If "0 < the data length of the primary receive FIFO < the preset fixed length" or "0 < the data length of the backup receive FIFO < the preset fixed length", both are recorded as "0 < the data length of the receive FIFO < the preset fixed length". If the number of times of "0 < the data length of the receive FIFO < the preset fixed length" < M2, it is considered that data is being transmitted, and no data reading operation is performed; when the number of times of "0 < the data length of the receive FIFO < the preset fixed length" ≥ M2 times, it is considered that there is a dual-machine communication failure, and the communication failure count is incremented by 1, where M2≥20.
7. A high-reliability serial communication method for dual-machine joint control according to claim 4, characterized in that The host and the slave also perform the following fault monitoring steps: Query the data status of the primary receive FIFO and the backup receive FIFO. If "the data length of the primary receive FIFO is greater than the preset fixed length" or "the data length of the backup receive FIFO is greater than the preset fixed length", both are recorded as "the data length of the receive FIFO is greater than the preset fixed length". If the number of times of "the data length of the receive FIFO is greater than the preset fixed length" < M3, read all the data in the receive FIFO and clear the data in the receive FIFO, but do not perform parsing; if the number of times of "the data length of the receive FIFO is greater than the preset fixed length" ≥ M3, no data reading operation is performed, it is considered that there is a dual-machine communication failure, and the communication failure count is incremented by 1, where M3≥10.
8. A high-reliability serial communication method for dual-machine joint control according to claim 4, characterized in that The host and the slave also perform the following fault monitoring steps: Query the data status of the primary receive FIFO and the backup receive FIFO. If "the data length in the primary receive FIFO is a fixed length" or "the data length in the backup receive FIFO is a fixed length", both are recorded as "the data length in the receive FIFO is a fixed length". When "the data length in the receive FIFO is a fixed length", check whether the frame header or the checksum is correct. If it is incorrect, it is considered that there is a dual-machine communication failure, and the communication failure count is incremented by 1. Otherwise, parse the data in the corresponding primary receive FIFO or backup receive FIFO, and clear the communication failure count.
9. A high-reliability serial communication method for dual-machine joint control according to claim 4, characterized in that The host also performs the following fault monitoring steps: When the communication failure count recorded by the host ≥ M4 times, set "the communication between the host and the slave fails", and stop sending any data to the slave, where M4≥10.
10. A high-reliability serial communication method for dual-machine joint control according to claim 4, characterized in that The slave also performs the following fault monitoring steps: When the communication failure count recorded by the slave ≥ M5 times, the slave no longer sends data to the host, where M5≥10.
Citation Information
Patent Citations
Method for quick response of asynchronous communication serial port instruction for satellite-borne electronic equipment
CN106649184A
Master-slave serial port communication method based on timing interruption triggering
CN110032532A