Bus terminal resistance automatic loading and ID self-assignment method and system, equipment, medium, and product

By automatically detecting and controlling signals, the endpoints and IDs are assigned in high-speed communication systems, which solves the problems of automatic differentiation and ID duplication in the existing technology, realizes the automatic loading of terminal resistors and the self-allocation of device IDs, and improves the system economy and user experience.

CN114553630BActive Publication Date: 2024-09-13RENOGY NEW ENERGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210014887.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-07
Publication Date
2024-09-13
Estimated Expiration
2042-01-07

AI Technical Summary

Technical Problem

The existing technology cannot automatically distinguish the two farthest endpoints in a high-speed communication system, and there are duplication problems in device ID allocation, resulting in data misalignment and system communication paralysis. It also requires users to have a professional foundation and add accessories, affecting economy and users. experience.

Method used

Detect the status of the logic line through setting and detection control, automatically confirm and distinguish the two farthest endpoints, and realize automatic loading of terminal resistors and self-assignment of device ID through control signals and feedback signals, using hand-in-hand connection and controllable switch to ensure that the system operates without being affected by external factors.

Benefits of technology

It realizes automatic differentiation of the two farthest endpoints and self-assignment of device IDs, reduces the professional requirements for users, does not require additional accessories, improves the economy and user experience of the system, and is suitable for advanced intelligent applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114553630B
    Figure CN114553630B
Patent Text Reader

Abstract

The present invention provides a bus terminal resistance automatic loading and ID self-allocation system, in which each device in the system reserves a main interface terminal and a secondary interface terminal, and the secondary interface terminal of the previous level device is connected to the main interface terminal of the next level device through a communication line, a control detection logic line and a feedback monitoring logic line. The present invention relates to an electronic device, a storage medium and a program product. The present invention also relates to a bus terminal resistance automatic loading and ID self-allocation method. The present invention can automatically distinguish the two farthest endpoints, is not affected by external factors, and realizes the self-allocation of device IDs. The present invention does not require the user to have a professional foundation, does not need to add accessories, is economical and convenient, and has no hardware requirements, which is conducive to increasing the market prospects of system-level intelligent applications and improving user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a bus terminal resistance automatic loading and ID self-allocation method and system, equipment, medium and product. Background Art

[0002] For high-speed communication with a communication speed of 125kbps-1Mbps (such as CAN bus communication, 485 bus communication), in a network (directly connected by a set of cables), it is required that there are only two terminal resistors with a typical value of 120 ohms equal to the transmission line impedance added to the two farthest ends of the straight line topology structure, such as Figure 1 shown.

[0003] In the past, most industrial applications were done by manually distinguishing the first and last devices, making two terminal resistor accessories, and manually inserting them into the communication terminals. This method requires users to have a certain professional foundation and also requires additional accessories, which is neither economical nor convenient.

[0004] Later, some solutions appeared on the market that allowed the system to automatically add terminal resistance, but they all had certain rigid requirements. For example, no device in the system could be powered off, no device could be shut down, no device could fail, etc. This would force the terminal resistance to be removed, causing the communication of the entire system to be paralyzed.

[0005] Moreover, there will be big problems with ID allocation. For example, if the 485 communication system is mass-produced, the device IDs will definitely overlap when leaving the factory, and the system will inevitably need to be re-allocated. When the device IDs in the system are the same, if the host wants to obtain data from the slave, all devices with the same ID will respond at the same time and return data, resulting in data misalignment and errors on the bus, and the parsing cannot be completed. Even if you want to modify the ID, after the host sends a command, the slaves with the same ID will respond at the same time, resulting in the same device ID being modified at the same time, which still does not meet the requirement of different device IDs for each device in the system.

[0006] The proportion of product communication in actual civilian environments is increasing, and system-level intelligent applications are becoming more and more popular. Users may not have a professional foundation and attach great importance to experience. Therefore, there is an urgent need for a method that allows the system to automatically distinguish the two farthest endpoints, is not affected by external factors, and realizes the self-assignment of device IDs. Summary of the invention

[0007] In order to overcome the deficiencies of the prior art, the purpose of the present invention is to provide a bus terminal resistance automatic loading and ID self-assignment method, the system automatically distinguishes the two farthest endpoints, is not affected by external factors, and realizes self-assignment of device ID.

[0008] The present invention provides a bus terminal resistance automatic loading and ID self-assignment method, comprising the following steps:

[0009] Setting state, setting the control detection logic line output of all devices according to the preset configuration;

[0010] Detection status, detect the status of the control detection logic line input terminal of all devices;

[0011] Confirm the first device. If it is detected that the state of the control detection logic line input terminal of the device is different from the set state, it is confirmed to be the first device. The first device sends a control signal through the control detection logic line output terminal;

[0012] Confirm the last device and determine the working status of the next-level device. If it is normal, the next-level device sends a chip selection control signal to control the controllable switch to switch to the detection loop. When the next-level device detects the control signal through the input end of the control detection logic line, it feeds back the signal to the previous device through the output end of the feedback monitoring logic line, and sends an enable controller signal at the same time, and sends the control signal to the next-level device through the output end of the control detection logic line; if it is abnormal, the controllable switch remains in the straight-through loop, and directly sends the control signal to the next-level device through the output end of the control detection logic line. The feedback signal sent by the next-level device through the output end of the feedback monitoring logic line is directly transmitted to the previous device through the straight-through loop of the next-level device; this step is repeated until no feedback is detected at the input end of the feedback monitoring logic line, and it is confirmed as the last device.

[0013] Furthermore, it also includes:

[0014] In the preset state, a control command is sent to preset the control detection logic line output terminals of all devices according to the preset configuration;

[0015] Modify the ID of the first device, send an ID modification command, the first device responds and modifies the ID, the first device sends a control signal through the control detection logic line output end, and sets the control detection logic line output end to the opposite state of the preset state;

[0016] Modify the ID of the subsequent device and send an ID modification command. The device whose ID has not been modified and whose input state of the control detection logic line is the opposite of the preset state responds and modifies the ID. A control signal is sent through the output end of the control detection logic line to set the output end of the control detection logic line to the opposite of the preset state. This step is executed repeatedly until there is no response from the bus.

[0017] Furthermore, in the state setting step, the control detection logic line output terminals of all devices are pulled low.

[0018] Furthermore, in the step of confirming the first device, if it is detected that the state of the control detection logic line input terminal of the device is not a low level, it is confirmed to be the first device.

[0019] Furthermore, in the step of presetting the state, the output terminals of the control detection logic lines of all devices are pulled low; and in the step of modifying the ID of the first device, the output terminal of the control detection logic line of the first device is set high.

[0020] An electronic device, comprising: a processor;

[0021] A memory; and a program, wherein the program is stored in the memory and is configured to be executed by a processor, the program including a method for executing a bus terminal resistance automatic loading and ID self-assignment method.

[0022] A computer-readable storage medium stores a computer program, wherein the computer program is executed by a processor to implement a bus terminal resistance automatic loading and ID self-assignment method.

[0023] A computer program product includes a computer program / instruction, which realizes a bus terminal resistance automatic loading and ID self-assignment method when executed by a processor.

[0024] A bus terminal resistance automatic loading and ID self-assignment system implements a bus terminal resistance automatic loading and ID self-assignment method, wherein each device in the system reserves a main interface terminal and a secondary interface terminal, and the secondary interface terminal of the previous level device is connected to the main interface terminal of the next level device through a communication line, a control detection logic line, and a feedback monitoring logic line.

[0025] Furthermore, it also includes a controllable switch, the secondary interface terminal of the previous stage device is connected to the input terminal of the controllable switch corresponding to the current device through the control detection logic line, the main interface terminal of the next stage device is connected to the input terminal of the controllable switch corresponding to the current device through the feedback monitoring logic line, the first output terminal of the controllable switch corresponding to the current device and the enable terminal of the current device are connected to the input terminal of the controllable switch corresponding to the next stage device through the control detection logic line, the second output terminal of the controllable switch corresponding to the current device is connected to the current device, the coil of the controllable switch corresponding to the current device is connected to the chip select terminal and ground of the current device, and the first output terminal of the controllable switch corresponding to the current device and the enable terminal of the current device are connected to the input terminal of the controllable switch corresponding to the previous stage device through the feedback monitoring logic line.

[0026] Compared with the prior art, the present invention has the following beneficial effects:

[0027] The present invention provides a bus terminal resistance automatic loading and ID self-assignment method, the system can automatically distinguish the two farthest endpoints, and is not affected by external factors, and realizes the self-assignment of device ID. The present invention does not require users to have professional foundation, does not need to add accessories, is economical and convenient, and has no hardware requirements, which is conducive to increasing the market prospects of system-level intelligent applications and improving user experience.

[0028] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention and implement it according to the contents of the specification, the following is a detailed description of the preferred embodiments of the present invention in conjunction with the accompanying drawings. The specific implementation of the present invention is given in detail by the following embodiments and their accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. 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 drawings:

[0030] Figure 1 It is a schematic diagram of the topological structure in the background technology of the present invention;

[0031] Figure 2 It is a schematic diagram of the bus terminal resistance automatic loading and ID self-assignment system of the present invention;

[0032] Figure 3 An internal circuit diagram of a device connected to a control detection logic line according to an embodiment of the present invention;

[0033] Figure 4 An internal circuit diagram of a device connected to a feedback monitoring logic line according to an embodiment of the present invention;

[0034] Figure 5 It is a flow chart of the bus terminal resistance automatic loading method of the present invention;

[0035] Figure 6 This is a flow chart of the bus terminal resistor ID self-allocation method of the present invention. DETAILED DESCRIPTION

[0036] The present invention is further described below in conjunction with the accompanying drawings and specific implementation methods. It should be noted that, under the premise of no conflict, the various embodiments or technical features described below can be arbitrarily combined to form a new embodiment.

[0037] Bus terminal resistance automatic loading and ID self-assignment system, such as Figure 2As shown in the figure, each device in the system reserves a primary interface terminal (Primary) and a secondary interface terminal (Secondary). The secondary interface terminal of the previous device is connected to the primary interface terminal of the next device through a communication line (Communication Line) and a logic line (Logic Line). The logic line includes a control detection logic line and a feedback monitoring logic line. The hand-in-hand connection is adopted: Secondary_1-Primary_2-Secondary_2-Primary_3-Secondary_3-......-Primary_n. By controlling and monitoring the signals of the two logic lines, the position of the devices can be confirmed.

[0038] In one embodiment, it also includes a controllable switch, the secondary interface terminal of the previous stage device is connected to the input terminal of the controllable switch corresponding to the current device through a control detection logic line, the main interface terminal of the next stage device is connected to the input terminal of the controllable switch corresponding to the current device through a feedback monitoring logic line, the first output terminal of the controllable switch corresponding to the current device and the enable terminal of the current device are connected to the input terminal of the controllable switch corresponding to the next stage device through the control detection logic line, the second output terminal of the controllable switch corresponding to the current device is connected to the current device, the coil of the controllable switch corresponding to the current device is connected to the chip select terminal and ground of the current device, and the first output terminal of the controllable switch corresponding to the current device and the enable terminal of the current device are connected to the input terminal of the controllable switch corresponding to the previous stage device through the feedback monitoring logic line.

[0039] like Figure 3As shown, the enable terminal EN1 of the first device MCU1 is connected to the base of the transistor Q1, the emitter of the transistor Q1 is grounded via the resistor R2, the collector of the transistor Q1 is connected to the 3.3V power supply via the resistor R1, the connection point between the emitter of the transistor Q1 and the resistor R2 is connected to the input terminal of the controllable switch corresponding to the second device through the control detection logic line, the first output terminal of the controllable switch corresponding to the second device is connected to the input terminal of the controllable switch corresponding to the third device through the control detection logic line, the loop connected to the first output terminal of the controllable switch here is a straight-through loop, and the second output terminal of the controllable switch corresponding to the second device is connected to the input terminal of the controllable switch corresponding to the third device. Connected to the input end of the second device MCU2, the loop connected to the second output end of the controllable switch here is the detection loop, the chip select end CS of the second device MCU2 is connected to one end of the coil of the controllable switch, the other end of the coil of the controllable switch is grounded, the enable end EN2 of the second device MCU2 is connected to the base of the transistor Q2, the emitter of the transistor Q2 is grounded via the resistor R4, the collector of the transistor Q2 is connected to the 3.3V power supply via the resistor R3, the junction of the emitter of the transistor Q2 and the resistor R4 is connected to the input end of the controllable switch corresponding to the third device through the control detection logic line, and the connection of the subsequent devices is analogous. The main function of Logic Line_T_IN (T=1,2,3...n) is to determine whether it is the first one and whether there are any devices in front.

[0040] like Figure 4 As shown, the enable terminal EN2 of the third device MCU3 is connected to the base of the transistor Q1, the emitter of the transistor Q1 is grounded, the collector of the transistor Q1 is connected to the 3.3V power supply via the resistor R1, and the connection between the collector of the transistor Q1 and the resistor R1 is connected to the input terminal of the controllable switch corresponding to the second device through the feedback monitoring logic line. The first output terminal of the controllable switch corresponding to the second device is connected to the input terminal of the controllable switch corresponding to the first device through the feedback monitoring logic line. Here, the loop connected to the first output terminal of the controllable switch is a straight-through loop, and the second output terminal of the controllable switch corresponding to the second device is connected to the input terminal of the controllable switch corresponding to the first device. Connected to the input terminal of the second device MCU2, the loop connected to the second output terminal of the controllable switch here is the detection loop, the chip select terminal CS of the second device MCU2 is connected to one end of the coil of the controllable switch, the other end of the coil of the controllable switch is grounded, the enable terminal EN1 of the second device MCU2 is connected to the base of the transistor Q2, the emitter of the transistor Q2 is grounded, the collector of the transistor Q2 is connected to the 3.3V power supply through the resistor R3, the connection between the collector of the transistor Q2 and the resistor R3 is connected to the input terminal of the controllable switch corresponding to the first device through the feedback monitoring logic line, and the connection of the subsequent devices is analogous. The condition for judging whether you are the last one is: send a feedback signal through Logic Line_T_feedback (T=1,2,3...n), if there is feedback, it is not the last one, if there is no feedback, it is the last one.

[0041] The above-mentioned bus terminal resistance automatic loading and ID self-assignment system corresponding to the bus terminal resistance automatic loading method is as follows: Figure 5 As shown, the following steps are included:

[0042] In the setting state, the control detection logic line output terminals of all devices are set according to the preset configuration. In this embodiment, the control detection logic line output terminals of all devices are pulled low, that is, Figure 3 All Logic Line_T_OUT (T=1, 2, 3...n) in the device are pulled low (the device pulls low by default). It should be understood that the state of the control detection logic line output terminal can be set according to actual conditions.

[0043] Detection status, detecting the status of the control detection logic line input terminal of all devices, that is, a method of detecting the status of Logic Line_T_IN (T=1,2,3...n).

[0044] Confirm the first device. If the state of the control detection logic line input terminal of the device is detected to be different from the set state, in this embodiment, if the state of the control detection logic line input terminal of the device is detected to be non-low level, it is confirmed as the first device, and the first device sends a control signal through the control detection logic line output terminal. If the device is detected that Logic Line_T_IN (T = 1, 2, 3...n) is non-low level, it is confirmed as the first device, and the first device sends a control signal through the Logic Line_1_OUT logic line.

[0045] Confirm the last device and determine the working status of the next-level device. If it is normal, the next-level device sends a chip selection control signal to control the controllable switch to switch to the detection loop. When the next-level device detects the control signal through the input end of the control detection logic line, it feeds back the signal to the previous device through the output end of the feedback monitoring logic line, and sends an enable controller signal at the same time, and sends the control signal to the next-level device through the output end of the control detection logic line; if it is abnormal, the controllable switch remains in the straight-through loop, and directly sends the control signal to the next-level device through the output end of the control detection logic line. The feedback signal sent by the next-level device through the output end of the feedback monitoring logic line is directly transmitted to the previous device through the straight-through loop of the next-level device; this step is repeated until no feedback is detected at the input end of the feedback monitoring logic line, and it is confirmed as the last device.

[0046] like Figure 3 , Figure 4The second device is working normally, and the MCU2 of the second device sends a chip select control signal CS to control the controllable switch to switch in the detection loop. The MCU2 of the second device detects the control signal through Logic Line_2_IN, and then gives the feedback signal to the previous device through Logic Line_2_feedback, and at the same time sends an enable controller signal EN, which is then given to the third device through the Logic Line_2_OUT logic line. The cycle continues until Logic Line_n_test detects no feedback, automatically distinguishes the two farthest endpoints, and completes the automatic loading of the terminal resistance.

[0047] like Figure 3 , Figure 4 If the working state of the second device is abnormal (power off, shutdown, failure, etc.), the MCU2 of the second device cannot send the chip select control signal CS, and the controllable switch remains in the through loop, directly transmitting the control signal of the previous device to the third device through the Logic Line_2_OUT logic line, automatically completing the filtering of the machine with abnormal working state, and the feedback signal is the same. The Logic Line_3_feedback feedback signal of the third device is directly transmitted to the first device through the through loop of the second device, finally completing the distinction of the farthest endpoint and the automatic loading of the terminal resistance.

[0048] The bus terminal resistor ID self-assignment method corresponding to the above bus terminal resistor automatic loading and ID self-assignment system uses the device ID assignment instruction in conjunction with the logic line level. For example, only when a non-low level device is detected will the instruction to modify the device ID be executed. Figure 6 As shown, the following steps are included:

[0049] In the preset state, before allocating the device ID, the host sends a control command to preset the control detection logic line output terminals of all devices according to the preset configuration. In this embodiment, the control detection logic line output terminals of all devices are pulled low. Figure 3 The Logic Line_T_OUT (T=1, 2, 3...n) of all devices in the system are pulled low. It should be understood that the output terminals of the control detection logic lines of all devices can also be set high, and then the judgment level of the detection signal can be inverted.

[0050] Modify the ID of the first device. At this time, only the Logic Line_1_IN of the first device detects a high level or is suspended. After the host sends the ID modification command, only the first device responds and modifies the ID. After the configuration of the first device is completed, a control signal is sent through the control detection logic line output end to set the control detection logic line output end to the opposite state of the preset state. In this embodiment, the control detection logic line output end of the first device is set high. Figure 3 Set the LogicLine_1_OUT logic line in 100M high.

[0051] Modify the ID of the downstream device, send an ID modification command, the device whose ID has not been modified and whose control detection logic line input terminal state is the opposite state of the preset state responds and modifies the ID, and sends a control signal through the control detection logic line output terminal to set the control detection logic line output terminal to the opposite state of the preset state, and repeat this step until the bus has no response. At this time Figure 3 Only Logic Line_1_IN and Logic Line_2_IN detect non-low level. Because the ID of the first device has been modified, there is no need to respond. Only the second device will respond and modify the device ID, and the automatic ID allocation of all devices will be completed in turn.

[0052] An electronic device, comprising: a processor;

[0053] A memory; and a program, wherein the program is stored in the memory and is configured to be executed by the processor, the program including a method for executing the bus terminal resistance automatic loading and ID self-assignment method.

[0054] A computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement a bus terminal resistance automatic loading and ID self-assignment method.

[0055] A computer program product includes a computer program / instruction, which realizes a bus terminal resistance automatic loading and ID self-assignment method when executed by a processor.

[0056] The above are only preferred embodiments of the present invention and are not intended to limit the present invention in any form. Any ordinary technician in the industry can smoothly implement the present invention as shown in the drawings and above. However, any equivalent changes, modifications and evolutions made by technicians familiar with the profession without departing from the scope of the technical solution of the present invention using the technical content disclosed above are all equivalent embodiments of the present invention. At the same time, any equivalent changes, modifications and evolutions made to the above embodiments based on the essential technology of the present invention are still within the protection scope of the technical solution of the present invention.

Claims

1. A method for automatically loading bus terminal resistance and self-assigning ID, characterized in that: The following steps are involved: Setting state, setting the control detection logic line output of all devices according to the preset configuration; Detection status, detect the status of the control detection logic line input terminal of all devices; Confirm the first device. If it is detected that the state of the control detection logic line input terminal of the device is different from the set state, it is confirmed to be the first device. The first device sends a control signal through the control detection logic line output terminal; Confirm the last device and determine the working status of the next-level device. If it is normal, the next-level device sends a chip selection control signal to control the controllable switch to switch to the detection loop. When the next-level device detects the control signal through the input end of the control detection logic line, it feeds back the signal to the previous device through the output end of the feedback monitoring logic line, and sends an enable controller signal at the same time, and sends the control signal to the next-level device through the output end of the control detection logic line; if it is abnormal, the controllable switch remains in the straight-through loop, and directly sends the control signal to the next-level device through the output end of the control detection logic line. The feedback signal sent by the next-level device through the output end of the feedback monitoring logic line is directly transmitted to the previous device through the straight-through loop of the next-level device; this step is repeated until no feedback is detected at the input end of the feedback monitoring logic line, and it is confirmed as the last device.

2. The method for automatically loading bus terminal resistance and self-assigning ID according to claim 1, characterized in that: Also includes: In the preset state, a control command is sent to preset the control detection logic line output terminals of all devices according to the preset configuration; Modify the ID of the first device, send an ID modification command, the first device responds and modifies the ID, the first device sends a control signal through the control detection logic line output end, and sets the control detection logic line output end to the opposite state of the preset state; Modify the ID of the subsequent device and send an ID modification command. The device whose ID has not been modified and whose input state of the control detection logic line is the opposite of the preset state responds and modifies the ID. A control signal is sent through the output end of the control detection logic line to set the output end of the control detection logic line to the opposite of the preset state. This step is executed repeatedly until there is no response from the bus.

3. The method for automatically loading bus terminal resistance and self-assigning ID according to claim 2, characterized in that: In the state setting step, the control detection logic line output terminals of all devices are pulled low.

4. The method for automatically loading bus terminal resistance and self-assigning ID according to claim 3, characterized in that: In the step of confirming the first device, if it is detected that the state of the control detection logic line input terminal of the device is not a low level, it is confirmed to be the first device.

5. The method for automatic loading of bus terminal resistance and self-assignment of ID as claimed in claim 4, characterized in that: In the step of presetting the state, the output terminals of the control detection logic lines of all devices are pulled low; in the step of modifying the ID of the first device, the output terminal of the control detection logic line of the first device is set high.

6. An electronic device, characterized in that include: processor; Memory; And a program, wherein the program is stored in the memory and configured to be executed by a processor, the program including instructions for executing the method according to any one of claims 1 to 5.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: The computer program is executed by a processor to perform the method according to any one of claims 1 to 5.

8. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the method according to any one of claims 1 to 5 is implemented.

9. A bus terminal resistance automatic loading and ID self-assignment system implementing the method according to any one of claims 1 to 5, characterized in that: Each device in the system has reserved main interface terminals and secondary interface terminals, and the secondary interface terminals of the previous level device are connected with the main interface terminals of the next level device through communication lines, control detection logic lines and feedback monitoring logic lines.

10. The bus terminal resistance automatic loading and ID self-assignment system according to claim 9, characterized in that: It also includes a controllable switch, wherein the secondary interface terminal of the previous stage device is connected to the input terminal of the controllable switch corresponding to the current device through the control detection logic line, the main interface terminal of the next stage device is connected to the input terminal of the controllable switch corresponding to the current device through the feedback monitoring logic line, the first output terminal of the controllable switch corresponding to the current device and the enable terminal of the current device are connected to the input terminal of the controllable switch corresponding to the next stage device through the control detection logic line, the second output terminal of the controllable switch corresponding to the current device is connected to the current device, the coil of the controllable switch corresponding to the current device is connected to the chip selection terminal and the ground of the current device, and the first output terminal of the controllable switch corresponding to the current device and the enable terminal of the current device are connected to the input terminal of the controllable switch corresponding to the previous stage device through the feedback monitoring logic line.