CN117319185A - Multi-equipment master-slave communication system based on CAN communication and addressing and monitoring method - Google Patents

Multi-equipment master-slave communication system based on CAN communication and addressing and monitoring method Download PDF

Info

Publication number
CN117319185A
CN117319185A CN202311385989.8A CN202311385989A CN117319185A CN 117319185 A CN117319185 A CN 117319185A CN 202311385989 A CN202311385989 A CN 202311385989A CN 117319185 A CN117319185 A CN 117319185A
Authority
CN
China
Prior art keywords
addressing
slave
master
address
master device
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311385989.8A
Other languages
Chinese (zh)
Inventor
黄恩君
韩鹤光
任会平
郑尧
唐德炜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sichuan Hangdian Micro Energy Co ltd
Original Assignee
Sichuan Hangdian Micro Energy Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sichuan Hangdian Micro Energy Co ltd filed Critical Sichuan Hangdian Micro Energy Co ltd
Priority to CN202311385989.8A priority Critical patent/CN117319185A/en
Publication of CN117319185A publication Critical patent/CN117319185A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0677Localisation of faults
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L12/40006Architecture of a communication node
    • H04L12/40013Details regarding a bus controller
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L12/403Bus networks with centralised control, e.g. polling
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L2012/40208Bus networks characterized by the use of a particular bus standard
    • H04L2012/40215Controller Area Network CAN
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Small-Scale Networks (AREA)

Abstract

The invention discloses a multi-equipment master-slave communication system based on CAN communication and addressing and monitoring methods. The communication system is formed by cascading 1 master device and a plurality of slave devices through DODI terminals, and data is transferred through a bus. After power-on, the main equipment outputs DO edge signals and keeps the current level, and sends addressing commands to the bus; after receiving the addressing command, the first slave device takes the addressing information as the address of the device and stores the addressing information, then feeds back an addressing success feedback signal, then the master device sends a new addressing command, the slave device which is just addressed outputs a DO edge signal and keeps the current level after receiving the new addressing command, and the slave device which just receives the DO edge signal takes the new addressing information as the address of the device and stores the new addressing information, and then sends the addressing success feedback signal to the master device; and so on until the last slave device addressing is complete. The invention can address new network and network update automatically without limiting the number of slave devices, and can locate fault point rapidly.

Description

Multi-equipment master-slave communication system based on CAN communication and addressing and monitoring method
Technical Field
The invention relates to the field of communication system management, in particular to a multi-device master-slave communication system based on CAN communication and an addressing and monitoring method.
Background
CAN communication is often used when information needs to be exchanged between different management systems, devices, components, sensors, etc. When the number of devices is large, different devices need to be connected to the same bus for networking communication in order to reduce wiring cost or to facilitate centralized management. In order to distinguish between different devices that are identified on the same bus, the devices need to be addressed.
At present, addressing problems of master-slave communication of multiple devices in CAN communication mostly adopt the following schemes:
A. setting a hardware dial switch for manual addressing of slave equipment;
B. manually configuring parameters, and configuring the address of each slave device;
C. cascade circuit addressing using PWM signal lines, such as disclosed in document CN113079075 a;
the device is cascaded by a D.5V level signal line, and is automatically addressed every time power is applied, for example, an automatic addressing method disclosed in a document CN 116701277A.
According to the scheme A, one set of dial switch and related circuit hardware cost are added to each device, the number of slave devices is limited by the dial switches, and the number of slave devices which can be connected in parallel is very limited. For scheme B, additional man-machine interaction equipment is required to address, and the practical operation is very inconvenient. In addition, for the A, B scheme, when the number of the devices is large, the devices need to be manually addressed one by one, and the efficiency is low. C. The D scheme can realize automatic addressing, however, the C scheme occupies MCU limited PWM related resources, the address number is transmitted and identified through different PWM frequencies, and the number of slave devices is easy to be limited due to the limitation of PWM frequencies and interference. In the D scheme, the 5V level signals are easy to interfere in actual use, addressing is easy to make mistakes, and the addressing can be carried out once again when the power is on each time, so long as any one of the cascade level signals is abnormal, the whole bus cannot be used, and the reliability of the bus is greatly reduced.
In addition, when the equipment is addressed, after the bus is normally put into use, if the equipment needs to be added or reduced on the bus, or one or more of the equipment needs to be replaced, the A, B, C scheme needs to be manually involved in readdressing, the D scheme can only be electrified again to address, and the bus is not suitable for use in occasions where power failure cannot be realized or the power failure restarting process is very complicated.
Disclosure of Invention
The invention aims at: aiming at all or part of the problems, the multi-device master-slave communication system based on CAN communication and the addressing and monitoring method are provided to solve the problems that the existing addressing scheme of the multi-device master-slave communication network has high addressing hardware cost, low efficiency, excessive MCU (micro control unit) resources occupation, easy interference, easy limitation of the number of slave devices, abnormal inconvenient fault point positioning in the addressing process and/or the need of manual readdressing or power-off restarting when the number of bus devices changes or replaces.
The technical scheme adopted by the invention is as follows:
in one aspect, the present invention provides a multi-device master-slave communication system based on CAN communication, where the communication system includes 1 master device and a plurality of slave devices, where the master devices and the slave devices perform data transfer through buses; the master device and the slave device are connected in a cascading manner through a DO terminal and a DI terminal;
the main equipment outputs DO edge signals and keeps the current level when addressing, and simultaneously sends addressing commands to the bus, and after receiving an addressing success feedback signal, sends the next addressing command to the bus until detecting DI edge signals, wherein the addressing command contains addressing information of the slave equipment to be addressed currently;
each slave device, after detecting DI edge signal, takes the addressing information in the addressing command on the bus as the address of the device and stores it, and then sends addressing success feedback signal to the master device; and outputting the DO edge signal and maintaining the current level when a new addressing command is received after the addressing success feedback signal is sent.
On the other hand, the invention also provides an addressing method based on CAN communication, which is applied to a multi-device master-slave communication system, wherein the communication system comprises 1 master device and a plurality of slave devices, and the master devices and the slave devices carry out data transmission through buses; the master device and the slave device are connected in a cascading manner through a DO terminal and a DI terminal; the addressing method comprises the following steps:
after power-on, the main equipment outputs DO edge signal and keeps the current level when detecting that addressing is needed, and simultaneously sends addressing command to the bus, wherein the addressing command contains addressing information of the slave equipment to be addressed currently; the first slave device takes the addressing information in the received addressing command after detecting the DI edge signal as the address of the device and stores the addressing information, and then sends an addressing success feedback signal to the master device; after receiving the addressing success feedback signal, the master device sends a next addressing command to the bus, after receiving the addressing command, the first slave device outputs a DO edge signal and keeps the current level, and the second slave device takes addressing information in the addressing command received after detecting the DI edge signal as the address of the device and stores the addressing information, and then sends the addressing success feedback signal to the master device; and so on until the master detects the DI edge signal.
On the other hand, the invention also provides a monitoring method based on CAN communication, which is applied to a multi-device master-slave communication system, wherein the communication system comprises 1 master device and a plurality of slave devices, and the master devices and the slave devices carry out data transmission through buses; the master device and the slave device are connected in a cascading manner through a DO terminal and a DI terminal; the slave device which has completed addressing automatically broadcasts and transmits heartbeat frames containing self address information at intervals, and the monitoring method comprises the following steps: the master device automatically readdresses if any of the following conditions a-d are met:
a. the master device does not receive the heartbeat frame of a certain slave device within the set time;
b. the master device receives a slave device heartbeat frame outside the original addressing range;
c. when receiving the heartbeat frame with the same address as the slave device, the slave device sends a readdressing request to the master device, and the master device receives the request;
d. when the slave device which is not addressed is not received by the new access after being electrified for a period of time, the slave device actively transmits an addressing request to the master device; the main equipment receives the addressing request;
the readdressing method includes:
the master device outputs a DO edge signal and keeps the current level, and simultaneously sends an addressing command to the bus, wherein the addressing command contains addressing information of the slave device to be addressed currently; the first slave device takes addressing information in an addressing command received after the DI edge signal is detected as an address of the device and stores the addressing information, and then sends an addressing success feedback signal to the master device; after receiving the addressing success feedback signal, the master device sends a next addressing command to the bus, after receiving the addressing command, the first slave device outputs a DO edge signal and keeps the current level, and the second slave device takes addressing information in the addressing command received after detecting the DI edge signal as the address of the device and stores the addressing information, and then sends the addressing success feedback signal to the master device; and so on until the master detects the DI edge signal.
In summary, due to the adoption of the technical scheme, the beneficial effects of the invention are as follows:
1. the invention can automatically address any number of slave devices in the network, has high addressing efficiency, does not limit the number of the network slave devices due to the addressing scheme, does not occupy the PWM resource of the MCU, only needs an extra DO terminal and DI terminal, and is easy to satisfy hardware resource sources.
2. The 24V level signal cascade is adopted, so that the anti-interference performance is stronger than that of a 5V level signal; and the addressing process is confirmed for a plurality of times through DI and DO edge signals, addressing commands and addressing feedback, and is stable and reliable. .
3. When the bus slave device which is addressed and is put into use is removed, a new slave device is added, or the slave device is replaced by the new device, whether the added new device is coded with an address or not, whether the added new device address conflicts with the existing device address or not, the master device can automatically identify and automatically readdrew, the communication address is ensured to be always matched with the physical address, and maintenance, upgrading and reconstruction of the communication network are easily solved.
4. The main equipment only performs the addressing flow when unaddressed, bus equipment changes and an upper computer addressing command is received, and does not perform once addressing when power is on each time. Therefore, the problem that the maintenance and upgrading of the network need to be manually readdressed is solved, and the risk that the whole system cannot work normally due to the fact that addressing cannot be successful due to the problems of DI wire harness, DO wire harness and the like in each power-on is avoided.
5. When abnormality occurs in the addressing process, fault points can be directly positioned by checking prompt information and addressing records or measuring DI and DO levels, so that the problem solving efficiency is improved.
Drawings
The invention will now be described by way of example and with reference to the accompanying drawings in which:
fig. 1 is a schematic diagram of a communication network topology of a master-slave communication system.
Detailed Description
All of the features disclosed in this specification, or all of the steps in a method or process disclosed, may be combined in any combination, except for mutually exclusive features and/or steps.
Any feature disclosed in this specification (including any accompanying claims, abstract) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise. That is, each feature is one example only of a generic series of equivalent or similar features, unless expressly stated otherwise.
Example 1
A multi-device master-slave communication system based on CAN communication comprises 1 master device and a plurality of slave devices, wherein the master device and the slave devices form a communication network through a DO terminal and a DI terminal cascading mode as shown in figure 1. I.e. for N slaves the DO terminal of the master is connected to the DI terminal of the slave 1, the DO terminal of the slave 1 is connected to the DI terminal of the slave 2, and so on, the DO terminal of the last slave is connected to the DI terminal of the next slave, the DO terminal of the last slave N is connected back to the DI terminal of the master, the master and slave are also connected via a bus for data transfer.
When addressing, the main device outputs the DO edge signal and keeps the current level, after the DO edge signal is output, after receiving the addressing success feedback signal sent by the current addressing slave device, the main device sends the addressing command (aiming at the next to-be-addressed slave device, namely the latest) of the next slave device to the bus until the DI edge signal is detected, and the addressing command contains the address number (addressing information) of the next to-be-addressed slave device (namely the current slave device). Each slave device in the network takes the address number in the addressing command received after the DI edge signal is detected (namely the latest on the bus) as the address of the device and stores the address number, and then sends an addressing success feedback signal to the master device; and outputting the DO edge signal and maintaining the current level when receiving a new next addressing command after sending the addressing success feedback signal.
Description: by "DI edge signal detected" is meant that the DO edge signal is output and held at the DI terminal of the previous device to which the DI terminal of the current device is connected, i.e., the level of the DO terminal of the previous device transitions, typically from a low level to a high level. If the level of the DO terminal of the previous device has not changed, it does not belong to the "DI edge signal detected" even though it is high. For example, after the first slave device completes the address and receives a new address instruction, outputs a DO edge signal and maintains the current level, and the DI terminal of the second slave device connected to the first slave device detects the DI edge signal, but since the level of the DO terminal of the master device is not hopped to a high level but is always maintained at a high level, the DI terminal of the first slave device is not "detected the DI edge signal" although the level is also a high level.
Specifically:
the master device is configured to:
A. when detecting the addressing mark stored by the host device and finding that the host device is not addressed, a DO edge signal (24V) is output and the current level is maintained. Alternatively, the DO edge signal is outputted and the current level is maintained after receiving an address request from the device. Or after receiving the addressing instruction of the upper computer, outputting the DO edge signal and maintaining the current level.
B. After the DO edge signal is output, an addressing command is continuously sent to the bus, wherein the addressing command contains the address number of the current slave device.
C. After receiving the addressing success feedback frame (signal) sent by the current slave device, the next addressing command is continuously sent to the bus.
D. After detecting the DI edge signal, the address completion notification frame is broadcast-transmitted to indicate that the address is completed while the DO signal is turned off.
The slave device is configured to:
A. after power-up, when detecting the address stored by the host device and finding that the address is not addressed, and when the address command of the host device is not received within a certain time (set time), the host device actively transmits an address request (request address frame) to the host device.
B. After detecting the DI edge signal and being in the effective state at present, taking the address number in the addressing command as the address of the equipment and storing the address number, and then sending an addressing success feedback frame to the main equipment; after sending the addressing success feedback frame, when receiving a new addressing command, the DO edge signal is output and the current level is kept. In some embodiments, the slave device is configured to: after detecting a DI edge signal, only one addressing is allowed to be accepted, and the addressing is prevented from being covered again.
C. And outputting the DO edge signal and keeping the current level until the DO edge signal is disconnected after the addressing completion notification frame is received.
That is, each of the master and slave devices turns off the DO edge signal after the entire addressing process is completed, and the device that has outputted the DO edge signal keeps the current level all the time during the addressing process. Thus, when an abnormality occurs in a certain device during the addressing process to cause the addressing failure, the DO signal of each device remains in the current level state. At this time, the specific device that has failed can be known by looking at the current address number, or by measuring the DO signal level of each device. For example, in the process of addressing, after the master device sends out a certain addressing command, the master device does not receive addressing success feedback for a long time (exceeding a preset time), and if the DI edge signal is not detected, the master device indicates that an abnormality occurs in a certain slave device, at this time, an address number which is not successfully addressed is recorded, that is, an address number in the addressing command which is not fed back is sent out, and addressing is stopped.
Compared with the 4 schemes introduced above, the configuration of the master-slave equipment can solve the problems of high cost, low efficiency, excessive MCU occupation resources, easy interference and easy limitation of the number of slave equipment of the master-slave communication network addressing hardware of the multi-equipment, and can also quickly locate fault points when the addressing is abnormal.
The communication system is not guaranteed to be constant for devices in the network after start-up, which poses another problem that in an addressed communication network, the number of slave devices on the bus changes or when slave devices are replaced, readdressing is required. Specifically:
the slave device is further configured to:
A. in the addressed state, heartbeat frames containing self address information are automatically broadcast transmitted at intervals.
B. Upon receipt of the same heartbeat frame as the local address, a readdrew request is sent to the master device.
If the newly added slave device is not addressed, after it is powered up, after not receiving an address command for a period of time, an address request is sent to the master device, which can already be achieved in the previous configuration.
The master device is further configured to:
A. when the heartbeat frame of a slave device is not received for a long time (set time), the heartbeat frame of the slave device is monitored, and automatic readdressing is attempted under the safe condition, namely, the DO edge signal is output again and the current level is maintained, and the addressing command and other responses are retransmitted.
B. When the heartbeat frame outside the original addressing range (address number range) is monitored (namely, the address information in the heartbeat frame exceeds the original addressing range), the readdressing is automatically carried out.
C. Upon receipt of the readdressing request, readdressing is automatically performed.
Example 2
The embodiment introduces an addressing method based on CAN communication, which is applied to a multi-device master-slave communication system, as shown in figure 1, wherein the communication system comprises 1 master device and a plurality of slave devices, and the master devices and the slave devices form a communication network in a cascading mode. I.e. for N slaves the DO terminal of the master is connected to the DI terminal of slave 1, the DO terminal of slave 1 is connected to the DI terminal of slave 2, and so on, the DO terminal of the last slave is connected to the DI terminal of the next slave, and the DO terminal of the last slave N is connected back to the DI terminal of the master. For the communication network, after power-on, the master device outputs DO edge signals and keeps the current level, and simultaneously continuously sends addressing commands to the bus, wherein the addressing commands comprise the address numbers of the slave devices to be addressed currently; the first slave device (namely, the slave device connected with the DO terminal of the master device) takes the address number in the addressing command received after the DI edge signal is detected as the address of the device and stores the address number, and then sends an addressing success feedback signal to the master device; after receiving the addressing success feedback signal, the master device sends an addressing command of the next slave device, the slave device (namely the first slave device) which just sends the addressing success feedback signal outputs a DO edge signal and keeps the current level after receiving the addressing command, and the slave device (namely the second slave device) which just detects the DI edge signal takes the address number in the addressing command on the bus which is received after detecting the DI edge signal as the address of the device and stores the address number, and then sends the addressing success feedback signal to the master device; and so on until the master detects a DI edge signal, indicating that the last slave has been addressed. Specifically, the addressing method includes:
a. after power-up, the master device detects the addressing flag stored by itself (or other modes) and outputs the DO edge signal and keeps the current level when the master device finds that the master device is not addressed (obviously, whether the master device is addressed is detected first or not). Or after power-on, when the slave device detects the address stored by the slave device and finds that the address is not addressed, and does not receive the addressing command of the master device within a certain time, the slave device actively transmits an addressing request to the master device, and after receiving the request, the master device also outputs a DO edge signal and keeps the current level. In addition, after the addressing instruction of the upper computer is received (obviously, the main equipment monitors the addressing instruction at any time), the DO edge signal is also output and the current level is maintained. After the master device outputs the DO edge signal, an addressing command is continuously sent to the bus, wherein the addressing command comprises the address number 1# of the current slave device.
b. When the slave device 1 connected with the master device detects the DI edge signal and is in an active state (the level is maintained all the time) and receives the addressing command of the master device, the address number 1# in the command is used as the address of the device and stored, and then an addressing success feedback frame is sent to the master device.
c. And after receiving the feedback frame of the No. 1 device, the master device continuously sends the addressing command of the No. 2 device to the bus.
And d, when the 1# device receives the addressing command of the 2# device, outputting a DO edge signal to the slave device 2 and maintaining the current level.
e. Similarly, when the slave device 2 detects the DI edge signal and is currently in a valid state, and simultaneously receives the addressing command of the master device, the address number 2# in the command is used as the address of the slave device and stored, and then the addressing success feedback is sent to the master device.
f. And so on, each time the master device sends out an addressing command, and receives addressing feedback of the corresponding slave device, the next addressing command of the slave device is continuously sent. Each slave device takes the address allocated in the address command received after the DI edge signal is detected (and the DI edge signal is in the current valid state) as the address of the slave device and stores the address, then sends an address success feedback signal to the master device, and outputs the DO edge signal and maintains the current level when the address command of a new slave device is received after the feedback signal is sent.
g. When the last slave device N receives the N+1# addressing command of the master device, a DO edge signal is output to the master device, after the master device detects the DI signal (namely, the DI terminal receives the DO edge signal), an addressing completion notification frame is broadcast and sent, meanwhile, the DO edge signal is disconnected after the slave device receives the addressing completion notification frame, the addressing is completed, and the master device and the slave device store addressing completion marks.
The storage of the addresses by the master device and the slave device is the storage without losing memory when power is off, namely, when power is on again after power off, the addresses stored before power off are still stored.
Example 3
The addressed communication network (the addressing method may be the same as or different from that of embodiment 2, and is not affected by the monitoring), and the network needs to be monitored, so that when the number of slave devices in the addressed communication network changes or the slave devices are replaced, corresponding responses can be automatically and timely made, thereby ensuring that the new network can still work normally. In this regard, the present embodiment also designs a monitoring method based on CAN communication, in which slave devices that have completed addressing are set, and heartbeat frames containing their own address information are automatically broadcast and transmitted every a period of time (set time). The method comprises the following steps:
a. a slave device on the bus is removed: when the master device does not receive the heartbeat frame of a certain slave device for a long time (set time), the master device tries to automatically readdrew under the condition of safety (the addressing method is the same as above and the following). If addressing is successful, the number of slave devices is reduced, the devices communicate according to the new addresses, and if addressing fails, prompt information is sent.
b. Slave devices that have added new addresses on the bus: and when the master device receives the slave device heartbeat frame outside the original addressing range, the master device automatically readdresses.
c. The bus is added with slave devices with the same addresses as the existing devices: when a certain slave device receives the heartbeat frame with the same address as the slave device, the slave device sends a readdressing request to the master device, and the master device automatically readdresses after receiving the request.
d. A new unaddressed slave device is added to the bus or one or more of the slave devices are replaced with a new unaddressed slave device: when the new slave device does not receive the addressing command of the master device within a period of time (set time) after power-on, the new slave device actively transmits a request addressing frame (addressing request) to the master device; the master device automatically readdresses after receiving the request addressing frame.
The above-mentioned a to d should be understood that, in developing a program for a monitoring method, any condition is designed to be included in the scope of the above-mentioned monitoring method, that is, the condition set in the program may be one or more than one of them.
The monitoring scheme and the addressing scheme used have the following effects:
a. when the slave devices on the bus that have been addressed to completion are removed from service, the master device can automatically recognize and automatically readdrew without manual readdrew.
b. When the bus which is addressed and put into use is added with a new slave device or the slave device is replaced by the new device, no matter whether the added new device is coded with an address or not, no matter whether the added new device address conflicts with the existing device address or not, the master device can automatically identify and automatically readdrew, the communication address is ensured to be always matched with the physical address, and the maintenance, upgrading and reconstruction of the communication network are easily solved.
c. The main equipment only performs the addressing flow when unaddressed, bus equipment changes and an upper computer addressing command is received, and does not perform once addressing when power is on each time. Therefore, the problem that the maintenance and upgrading of the network need to be manually readdressed is solved, and the risk that the whole system cannot work normally due to the fact that addressing cannot be successful due to the problems of DI wire harness, DO wire harness and the like in each power-on is avoided.
d. When abnormality occurs in the addressing process, fault points can be directly positioned by checking prompt information or measuring DI and DO levels, so that the problem solving efficiency is improved.
e. When readdressing is needed, an addressing command can be sent manually by the upper computer, and addressing can be completed.
f. The hardware cost is low, only 1 DO port and 1 DI port are needed, the limited PWM resource of the MCU is not occupied, and the MCU of the DI port and the DO port is quite sufficient and is easy to meet.
g. The addressing efficiency is high, the addressing process is full-automatic, no human intervention is needed, and the number of the devices can be easily completed.
h. The number of devices is theoretically not limited by addressing problems and can be arbitrarily added.
i. The addressing process is confirmed for a plurality of times through DI, DO signals, addressing commands and addressing feedback, and is stable and reliable.
The j.24V level signals are cascaded, and the anti-interference performance is stronger than that of the 5V level signals.
It should be noted that, in the embodiment of the present invention, the addressing of the slave devices is performed in the order of # 1 and # 2 … …, which also accords with the conventional addressing order, but the address numbers of the slave devices are not limited to be sequentially increased, and other numbering rules may be completely adopted, so long as no collision phenomenon occurs. In addition, in the addressed communication network, the master device (or other devices) stores the address of each slave device in the current network, so as to determine the identity of each slave device in the current network, and the slave device can find out in time when the slave device changes.
The invention is not limited to the specific embodiments described above. The invention extends to any novel one, or any novel combination, of the features disclosed in this specification, as well as to any novel one, or any novel combination, of the steps of the method or process disclosed.

Claims (10)

1. A multi-device master-slave communication system based on CAN communication, which is characterized by comprising 1 master device and a plurality of slave devices, wherein the master devices and the slave devices conduct data transmission through buses; the master device and the slave device are connected in a cascading manner through a DO terminal and a DI terminal;
the main equipment outputs DO edge signals and keeps the current level when addressing, and simultaneously sends addressing commands to the bus, and after receiving an addressing success feedback signal, sends the next addressing command to the bus until detecting DI edge signals, wherein the addressing command contains addressing information of the slave equipment to be addressed currently;
each slave device, after detecting DI edge signal, takes the addressing information in the addressing command on the bus as the address of the device and stores it, and then sends addressing success feedback signal to the master device; and outputting the DO edge signal and maintaining the current level when a new addressing command is received after the addressing success feedback signal is sent.
2. The CAN communication-based multi-device master-slave communication system of claim 1 wherein each of the slave devices is allowed to accept only 1 addressing after receiving 1 DO edge signal.
3. The CAN communication-based multi-device master-slave communication system according to claim 1, wherein the master device starts addressing when detecting that it has not addressed itself, or after receiving an address request from a slave device, or after receiving an address instruction from a host computer.
4. The CAN communication-based multi-device master-slave communication system according to claim 1, wherein the slave device, in an addressed state, periodically and automatically broadcasts a heartbeat frame containing own address information; and when the heartbeat frame of a certain slave device is not monitored at intervals of preset time or when the heartbeat frame of the slave device which is beyond the original addressing range is monitored, the master device automatically readdresses.
5. The CAN communication-based multi-device master-slave communication system according to claim 1, wherein the slave device, in an addressed state, periodically and automatically broadcasts a heartbeat frame containing own address information, and when receiving a heartbeat frame conflicting with the address of the slave device, transmits a readdressing request to the master device; and when the main equipment receives the readdressing request, readdressing is automatically carried out.
6. The addressing method based on CAN communication is applied to a multi-device master-slave communication system, and is characterized in that the communication system comprises 1 master device and a plurality of slave devices, and the master devices and the slave devices conduct data transmission through buses; the master device and the slave device are connected in a cascading manner through a DO terminal and a DI terminal; the addressing method comprises the following steps:
after power-on, the main equipment outputs DO edge signal and keeps the current level when detecting that addressing is needed, and simultaneously sends addressing command to the bus, wherein the addressing command contains addressing information of the slave equipment to be addressed currently; the first slave device takes the addressing information in the received addressing command after detecting the DI edge signal as the address of the device and stores the addressing information, and then sends an addressing success feedback signal to the master device; after receiving the addressing success feedback signal, the master device sends a next addressing command to the bus, after receiving the addressing command, the first slave device outputs a DO edge signal and keeps the current level, and the second slave device takes addressing information in the addressing command received after detecting the DI edge signal as the address of the device and stores the addressing information, and then sends the addressing success feedback signal to the master device; and so on until the master detects the DI edge signal.
7. The CAN communication based addressing method of claim 6, further comprising: outputting a DO edge signal to the master device when the last slave device sends an addressing success feedback signal and receives a next addressing command; after the main equipment detects the DI edge signal, broadcasting and sending an addressing completion notification signal, and simultaneously disconnecting the DO edge signal; each slave device turns off the DO edge signal after receiving the address completion notification signal.
8. The CAN communication based addressing method of claim 6, wherein the master device starts addressing in any of the following a-c cases:
a. upon detecting that it is not addressed by itself;
b. when receiving the addressing request;
c. and when an addressing instruction of the upper computer is received, addressing is started.
9. The CAN communication-based addressing method of claim 6, wherein the slave device that has completed addressing automatically broadcasts and transmits a heartbeat frame containing own address information every an interval of time; the master device automatically readdresses in any of the following cases a-d:
a. when the master device does not receive the heartbeat frame of a certain slave device within the set time, the master device automatically readdresses;
b. when the master equipment receives the slave equipment heartbeat frame outside the original addressing range, the master equipment automatically readdresses;
c. when receiving the heartbeat frame with the same address as the slave device, the slave device sends a readdressing request to the master device, and the master device automatically readdresses after receiving the request;
d. when the slave device which is not addressed is not received by the new access after being electrified for a period of time, the slave device actively transmits an addressing request to the master device; and the main equipment automatically readdresses after receiving the addressing request.
10. The monitoring method based on CAN communication is applied to a multi-device master-slave communication system, and is characterized in that the communication system comprises 1 master device and a plurality of slave devices, and the master devices and the slave devices conduct data transmission through buses; the master device and the slave device are connected in a cascading manner through a DO terminal and a DI terminal; the slave device which has completed addressing automatically broadcasts and transmits heartbeat frames containing self address information at intervals, and the monitoring method comprises the following steps: the master device automatically readdresses if any of the following conditions a-d are met:
a. the master device does not receive the heartbeat frame of a certain slave device within the set time;
b. the master device receives a slave device heartbeat frame outside the original addressing range;
c. when receiving the heartbeat frame with the same address as the slave device, the slave device sends a readdressing request to the master device, and the master device receives the request;
d. when the slave device which is not addressed is not received by the new access after being electrified for a period of time, the slave device actively transmits an addressing request to the master device; the main equipment receives the addressing request;
the readdressing method includes:
the master device outputs a DO edge signal and keeps the current level, and simultaneously sends an addressing command to the bus, wherein the addressing command contains addressing information of the slave device to be addressed currently; the first slave device takes addressing information in an addressing command received after the DI edge signal is detected as an address of the device and stores the addressing information, and then sends an addressing success feedback signal to the master device; after receiving the addressing success feedback signal, the master device sends a next addressing command to the bus, after receiving the addressing command, the first slave device outputs a DO edge signal and keeps the current level, and the second slave device takes addressing information in the addressing command received after detecting the DI edge signal as the address of the device and stores the addressing information, and then sends the addressing success feedback signal to the master device; and so on until the master detects the DI edge signal.
CN202311385989.8A 2023-10-25 2023-10-25 Multi-equipment master-slave communication system based on CAN communication and addressing and monitoring method Pending CN117319185A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311385989.8A CN117319185A (en) 2023-10-25 2023-10-25 Multi-equipment master-slave communication system based on CAN communication and addressing and monitoring method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311385989.8A CN117319185A (en) 2023-10-25 2023-10-25 Multi-equipment master-slave communication system based on CAN communication and addressing and monitoring method

Publications (1)

Publication Number Publication Date
CN117319185A true CN117319185A (en) 2023-12-29

Family

ID=89255265

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311385989.8A Pending CN117319185A (en) 2023-10-25 2023-10-25 Multi-equipment master-slave communication system based on CAN communication and addressing and monitoring method

Country Status (1)

Country Link
CN (1) CN117319185A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117880249A (en) * 2024-03-11 2024-04-12 西安博康电子有限公司 Automatic addressing method for differential communication bus unit

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117880249A (en) * 2024-03-11 2024-04-12 西安博康电子有限公司 Automatic addressing method for differential communication bus unit
CN117880249B (en) * 2024-03-11 2024-05-28 西安博康电子有限公司 Automatic addressing method for differential communication bus unit

Similar Documents

Publication Publication Date Title
US7139839B2 (en) Method and apparatus for assigning a network node address
CN117319185A (en) Multi-equipment master-slave communication system based on CAN communication and addressing and monitoring method
CN111327503B (en) MODBUS bus-based multi-master-station token scheduling device, communication method and system
CN115277629A (en) Multi-machine communication non-inductive addressing method for battery pack of communication base station
CN112208589A (en) Cross-line operation method, system, device, electronic equipment and storage medium
CN112653743B (en) Multi-sensor addressing method, data acquisition equipment and system in RS485 bus
CN110053650B (en) Automatic train operation system, automatic train operation system architecture and module management method of automatic train operation system
CN115987999A (en) Master-slave competition method and device for multi-machine system, ARM and storage medium
JPH0817394B2 (en) Interrupt processing method of time division multiplex transmission system
CN116366437A (en) Plug-and-play intra-cabinet networking strategy
CN110290158B (en) Method and system for updating train communication network nodes
CN112178881B (en) Self-checking method and device of RS485 network
CN114528242A (en) Computer platform dual-system synchronization method, device, equipment and medium
CN111010286A (en) Intelligent registration method and device based on serial bus, electronic equipment and medium
EP4135268A1 (en) Methods, systems and devices for coordinating a plurality of nodes in a 10base-t1s ethernet network
CN114880033B (en) Screen protection method and device for vehicle-mounted display, storage medium and control equipment
CN117544596B (en) Automatic address allocation method for telemetry system, telemetry system and storage medium
CN117544598B (en) I2C bus address automatic allocation method
CN118677875A (en) Method, device and storage medium for automatically distributing IDs (identity) by multiple synchronous modules
JP3294256B2 (en) Data communication method and device
JP3276363B2 (en) Communication system control processor
JP3276362B2 (en) Communication system control processing method
JPH11191747A (en) Radio communication system and low-speed frequency hopping spread spectrum communication method
JP3351254B2 (en) Load control system
JP3276364B2 (en) Communication system control processor

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination