A method for addressing along a line based on CAN communication

By adopting an addressing method based on CAN communication, the problem of low addressing efficiency in existing technologies is solved, enabling rapid identification of device breakpoints and abnormal handling, ensuring device uniqueness, and improving addressing speed and security.

CN119766619BActive Publication Date: 2025-12-05ZHENGZHOU HENGDA INTELLIGENT CONTROL TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411438323.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-15
Publication Date
2025-12-05
Estimated Expiration
2044-10-15

AI Technical Summary

Technical Problem

Existing CAN communication addressing methods cannot quickly identify the breakpoint location when devices are connected or reconnected after a power outage, resulting in low addressing efficiency. They also cannot quickly handle power outages of the voice module, cannot generate relay nodes, and have lengthy and time-consuming unique device identification codes, leading to slow addressing speed.

Method used

The addressing method based on CAN communication is adopted. The device address is cleared by broadcasting, the addressing request is listened for, the unique identification code of the device is read, the breakpoint is detected and the breakpoint is resumed, the topology structure is generated, the anomaly reporting and information update are realized, and the heartbeat monitoring is used to ensure the stability of the device status.

Benefits of technology

It improves addressing efficiency, quickly identifies and reports device anomalies, ensures device uniqueness, supports device access and breakpoint handling, and achieves an efficient and secure addressing process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119766619B_ABST
    Figure CN119766619B_ABST
Patent Text Reader

Abstract

The application provides a line-addressing method based on CAN communication, which judges the online and offline states of devices by monitoring the heartbeats of all devices along the line, stops all operations of reading device information immediately and enters a breakpoint detection mode if a new addressing request along the line is monitored, detects a breakpoint device and immediately reports through callback notification, re-addresses from the breakpoint device, and updates device information again after the addressing is completed and reports through callback notification. The application realizes the breakpoint continuous addressing function of line devices, can quickly identify whether a new device is connected or a breakpoint device is generated during the operation of the addressing service, can make different logical processing and abnormal reporting according to different situations, and can support the quick identification and processing of abnormal restart caused by insufficient voltage or the restart of a large number of devices along the line caused by overcurrent during the addressing of the device and report.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of coal mine equipment addressing, in particular to a line addressing method based on CAN communication. BACKGROUND

[0002] The CAN line upgrading method based on analog-digital conversion can address each device along the line according to the number of devices, but if new devices are connected or old devices are disconnected and reconnected, the line needs to be addressed from the first device, and the position of the newly connected device and the disconnected and reconnected device cannot be detected, the logic is too single, and the efficiency is not high; in comparison, the present addressing logic introduces rapid detection of breakpoints generated by newly connected devices and disconnected and reconnected devices, calculates the breakpoint position and reports it, and then continues to address from the breakpoint, greatly improving the addressing and exception handling efficiency.

[0003] The existing addressing method has the following disadvantages:

[0004] 1. The current unique identification code of the device along the line is too long, which greatly occupies the addressing time and slows down the addressing speed.

[0005] 2. When new devices are connected or devices are disconnected and reconnected along the line, it is impossible to quickly calculate the breakpoint position and report it, and it is also impossible to start addressing from the breakpoint, so it is necessary to start addressing from the first device, which greatly reduces the efficiency of readdressing.

[0006] 3. If there is a relay device along the line, the node cannot be generated and reported.

[0007] 4. Since the intercom along the line is composed of an emergency stop input module and a voice module, and the voice module is powered by a battery, if the power supply along the line is abnormal or the battery is abnormal, the voice module will be powered off, and the intercom along the line will be interrupted, and the previous addressing logic cannot quickly and timely identify the offline state of the voice module of the intercom. SUMMARY

[0008] In view of the defects in the existing device addressing method, the present application provides a line addressing method based on CAN communication, which realizes the functions of line device addressing, breakpoint continuation, offline state reporting of intercom along the line, power supply abnormality reporting of line device, relay node generation and reporting, line device network information reading and reporting, and line device production information reading and reporting of a mine-used intrinsically safe control master station and a mine-used intrinsically safe control slave station.

[0009] The technical problem of the present application is solved by the following scheme: a line addressing method based on CAN communication, comprising the following steps:

[0010] Step one, broadcast empty along the device address, ensure that there is no residual device address information on the network, to avoid the subsequent addressing process conflict;

[0011] Step two, waiting for the request of along the device addressing, the device sends the request of addressing after being powered on or reset, the master station listens to the request of addressing and responds within the specified time, otherwise it may be considered as the device is not ready or there is a communication problem;

[0012] Step three, the current request device is cleared again, and then the device address is addressed, if the device requests addressing, the master station confirms that its address information has been cleared, and then allocates a new unique address for it;

[0013] Step four, read the unique device code of the current device, if the reading fails, the related exception needs to be reported, if the device code is repeated, the device restarts and tries to readdress;

[0014] Step five, open the power supply of the current device, after the addressing is completed, the power supply of the corresponding device is turned on, so that it can work normally;

[0015] Step six, handle the conflict between repeater and device, when encountering a repeater, increase the number of addressable devices, when detecting multiple master stations, report an exception;

[0016] Step seven, generate along the topology information, after the addressing is completed, the topology structure of the entire network is constructed, including the connection relationship between devices;

[0017] Step eight, read the device network information and production information, get the network configuration and production information of the device, so that the device service can correctly manage the device;

[0018] Step nine, through the listening thread, the normal heartbeat monitoring and breakpoint detection are carried out, after the device addressing is completed, the device enters the normal heartbeat monitoring mode, monitors the state of the device, and discovers that the device is offline or a new device is added, and readdressing and information updating are carried out.

[0019] Further, the response time of the master station listening to the request of addressing in step two is 3 seconds.

[0020] Further, when the device code reading fails in step four, the exception notification callback is called to report the current device exception, when the device code reading succeeds, it is judged whether the device code is repeated, if the device code is repeated, it is reported that the power supply voltage of the current device is insufficient to cause abnormal restart; when the first device code is repeated, the exception notification callback is called to report that there is an overcurrent restart exception in the current along the line.

[0021] Further, in step eight, the network information of the device includes IP address, subnet mask and gateway; the production information of the device includes production code, hardware version and module type.

[0022] Further, the listening thread in step nine receives a new device addressing request along the line, sends an interrupt signal, stops all current operations, and enters the breakpoint detection mode.

[0023] Further, in step nine, the first device is polled every 10 ms to check the heartbeat state of each device, and the device whose heartbeat is detected to be offline is the breakpoint device, which calls the readdressing notification callback to report the breakpoint address and readdress from the breakpoint.

[0024] The present application provides a CAN communication-based line addressing method, which realizes the breakpoint readdressing function of line device addressing, can quickly identify whether new devices are connected or breakpoint devices are generated during the operation of the addressing service, and can make different logical processing and abnormal reporting for different situations.

[0025] In the addressing process, the unique identification code of the line device is read to distinguish each device, thereby improving the identifiability of the addressed device, and supporting the quick identification and reporting of abnormal restart caused by insufficient voltage or a large number of line device restart faults caused by overcurrent during the addressing process.

[0026] In the present application, the addressing service updates the device information and processes and notifies various abnormal situations in the addressing process by defining the readdressing notification callback function, the device network and topology information update callback function, the device production information update callback function, the device addressing abnormal information notification callback function, the relay node generation notification callback function, and the processing logic for corresponding abnormal addressing situations, which can ensure safe and efficient completion of addressing and quick updating of device information. BRIEF DESCRIPTION OF DRAWINGS

[0027] Figure 1 is the block view of the addressing process of the present application. DETAILED DESCRIPTION

[0028] In order to make the purpose, technical scheme and advantages of the present application clearer, the technical scheme of the present application will be described in detail below.

[0029] Embodiment 1: The present application provides a CAN communication-based line addressing method, which, in the addressing process, judges the online and offline state of the device by monitoring the heartbeat of all devices along the line, stops all device information reading operations and enters the breakpoint detection mode if a new addressing request is monitored along the line, detects the breakpoint device, immediately reports through the callback notification, and readdresses from the breakpoint.

[0030] This invention enables the addressing, breakpoint continuation, offline status reporting of voice phones along the line, power supply anomaly reporting of equipment along the line, relay node generation and reporting, network information reading and reporting of equipment along the line, and production information reading and reporting of equipment along the line for intrinsically safe control master stations and intrinsically safe control substations in mines.

[0031] Before creating the microcontroller devices along the route, each device needs to be addressed so that each microcontroller has a unique address for communication with the master station. The specific addressing process is as follows:

[0032] After the master station is powered on, it can choose to turn on or off the power supply along the line. After the device service starts running, the master station in CS mode will actively turn on the power supply along the corresponding CS line. At this time, since the power supply of the downstream devices is not yet turned on, only the first device is powered on and online. If the master station is already online and needs to be addressed, it will broadcast to clear all device addresses along the line before addressing. When the microcontroller receives the address clearing command, it will clear its own address and then turn off the downstream power supply. After the microcontroller is powered on and reset or its address is cleared, it will actively send an addressing request to the CAN bus because it has no address. After the master station receives the addressing request, it will determine the device type, then address the first device and read the unique identification code. If all readings are successful and the identification code is correct, the downstream power supply of the first device will be turned on. Then, this addressing logic will be repeated to address each device along the line in turn.

[0033] like Figure 1 As shown, the addressing process is as follows:

[0034] 1) Broadcast the address of equipment along the route.

[0035] 2) Waiting for addressing requests from devices along the route (timeout 3 seconds)

[0036] 3) After clearing the device address of the currently requesting device again, readdress it.

[0037] 4) Read the unique device code of the current device. If reading fails, call the exception notification callback to report an exception for the current device. If reading succeeds, check if the unique device code is duplicated. If duplicated, report that the current device is restarting abnormally due to insufficient power supply voltage. If the device with the duplicate unique device code is the first device, call the exception notification callback to report that an overcurrent restart exception has occurred along the current line.

[0038] 5) Turn on the power supply to the downstream device.

[0039] 6) In the process of addressing, if addressing to a repeater, a repeater node is generated and reported by callback notification, at this time, according to the maximum number of devices of each repeater, the maximum number of allowed devices is increased by 23; if the message of another master station is received along the line in the process of addressing, the exception notification callback is called to report the device conflict exception of the master station along the line; when the last device is addressed within 3 seconds without receiving the addressing request again or judging that the type of the last device is terminal device, it is considered that the addressing along the line is completed

[0040] 7) After all the devices along the line are addressed, the topology information along the line is generated and reported to the device service through the callback notification, so that the device service can quickly start creating devices, and the core service and node service can quickly obtain the device topology information

[0041] 8) Start to read the network information (IP address, subnet mask, gateway) of the devices along the line in turn, fill the network information in the topology information of the devices along the line obtained in the previous step, and update the device service through the callback notification after reading is completed. At the same time, read the production information (production code, hardware version, module model) of the devices along the line in turn, and still fill the topology information of the devices along the line after reading is completed in turn, and then update the device service through the callback notification

[0042] 9) After addressing is completed, the normal heartbeat monitoring mode is started, and the listening state along the line is entered; when the listening thread receives a new device addressing request along the line, an interrupt signal is sent, all operations (network information reading, production information reading, normal heartbeat monitoring) are stopped, and then the breakpoint detection mode is entered, that is, each device heartbeat state is checked by polling from the address 1 device at an interval of 10 ms, and the device whose heartbeat is detected to be offline is the breakpoint device. The callback of re-addressing notification is called to report the breakpoint address and start addressing from the breakpoint to the rear, and the device information is updated by repeating steps 8 and 9. If all device heartbeats are normal, it is considered that there is no breakpoint, and a new device is accessed, at this time, the callback of re-addressing notification is still called to report the start address of the newly accessed device and continue to start addressing from the new device address to the rear. The device information is updated by repeating steps 8 and 9.

[0043] The addressing method along the line based on CAN communication in the application adopts the method of reading and storing the unique identification ID of the device to distinguish different devices in the addressing process, ensures the uniqueness of each device, and can support the logical processing of various abnormal conditions in the addressing process. The breakpoint continuation addressing scheme is used, normal device heartbeat detection and breakpoint device heartbeat detection modes are introduced, and the speed and efficiency of device addressing are greatly improved.

[0044] The abnormal situations such as relay node generation in the addressing process, maximum number of addressed devices calculation, device abnormal restart caused by overcurrent and voltage shortage can be quickly identified and calculated and reported through the registration callback notification mode.

[0045] The addressing scheme described in the application is based on the addressing under the device bus framework, and similar addressing can also be performed in the device CAN hand-in-hand mode, but the addressing efficiency of this mode is much lower than that of the device bus mode.

[0046] Obviously, the described embodiments are only part of the embodiments of the application, not all. Based on the embodiments in the application, all other embodiments obtained by those of ordinary skill in the art without creative labor belong to the scope of protection of the application.

Claims

1. A method for line addressing based on CAN communication, characterized in that, The method comprises the following steps: Step one, broadcast emptying the device address along the line to ensure that there is no residual device address information on the network, avoiding conflicts in subsequent addressing process; Step two, waiting for the device addressing request, the device sends an addressing request after being powered on or reset, the master station listens to the addressing request and responds within a specified time, otherwise it is considered that the device is not ready or there is a communication problem; Step three, the device address of the current request device is cleared again before addressing, if the device requests addressing, the master station confirms that its address information has been cleared, and then allocates a new unique address to it; Step four, read the unique device code of the current device, if the reading fails, the related exception needs to be reported, if the device code is repeated, the device restarts and tries to readdress; Step five, turn on the power supply of the current device, after addressing is completed, the power supply of the corresponding device is turned on to make it work normally; Step six, handle the conflict between the repeater and the device, when encountering a repeater, the number of addressable devices is increased, when detecting multiple master stations, an exception is reported; Step seven, generate the topology information along the line, after addressing is completed, the topology structure of the entire network is constructed, including the connection relationship between devices; Step eight, read the device network information and production information, obtain the network configuration and production information of the device, so that the device service can correctly manage the device; Step nine, perform normal heartbeat monitoring and breakpoint detection through the listening thread, after the device addressing is completed, enter the normal heartbeat monitoring mode to monitor the state of the device, find the device offline or new device joining, and readdress and update information from the breakpoint.

2. The method according to claim 1, wherein, The response time of the master station listening to the addressing request in step two is 3 seconds.

3. The method of claim 1, wherein, When the device code reading fails in step four, the exception notification callback is called to report the current device exception, when the device code reading succeeds, it is judged whether the device code is repeated, if the device code is repeated, it is reported that the power supply voltage of the current device is insufficient to cause abnormal restart; when the first device code is repeated, the exception notification callback is called to report that there is an overcurrent restart exception along the line.

4. The method of claim 1, wherein, The network information of the device in step eight includes IP address, subnet mask and gateway; the production information of the device includes production code, hardware version and module type.

5. The method of claim 1, wherein, When the listening thread receives a new device addressing request along the line in step nine, it sends an interrupt signal, stops all current operations, and enters the breakpoint detection mode.

6. The method of claim 5, wherein, In step nine, the heartbeat state of each device is checked every 10 ms from the first device, and the device whose heartbeat is detected to be offline is the breakpoint device, the breakpoint address is reported by calling the readdressing notification callback, and the readdressing is started from the breakpoint.

Citation Information

Patent Citations

  • Automatic topological structure realization method and system

    CN107612714A

  • Multi-device master-slave communication system based on CAN communication and addressing and monitoring method

    CN117319185A