Satellite-borne load CAN bus error processing method
By designing the CAN bus error handling method in the satellite load, monitoring and handling the CAN bus error status, the long-term occupation problem caused by failure is solved, the rapid recovery and normal communication of the CAN bus are achieved, and the risk of on-satellite failure is reduced.
Patent Information
- Application Number
- CN202510146981.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-11
- Publication Date
- 2025-03-14
AI Technical Summary
Due to failure, the CAN bus control rights are occupied for a long time, resulting in the CAN bus being unable to resume normal communication on its own, affecting the development of various payload tasks on the star.
A satellite-loaded load CAN bus error processing method is designed, and the CAN data frame processing module, CAN controller monitoring module and CAN bus error processing module in CAN communication software are used to determine and process the CAN bus error status. The method includes monitoring the CAN bus communication status, distinguishing different error statuses, and adopting corresponding processing methods to restore normal CAN bus communication.
By quickly restoring CAN bus communication, it is avoided that the non-responsive CAN communication during the satellite load operation or long-term occupation of bus resources is reduced, and the risk of on-site failures is reduced.
Smart Images

Figure CN119628996A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of satellite-borne payload CAN bus error processing, and in particular relates to a satellite-borne payload CAN bus error processing method. Background Art
[0002] CAN bus is currently a common communication method between satellite payloads on the entire satellite platform. The satellite payload will receive periodic polling telemetry requests from the CAN bus, adjust the remote control instructions of the onboard mission, update the program parameter injection package and broadcast data, etc.; it will also send the telemetry data of the payload's own observation status and command response frames to the CAN bus. In order to avoid frequent message conflicts on the bus, the entire satellite platform will reasonably arrange the time intervals of each data frame to ensure that they do not interfere with each other.
[0003] Under normal circumstances, the satellite-borne payload will seize the control of the CAN bus during the communication period, and exit the bus occupation state after the data is sent, so that other satellite-borne payloads can continue to compete for the control of the CAN bus. If there is a software or hardware failure in the satellite-borne payload CAN controller, causing a data frame to be repeatedly transmitted on the CAN bus and always occupying the bus control, the data communication between other satellite-borne payloads will not be able to proceed normally, which will directly affect the work tasks of each payload on the satellite. Summary of the invention
[0004] In view of this, the present invention aims to propose a satellite-borne payload CAN bus error handling method to solve the problem that the bus control is occupied for a long time due to a fault of the satellite-borne payload and the CAN bus cannot restore normal communication by itself.
[0005] To achieve the above object, the technical solution of the present invention is achieved as follows: A satellite-borne payload CAN bus error processing method is implemented by CAN communication software, wherein the CAN communication software includes a CAN data frame processing module, a CAN controller monitoring module and a CAN bus error processing module, wherein the CAN controller monitoring module communicates bidirectionally with the CAN data frame processing module and the CAN bus error processing module respectively, and the CAN data frame processing module and the CAN bus error processing module both change the CAN bus occupancy state; The CAN bus error handling method includes the following steps: S1, the CAN data frame processing module receives the CAN data frame that matches the station address ID number from the CAN bus, determines the type of the CAN data frame and returns the corresponding CAN response frame; S2. During the CAN data frame receiving and sending phase, the CAN controller monitoring module monitors the CAN bus communication status of the payload and feedbacks the errors occurring on the current bus through the CAN bus error handling module. S3. The CAN bus error processing module can distinguish different error states and take different processing methods for the CAN controller monitoring module to restore the normal communication of the CAN bus.
[0006] Further, in step S1 and step S2, the CAN data frame processing module processes the received CAN data frame by setting a buffer area; The CAN controller monitoring module works in the CAN receiving interrupt function and the timer interrupt processing function to ensure that the CAN bus communication monitoring state is in place during the processing of CAN data frame reception and transmission and during communication idle periods.
[0007] Further, in step S2, when the CAN communication software is interrupted, the CAN communication software processing strategy includes: The transmission information on the CAN bus is filtered by the filter to filter the CAN data frames that meet the station ID address, and the CAN receive interrupt function writes the CAN data frames that meet the filtering requirements into the CAN receive buffer; In the timer interrupt function, the data frame in the CAN receiving buffer is read, and the frame data type is determined by the data code or ID number to be a telemetry request frame, a remote control command frame, a broadcast frame, or a program parameter injection packet; For the received telemetry request frames and remote control command frames, the CAN communication software sends telemetry data and command response frames to the CAN bus. If the CAN controller recognizes that a data frame fails to be sent, it automatically resends the data frame. The CAN controller monitoring module can monitor the REC receive error count value every time the CAN receive interrupt function processes the CAN data frame. During the period when no data is received, the timer setting continuously monitors the TEC send error count value to detect whether the bus is occupied. Read the CAN bus error status register, combine the TEC and REC error count values, and assign the detected CAN bus error type to the same error flag; The CAN bus error processing module reads the output error flag, distinguishes the current CAN bus error state, and uses different processing methods to restore the CAN controller to a normal state.
[0008] Furthermore, in step S3, the CAN bus error handling module distinguishes different CAN bus communication error types by reading the CAN bus error flag, initializes the peripherals of the CAN communication software after maintaining the set fault tolerance time, and restores the CAN controller communication of the CAN controller monitoring module to normal.
[0009] Furthermore, the CAN bus error handling module uses different processing methods to restore the normal communication of the CAN bus, including: The CAN bus error processing module can read the error flag after the CAN controller monitoring module outputs the error flag each time; Obtain the current bus error type from the CAN bus error flag, determine the cause of the current CAN bus communication anomaly in combination with the TEC and REC error counts, and take different processing methods to restore the normal operation of the CAN controller. If TEC is greater than 255 and the bus-off flag is set, the CAN bus error type is determined to be a bus-off error. After a waiting time interval of 1s, the CAN controller is initialized and data frames continue to be received in the CAN interrupt function. If TEC is greater than 127 and the response error flag is set, the CAN bus error type is judged as a CAN bus response error. The data receiver on the CAN bus does not reply to the response. To prevent the CAN controller from repeatedly sending the same data frame, clear all the sending mailboxes of the CAN controller, reset the peripheral configuration of the CAN communication software, stop the CAN sending task, release the CAN bus control right, wait for a time interval of 2s, and then initialize the CAN controller to wait for the CAN data frame of the station ID to be received; If there is a filling error during filling coding or a CRC error during data verification, the CAN controller initialization operation is performed directly; If the CAN bus error flag is judged as no error type, the CAN bus error processing module does not process it and continues to read the error flag when the next interrupt occurs.
[0010] Furthermore, the CAN data frame processing module is used to process the received CAN data frames and works in the timer interrupt function. After frame ID filtering, the data frames entering the CAN receive interrupt function will be stored in the CAN data buffer area. The CAN data frame processing module will read the stored data frames therefrom within the set time interval. According to the arbitration field and data field information in the data frame, the CAN data frame processing module determines whether the read data frame is a telemetry request frame or a remote control command frame, and replies with a telemetry data frame or a command response frame to the CAN bus. During the data frame sending process, if the sending fails due to CAN bus competition or no response from the receiving end, the data frame is automatically resent.
[0011] Furthermore, the CAN controller monitoring module is used to monitor the working status of the CAN controller and output the CAN bus error flag in time. During the sending and receiving of CAN data frames, the CAN controller monitoring module will continuously count the error counter REC and TEC values, read the status flag bit of the CAN error status register, and combine the error code LEC of the CAN bus itself to output the error flag of the CAN bus communication status.
[0012] Furthermore, the CAN bus error processing module classifies and processes faults according to the CAN bus error flag. The CAN bus error processing module reads the error flag output by the CAN controller monitoring module, determines the current working status of the CAN controller and the cause of the error. If the current CAN controller stops data receiving and sending operations, it is confirmed that a bus shutdown error has occurred, and the CAN controller is initialized after a waiting time interval of 1 second. If it is an answer error caused by the receiving end having no answer during the sending process, the sending mailbox of the CAN controller is cleared, the CAN peripheral configuration is reset, and the CAN controller is reinitialized after a waiting time interval of 2 seconds. If it is a filling error during filling coding or a CRC error in data verification, the CAN controller initialization operation is performed directly.
[0013] Compared with the prior art, the satellite-borne payload CAN bus error processing method described in the present invention has the following advantages: (1) A satellite payload CAN bus error processing method described in the present invention clarifies the judgment conditions of the satellite payload CAN bus error status, and quickly restores the CAN bus communication to normal through different bus error processing methods, thereby avoiding the satellite payload not responding to CAN communication or occupying bus resources for a long time during operation, and reducing the risk of onboard faults.
[0014] (2) In the satellite payload CAN bus error processing method described in the present invention, the CAN controller monitoring module of the present invention comprehensively determines the current bus error state by reading the CAN error state register state and the error counter count value; multiple CAN bus error states are superimposed into the same error flag, and the error flag is output in a timely manner.
[0015] (2) A satellite payload CAN bus error processing method described in the present invention, and a CAN bus error processing module of the present invention can clear the data in the sending mailbox, stop frequently sending the same data frame to the CAN bus, and exit the CAN bus occupation state. Different delay strategies are used to restore the normal working state of the CAN bus controller to avoid short-term interference or false triggering causing reset operations. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The accompanying drawings constituting a part of the present invention are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the accompanying drawings: Figure 1 It is a principle block diagram of CAN communication software of the error handling method described in an embodiment of the present invention; Figure 2 This is a schematic diagram of the CAN communication software interrupt processing flow according to an embodiment of the present invention; Figure 3The figure is a schematic diagram of a CAN bus error handling process according to an embodiment of the present invention. DETAILED DESCRIPTION
[0017] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.
[0018] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and the like are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first", "second", and the like may explicitly or implicitly include one or more of the features. In the description of the present invention, unless otherwise specified, "multiple" means two or more.
[0019] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood by specific circumstances.
[0020] The present invention will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.
[0021] like Figures 1 to 3 As shown, a satellite-borne payload CAN bus error processing method is implemented by CAN communication software, and the CAN communication software includes a CAN data frame processing module, a CAN controller monitoring module and a CAN bus error processing module.
[0022] In a preferred embodiment of the present invention, the CAN data frame processing module receives a data frame that matches the station address ID number from the CAN bus, determines the type of the data frame and returns a corresponding response frame. During the CAN data frame receiving and sending phase, the CAN controller monitoring module monitors the communication status of the CAN bus mounted with the payload and promptly feeds back errors that occur on the current bus. The CAN bus error processing module can distinguish different error states and take different processing methods for the CAN controller to restore normal bus communication.
[0023] In a preferred embodiment of the present invention, the CAN data frame processing module processes the received CAN data frames by setting a buffer area to prevent frame leakage. The CAN controller monitoring module works in the CAN receiving interrupt function and the timer interrupt processing function to ensure that the CAN bus communication monitoring state is in place during the processing of CAN data frame reception and transmission and during communication idle periods. The software interrupt processing flow chart is shown in FIG. Figure 2 As shown, the dotted box is the CAN controller monitoring module, and the specific implementation strategy is: (1) The transmission information on the CAN bus is filtered by the filter to filter the CAN data frames that meet the station ID address, and the CAN interrupt function writes the data that meets the filtering requirements into the CAN receive buffer; (2) In the timer interrupt function, the data frame in the CAN receive buffer is read, and the frame data type is determined by the data code or ID number to be a telemetry request frame, remote control command frame, broadcast frame, or program parameter injection packet.
[0024] (3) For the received telemetry request frames and remote control command frames, the software sends telemetry data and command response frames to the CAN bus. If the CAN controller recognizes that a data frame fails to be sent, it automatically resends the data frame.
[0025] (4) The CAN controller monitoring module monitors the REC receive error count value every time the CAN receive interrupt function processes a CAN data frame. During the period when no data is received, the TEC send error count value is continuously monitored through the timer setting to promptly detect whether the bus is occupied for a long time.
[0026] (5) Read the CAN bus error status register, combine the TEC and REC error count values, and assign the detected CAN bus error type to the same error flag.
[0027] (6) The CAN bus error processing module reads the output error flag, distinguishes the current CAN bus error status, and uses different processing methods to restore the CAN controller to normal status.
[0028] In a preferred embodiment of the present invention, a CAN bus error handling module is provided, which distinguishes different types of CAN bus communication errors by reading the CAN bus error flag, initializes the CAN peripherals after a certain fault tolerance time, and restores the normal communication of the CAN controller. Figure 3 As shown, the specific error handling design is as follows: (1) The CAN bus error handling module will read the error flag immediately after the CAN controller monitoring module outputs the error flag each time; (2) Obtain the current bus error type from the CAN bus error flag, and determine the cause of the current communication abnormality on the CAN bus in combination with the TEC and REC error counts, and take different processing methods to restore the normal operation of its own CAN controller.
[0029] (3) If TEC is greater than 255 and the bus-off flag is set, the CAN bus error type is determined to be a bus-off error. After waiting for a time interval of 1 (1s), the CAN controller is initialized and continues to receive data frames in the CAN interrupt function.
[0030] (4) If TEC is greater than 127 and the response error flag is set, the CAN bus error type is judged as a CAN bus response error. The data receiver on the CAN bus did not reply to the response. In order to prevent the CAN controller from repeatedly sending the same data frame, all the sending mailboxes of the CAN controller are cleared, and the CAN peripheral configuration is reset to stop the CAN sending task. Release the CAN bus control right, wait for a time interval of 2 (2s) and then initialize the CAN controller to wait for the CAN data frame of the station ID.
[0031] (5) If there is a padding error during padding coding or a CRC error during data verification, the CAN controller initialization operation is performed directly.
[0032] (6) If the CAN bus error flag is judged as no error type, the CAN bus error handling module does not process it and continues to read the error flag when the next interrupt occurs.
[0033] In a preferred embodiment of the present invention, the CAN data frame processing module is used to process the received CAN data frame and works in the timer interrupt function. After filtering by the frame id, the data frame entering the CAN receiving interrupt function will be stored in the CAN data buffer area, and the CAN data frame processing module will read the stored data frame therefrom within a certain time interval. According to the arbitration domain and data domain information in the data frame, the CAN data frame processing module determines whether the read data frame is a telemetry request frame or a remote control command frame, and replies a telemetry data frame or a command response frame to the CAN bus. During the data frame transmission process, if the transmission fails due to CAN bus competition or no response from the receiving end, the data frame is automatically resent.
[0034] In a preferred embodiment of the present invention, the CAN controller monitoring module is used to monitor the working state of the CAN controller and output the CAN bus error flag in time. During the sending and receiving of CAN data frames, the CAN controller monitoring module continuously counts the error counter REC and TEC values, reads the status flag bit of the CAN error status register, and outputs the error flag of the CAN bus communication state in combination with the error code LEC of the CAN bus itself.
[0035] In a preferred embodiment of the present invention, the CAN bus error processing module, the module classifies and processes the faults according to the CAN bus error flag. The CAN bus error processing module reads the error flag output by the CAN controller monitoring module to determine the current working state of the CAN controller and the cause of the error. If the current CAN controller stops data receiving and sending operations, it is confirmed that a bus shutdown error has occurred, and the CAN controller is initialized after waiting for a time interval of 1; if it is a response error caused by the receiving end having no response during the sending process, the sending mailbox of the CAN controller is immediately cleared, the CAN peripheral configuration is reset, and the CAN controller is reinitialized after waiting for a time interval of 2; if it is a padding error during padding coding or a CRC error in data verification, the CAN controller initialization operation is directly performed.
[0036] Advantages of the present invention: The present invention clarifies the judgment conditions of the error status of the satellite-borne payload CAN bus, and quickly restores the normal CAN bus communication through different bus error processing methods, thereby avoiding the satellite-borne payload not responding to CAN communication or occupying bus resources for a long time during operation, and reducing the risk of onboard faults.
[0037] The CAN controller monitoring module of the present invention comprehensively judges the current bus error state by reading the CAN error state register state and the error counter count value; superimposes multiple CAN bus error states into the same error flag, and outputs the error flag in time.
[0038] The CAN bus error processing module of the present invention can clear the data in the sending mailbox, stop frequently sending the same data frame to the CAN bus, and exit the CAN bus occupation state. Different delay strategies are used to restore the normal working state of the CAN bus controller to avoid short-term interference or false triggering causing reset operation.
[0039] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for handling errors of a satellite-borne payload CAN bus, characterized in that: The CAN communication software includes a CAN data frame processing module, a CAN controller monitoring module and a CAN bus error processing module. The CAN controller monitoring module communicates with the CAN data frame processing module and the CAN bus error processing module in a two-way manner. The CAN data frame processing module and the CAN bus error processing module will change the CAN bus occupancy state. The CAN bus error handling method includes the following steps: S1, the CAN data frame processing module receives the CAN data frame that matches the station address ID number from the CAN bus, determines the type of the CAN data frame and returns the corresponding CAN response frame; S2. During the CAN data frame receiving and sending phase, the CAN controller monitoring module monitors the CAN bus communication status of the payload and feedbacks the errors occurring on the current bus through the CAN bus error handling module. S3, the CAN bus error processing module can distinguish different error states and take different processing methods for the CAN controller monitoring module to restore the normal communication of the CAN bus; In step S1 and step S2, the CAN data frame processing module processes the received CAN data frame by setting a buffer area; The CAN controller monitoring module works in the CAN receiving interrupt function and the timer interrupt processing function to ensure that the CAN bus communication monitoring state is in place during the processing of CAN data frame reception and transmission and during communication idle periods.
2. A satellite-borne payload CAN bus error handling method according to claim 1, characterized in that: The CAN data frame processing module is used to process the received CAN data frames and works in the timer interrupt function. After filtering by the frame ID, the data frames entering the CAN receiving interrupt function will be stored in the CAN data buffer area. The CAN data frame processing module will read the stored data frames therefrom within the set time interval. According to the arbitration domain and data domain information in the data frame, the CAN data frame processing module determines whether the read data frame is a telemetry request frame or a remote control command frame, and replies a telemetry data frame or a command response frame to the CAN bus. During the data frame sending process, if the sending fails due to CAN bus competition or no response from the receiving end, the data frame is automatically resent.
3. A satellite-borne payload CAN bus error handling method according to claim 2, characterized in that: The CAN controller monitoring module is used to monitor the working status of the CAN controller and output the CAN bus error flag in time. During the sending and receiving of CAN data frames, the CAN controller monitoring module will continuously count the error counter REC and TEC values, read the status flag bit of the CAN error status register, and combine the error code LEC of the CAN bus itself to output the error flag of the CAN bus communication status.
4. The method for handling errors of a satellite-borne payload CAN bus according to claim 1, characterized in that: The CAN bus error processing module classifies and processes the faults according to the CAN bus error flags. The CAN bus error processing module reads the error flags output by the CAN controller monitoring module, determines the current working state of the CAN controller and the cause of the error, and if the current CAN controller stops data receiving and sending operations, confirms that a bus shutdown error occurs, and waits for a time interval of 1 second before initializing the CAN controller; If the response error is caused by the lack of response from the receiving end during the sending process, clear the sending mailbox of the CAN controller, reset the CAN peripheral configuration, wait for a time interval of 2s, and then reinitialize the CAN controller; if it is a padding error during padding coding or a CRC error in data verification, directly perform the CAN controller initialization operation.
5. The method for handling errors of a satellite-borne payload CAN bus according to claim 3, characterized in that: In step S2, when the CAN communication software is interrupted, the CAN communication software processing strategy includes: The transmission information on the CAN bus is filtered by the filter to filter the CAN data frames that meet the station ID address, and the CAN receive interrupt function writes the CAN data frames that meet the filtering requirements into the CAN receive buffer; In the timer interrupt function, the data frame in the CAN receiving buffer is read, and the frame data type is determined by the data code or ID number to be a telemetry request frame, a remote control command frame, a broadcast frame, or a program parameter injection packet; For the received telemetry request frames and remote control command frames, the CAN communication software sends telemetry data and command response frames to the CAN bus. If the CAN controller recognizes that a data frame fails to be sent, it automatically resends the data frame. The CAN controller monitoring module can monitor the REC receive error count value every time the CAN receive interrupt function processes the CAN data frame. During the period when no data is received, the timer setting continuously monitors the TEC send error count value to detect whether the bus is occupied. Read the CAN bus error status register, combine the TEC and REC error count values, and assign the detected CAN bus error type to the same error flag; The CAN bus error processing module reads the output error flag, distinguishes the current CAN bus error state, and uses different processing methods to restore the CAN controller to a normal state.
6. A satellite-borne payload CAN bus error handling method according to claim 4, characterized in that: In step S3, the CAN bus error processing module distinguishes different CAN bus communication error types by reading the CAN bus error flag, initializes the peripherals of the CAN communication software after maintaining the set fault tolerance time, and restores the CAN controller communication of the CAN controller monitoring module to normal.
7. A satellite-borne payload CAN bus error handling method according to claim 6, characterized in that: The CAN bus error handling module uses different processing methods to restore normal CAN bus communication, including: The CAN bus error processing module can read the error flag after the CAN controller monitoring module outputs the error flag each time; Obtain the current bus error type from the CAN bus error flag, determine the cause of the current CAN bus communication anomaly in combination with the TEC and REC error counts, and take different processing methods to restore the normal operation of the CAN controller. If TEC is greater than 255 and the bus-off flag is set, the CAN bus error type is determined to be a bus-off error. After a waiting time interval of 1s, the CAN controller is initialized and data frames continue to be received in the CAN interrupt function. If TEC is greater than 127 and the response error flag is set, the CAN bus error type is judged as a CAN bus response error. The data receiver on the CAN bus does not reply to the response. To prevent the CAN controller from repeatedly sending the same data frame, clear all the sending mailboxes of the CAN controller, reset the peripheral configuration of the CAN communication software, stop the CAN sending task, release the CAN bus control right, wait for a time interval of 2s, and then initialize the CAN controller to wait for the CAN data frame of the station ID to be received; If there is a filling error during filling coding or a CRC error during data verification, the CAN controller initialization operation is performed directly; If the CAN bus error flag is judged as no error type, the CAN bus error processing module does not process it and continues to read the error flag when the next interrupt occurs.
Citation Information
Patent Citations
Method for detecting a faulty node
CN102077514A
CAN bus no-response processing method and device
CN105323130A
Satellite-borne GNSS occultation load CAN bus remote control and telemetering processing method
CN118381690A
Can interface selecting one of two distinct fault recovery method after counting a predetermined number of recessive bits or good can frames
US5574848A