Heartbeat abnormity recovery method based on CANOPEN

By implementing automated heartbeat error handling tasks in the CANopen protocol stack and processing them according to the node status, the problem of manually handling node exceptions in the existing technology is solved, and the node's automated recovery and self-restoration capabilities are realized.

CN119254821AActive Publication Date: 2025-01-03TIANJIN JINHANG COMP TECH RES INST
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411470869.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-21
Publication Date
2025-01-03
Estimated Expiration
2044-10-21

AI Technical Summary

Technical Problem

In the CANopen protocol stack, the slave heartbeat cannot be received due to bus interference or hardware errors. The existing technology can only provide error status through callback functions, which requires manual processing and lacks an automated recovery mechanism.

Method used

A CANOPEN heartbeat exception recovery method is provided. By implementing the master station heartbeat error handling function, creating heartbeat error handling tasks, and automatically processing according to the node status, including querying the node status, configuring node parameters and setting timing callback functions to restore the node status.

Benefits of technology

The nodes are automatically re-operated, reducing manual intervention and improving the system's self-resilience ability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119254821A_ABST
    Figure CN119254821A_ABST
Patent Text Reader

Abstract

The invention discloses a heartbeat abnormity recovery method based on a CANOPEN, and the method comprises the steps: S1, achieving a master station heartbeat error processing function masterheartbeatError, and enabling a pointer of the function to be assigned to a heartbeat error heartbeatError pointer under an object dictionary pointer OD; s2, creating a heartbeat error processing task in the masterheartbeatError processing function by using an rtthread creation task creating function, and after the task is successfully created, starting the heartbeat error processing task by using an rtthread start function; s3, a getNodeState function is used for obtaining the current node state, the function parameter is a node value nodeId, the obtained value is judged, and different processing is carried out according to different return states. According to the method, the node state is judged in the callback function of the standard canopen protocol stack, the node operation is carried out according to the current node state, and the re-online operation of the node is completed under the condition that manual operation is not needed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of computer control and relates to a heartbeat abnormality recovery method based on CANOPEN. Background Art

[0002] CANopen communication is a form of communication based on the CAN data link layer. This communication method has relevant provisions for the application layer. The CANopen device model includes the communication part, object dictionary and application part. The communication part includes PDO objects, SDO objects and NMT objects. The object dictionary includes data types, communication objects and application objects.

[0003] The advantages of the CANOPEN protocol include high efficiency, precise positioning, anti-interference, versatility, easy configuration, high efficiency of data transmission, flexible configuration and status query functions, open standards, high data security, and secure communication constraints. Summary of the invention

[0004] 1. Technical issues to be resolved

[0005] During the use of the CANopen protocol stack, the master station cannot receive the slave station heartbeat due to bus interference, hardware errors and other reasons, resulting in errors. The CANopen standard protocol stack only provides a callback function, in which the error status is provided by a message. After the error occurs, it can only be processed manually. The present invention provides a CANOPEN heartbeat abnormality recovery method to further process the error.

[0006] (II) Technical solution

[0007] In order to solve the above technical problems, the present invention provides a CANOPEN-based heartbeat abnormality recovery method comprising the following steps:

[0008] S1: Implement the master station heartbeat error processing function master_heartbeatError, and assign this function pointer to the heartbeat error heartbeatError pointer under the object dictionary pointer OD.

[0009] S2 uses the rt_thread_create task creation function in the master_heartbeatError processing function to create a heartbeat error processing task. After the task is successfully created, the rt_thread_startup function is used to start the heartbeat error processing task.

[0010] S3: Use the getNodeState function to obtain the current node status. The function parameter is the node value nodeId. Determine the obtained value and perform different processing according to different return statuses. The processing cycle is the heartbeat consumer time CONSUMER_HEARTBEAT_TIME.

[0011] Different return statuses are handled differently, including the following five situations:

[0012] S31: If the node state value is the uncertain state Unknown_state, the masterRequestNodeState function is used to query the node state. The function sends a node guardian request instruction for forced query. The query result is updated to the system state. The next time the getNodeState function is called, the latest state can be obtained.

[0013] S32: If the node status value is Disconnected, the masterRequestNodeState function is used to query the node status. The function sends a node guard request instruction for forced query. The query result is updated to the system status. The next time the getNodeState function is called, the latest status can be obtained.

[0014] S33: If the node state is the pre-operational state Pre_operational, the producer heartbeat processing is restored, and the process is as follows:

[0015] S33_1 uses the getState function to determine whether the master station status is stopped, otherwise exits the operation and continues to determine whether the producer heartbeat time ProducerHeartBeatTime is set to not 0. The timing setting function SetAlarm is used to set the timing time to ProducerHeartBeatTime. The timing callback function is the heartbeat generation function ProducerHeartbeatAlarm. The master station status is set to the operational state Operational through the setState function.

[0016] S33_2 sets the node to the startup state by calling the master station's NMT state change function masterSendNMTstateChange.

[0017] S33_3 configures the node, writes slave index 0x6040 through SDO operation, and writes data 0x80 to sub-index 0 to clear the slave fault. Use SDO to configure the node parameters one by one.

[0018] S34: If the node state is the initialization state, it means that the node is in the power-on process after power failure, and step S3 is repeated to continue the judgment.

[0019] S35: If the node state is the operational state, repeat step S3 to continue judging.

[0020] (III) Beneficial effects

[0021] The CANOPEN heartbeat abnormality recovery method provided by the above technical solution determines the node status in the standard canopen protocol stack callback function, performs node operations according to the current node status, and completes the node re-online operation without manual operation. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 The present invention is a flow chart of the abnormal heartbeat recovery method based on CANOPEN. DETAILED DESCRIPTION

[0023] In order to make the purpose, content and advantages of the present invention more clear, the specific implementation methods of the present invention are further described in detail below in conjunction with the drawings and examples.

[0024] Reference Figure 1 As shown, the abnormal heartbeat recovery method based on CANOPEN in this embodiment includes the following steps:

[0025] S1: Implement the master station heartbeat error processing function master_heartbeatError, and assign this function pointer to the heartbeat error heartbeatError pointer under the object dictionary pointer OD.

[0026] S2 uses the rt_thread_create task creation function in the master_heartbeatError processing function to create a heartbeat error processing task. After the task is successfully created, the rt_thread_startup function is used to start the heartbeat error processing task.

[0027] S3: Use the getNodeState function to obtain the current node status. The function parameter is the node value nodeId. Determine the obtained value and perform different processing according to different return statuses. The processing cycle is the heartbeat consumer time CONSUMER_HEARTBEAT_TIME.

[0028] Different return statuses are handled differently, including the following five situations:

[0029] S31: If the node state value is the uncertain state Unknown_state, the masterRequestNodeState function is used to query the node state. The function sends a node guardian request instruction for forced query. The query result is updated to the system state. The next time the getNodeState function is called, the latest state can be obtained.

[0030] S32: If the node status value is Disconnected, the masterRequestNodeState function is used to query the node status. The function sends a node guard request instruction for forced query. The query result is updated to the system status. The next time the getNodeState function is called, the latest status can be obtained.

[0031] S33: If the node state is the pre-operational state Pre_operational, the producer heartbeat processing is restored, and the process is as follows:

[0032] S33_1 uses the getState function to determine whether the master station status is stopped, otherwise exits the operation and continues to determine whether the producer heartbeat time ProducerHeartBeatTime is set to not 0. The timing setting function SetAlarm is used to set the timing time to ProducerHeartBeatTime. The timing callback function is the heartbeat generation function ProducerHeartbeatAlarm. The master station status is set to the operational state Operational through the setState function.

[0033] S33_2 sets the node to the startup state by calling the master station's NMT state change function masterSendNMTstateChange.

[0034] S33_3 configures the node, writes slave index 0x6040 through SDO operation, and writes data 0x80 to sub-index 0 to clear the slave fault. Use SDO to configure the node parameters one by one.

[0035] S34: If the node state is the initialization state, it means that the node is in the power-on process after power failure, and step S3 is repeated to continue the judgment.

[0036] S35: If the node state is the operational state, repeat step S3 to continue judging.

[0037] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A heartbeat abnormality recovery method based on CANOPEN, characterized in that: The following steps are involved: S1: Implement the master station heartbeat error handling function master_heartbeatError, and assign this function pointer to the heartbeat error heartbeatError pointer under the object dictionary pointer OD; S2 uses the rt_thread_create task creation function in the master_heartbeatError processing function to create a heartbeat error processing task. After the task is successfully created, the rt_thread_startup function is used to start the heartbeat error processing task. S3: Use the getNodeState function to obtain the current node status. The function parameter is the node value nodeId. Determine the obtained value and perform different processing according to different return states.

2. The CANOPEN-based heartbeat abnormality recovery method according to claim 1, characterized in that: In step S3, the processing period is the heartbeat consumer time CONSUMER_HEARTBEAT_TIME.

3. The CANOPEN-based heartbeat abnormality recovery method according to claim 2, characterized in that: In step S3, different return states are processed differently, including five situations.

4. The CANOPEN-based heartbeat abnormality recovery method as claimed in claim 3, characterized in that: In step S3, if the node state value is the uncertain state Unknown_state, the masterRequestNodeState function is used to query the node state. The function sends a node guardian request instruction for forced query. The query result is updated to the system state. The getNodeState function is called next time to obtain the latest state.

5. The CANOPEN-based heartbeat abnormality recovery method according to claim 3, characterized in that: In step S3, if the node status value is disconnected, the masterRequestNodeState function is used to query the node status. The function sends a node guardian request instruction for forced query. The query result is updated to the system status. The getNodeState function is called next time to obtain the latest status.

6. The CANOPEN-based heartbeat abnormality recovery method as claimed in claim 3, characterized in that: In step S3, if the node state is the pre-operational state Pre_operational, the producer heartbeat process is restored.

7. The CANOPEN-based heartbeat abnormality recovery method according to claim 6, characterized in that: In step S3, the process of restoring the producer heartbeat is as follows: S33_1 uses the getState function to determine whether the master station state is in the stopped state, otherwise exits the operation, continues to determine whether the producer heartbeat time ProducerHeartBeatTime is set to not 0, uses the timing setting function SetAlarm to set the timing time to ProducerHeartBeatTime, and the timing callback function is the heartbeat generation function ProducerHeartbeatAlarm. Sets the master station state to the operational state Operational through the setState function; S33_2 sets the node to the startup state by calling the master station's NMT state change function masterSendNMTstateChange; S33_3 configures the node, writes slave index 0x6040 through SDO operation, and writes data 0x80 to sub-index 0 to clear the slave fault. Use SDO to configure the node parameters one by one.

8. The CANOPEN-based heartbeat abnormality recovery method according to claim 3, characterized in that: In step S3, if the node state is the initialization state, it means that the node is in the power-on process after being powered off, and step S3 is repeated to continue the judgment.

9. The CANOPEN-based heartbeat abnormality recovery method according to claim 3, characterized in that: In step S3, if the node state is the operational state, step S3 is repeated to continue the judgment.

10. An application of the CANOPEN-based heartbeat abnormality recovery method according to any one of claims 1 to 9 in the field of computer control technology.

Citation Information

Patent Citations

  • Train network data transmission method, system and device based on CANopen protocol

    CN109104349A

  • A CANopen mast and slave station reliability control method and an overall manager thereof

    CN109245979A

  • CANOPEN-based multi-motor servo system initialization configuration method

    CN117527472A

  • Multi-Node State Recovery for a Communication Network

    US20100284269A1