Method and device for determining identity of terminal on AUTBUS and storage medium

By obtaining the MAC address and current detection bits of the AUTBUS bus chip, the terminal identity is automatically determined and the connection is established, which solves the problem of low data transmission efficiency between terminals, and realizes automatic identity adjustment and efficient data transmission.

CN119652633APending Publication Date: 2025-03-18北京东土军悦科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411871818.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-18
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

In the prior art, when the AUTBUS bus transmits data, the terminal identity needs to be manually set, resulting in low data transmission efficiency between terminals.

Method used

By obtaining the MAC address of the AUTBUS bus chip, the terminal identity is determined based on the value of the current detection bit, and a connection is established while the identity is different, and data is transmitted during the detection period.

Benefits of technology

Automatic adjustment of terminal identity is realized, data transmission efficiency between terminals is improved, and inefficiency problems caused by manual identity setting are solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119652633A_ABST
    Figure CN119652633A_ABST
Patent Text Reader

Abstract

The invention relates to a method and device for determining the identity of a terminal on an AUTBUS and a storage medium. The method comprises the following steps: when a first terminal establishes connection with a second terminal through an AUTBUS chip, acquiring an MAC address of the AUTBUS chip of the first terminal; the first identity of the first terminal in the AUTBUS is determined according to the value of the current detection bit of the MAC address, and the current detection bit is any bit in the MAC address; when the first identity of the first terminal is different from the second identity of the second terminal, determining that the first terminal and the second terminal are in a connection state and maintaining two detection periods; controlling the first terminal to transmit data with the second terminal through the AUTBUS in the two detection periods; and when the first identity is the same as the second identity, determining that the first terminal and the second terminal are not in a connection state, and re-determining the first identity of the first terminal by using the other bit of the MAC address as the current detection bit after the two detection periods. According to the method and the device, the technical problem of low data transmission efficiency of the terminal through the AUTBUS is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communications, and in particular to a method, device and storage medium for determining the identity of a terminal on an AUTBUS bus. Background Art

[0002] With the development of the Internet, AUTBUS bus, as a two-wire non-bridge medium, multi-node, high-bandwidth, time-sensitive industrial field bus, is often used for the transmission and application of real-time data and non-real-time data in automated control industrial fields such as process control and discrete control. AUTBUS bus can not only carry other bus services, but also achieve physical layer isolation and non-interference between multiple services through time division multiplexing.

[0003] However, in the prior art, when the AUTBUS bus transmits data, the connected terminals must have a terminal with management node identity and a terminal with terminal node identity, so that the terminals with the two identities can communicate through the AUTBUS bus. The identity of the terminal needs to be set manually, resulting in low efficiency of data transmission between terminals through the AUTBUS bus. Summary of the invention

[0004] The present application provides a method, device and storage medium for determining the identity of a terminal on an AUTBUS bus, so as to solve the technical problem of low efficiency of data transmission by the terminal through the AUTBUS bus.

[0005] In a first aspect, the present application provides a method for determining the identity of a terminal on an AUTBUS bus, comprising: when a first terminal establishes a connection with a second terminal through an AUTBUS bus chip, obtaining the MAC address of the AUTBUS bus chip of the first terminal; determining the first identity of the first terminal in the AUTBUS bus according to the value of a current detection bit of the MAC address, wherein the current detection bit is any bit in the MAC address; when the first identity of the first terminal is different from the second identity of the second terminal, determining that the first terminal and the second terminal are in a connected state and maintaining two detection cycles; controlling the first terminal to transmit data with the second terminal through the AUTBUS bus during the two detection cycles; when the first identity is the same as the second identity, determining that the first terminal and the second terminal are not in a connected state, and using another bit of the MAC address as the current detection bit to re-determine the first identity of the first terminal after the two detection cycles.

[0006] In a second aspect, the present application provides a device for determining the identity of a terminal on an AUTBUS bus, comprising: an acquisition module, used to acquire the MAC address of the AUTBUS bus chip of the first terminal when the first terminal establishes a connection with the second terminal through the AUTBUS bus chip; a first determination module, used to determine the first identity of the first terminal in the AUTBUS bus according to the value of the current detection bit of the MAC address, wherein the current detection bit is any bit in the MAC address; a second determination module, used to determine that the first terminal and the second terminal are in a connected state and maintain two detection cycles when the first identity of the first terminal is different from the second identity of the second terminal; control the first terminal to transmit data with the second terminal through the AUTBUS bus during the two detection cycles; when the first identity is the same as the second identity, determine that the first terminal and the second terminal are not in a connected state, and use another bit of the MAC address as the current detection bit to re-determine the first identity of the first terminal after the two detection cycles.

[0007] As an optional example, the first determination module includes: a first determination unit, used to determine that the first identity of the first terminal is a management node identity when the value of the current detection bit is a first value; and to determine that the first identity of the first terminal is a terminal node identity when the value of the current detection bit is a second value, wherein the first identity is the management node identity or the terminal node identity, and the value of the current detection bit of the first terminal is one of the first value and the second value.

[0008] As an optional example, the above-mentioned device also includes: a third determination module, which is used to use the previous bit of the above-mentioned current detection bit as the new current detection bit; and determine the above-mentioned first identity of the above-mentioned first terminal according to the value of the new current detection bit.

[0009] As an optional example, the above-mentioned device also includes: a traversal module, which is used to, after obtaining the MAC address of the above-mentioned AUTBUS bus chip of the above-mentioned first terminal, start from the starting bit of the above-mentioned MAC address and gradually traverse each bit toward the first bit of the first byte of the above-mentioned MAC address; each time a bit is traversed, the value of the currently traversed bit is determined as the value of the above-mentioned current detection bit, and wait for two detection cycles, wherein the length of the above-mentioned detection cycle is determined according to the frame length of the above-mentioned AUTBUS bus.

[0010] As an optional example, the traversal module further includes: a traversal unit, which is used to start from the starting bit of the MAC address and traverse each bit step by step toward the first bit of the first byte of the MAC address, and after traversing to the first bit of the first byte of the MAC address, re-determine a new starting bit, and start again from the new starting bit and traverse each bit step by step toward the first bit of the first byte of the MAC address.

[0011] As an optional example, the traversal module includes: a second determination unit, used to determine the last bit of the last byte of the MAC address as the starting bit when traversing the MAC address for the first time; when traversing the MAC address for not the first time, determine any bit of any byte of the MAC address as the starting bit.

[0012] As an optional example, the second determination module includes: a third determination unit, which is used to determine that the first identity is different from the second identity when the first identity is a terminal node identity and the second identity is a management node identity, and set the status of the first terminal and the second terminal to a phyUp state, wherein in the phyUp state, the first terminal is connected to the second terminal; when the first identity is a management node identity and the second identity is a terminal node identity, determine that the first identity is different from the second identity, and set the status of the first terminal and the second terminal to a phyUp state, wherein in the phyUp state, the first terminal is connected to the second terminal.

[0013] In a third aspect, the present application provides an electronic device comprising: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; and at least one memory connected to the at least one bus, wherein the memory stores a computer program, and the processor is configured to implement any one of the above-mentioned methods for determining the identity of a terminal on an AUTBUS bus when executing the computer program.

[0014] In a fourth aspect, the present application further provides a computer storage medium storing computer executable instructions, wherein the computer executable instructions are used to execute any of the above methods for determining the identity of a terminal on an AUTBUS bus of the present application.

[0015] The above technical solution provided by the embodiment of the present application has the following advantages compared with the prior art: when the first terminal establishes a connection with the second terminal through the AUTBUS bus chip, the MAC address of the AUTBUS bus chip of the first terminal is obtained; the first identity of the first terminal in the AUTBUS bus is determined according to the value of the current detection bit of the MAC address, wherein the current detection bit is any bit in the MAC address; when the first identity of the first terminal is different from the second identity of the second terminal, it is determined that the first terminal and the second terminal are in a connected state and maintain two detection cycles; within the two detection cycles, the first terminal is controlled to establish a connection with the second terminal through the AUTBUS bus line to transmit data with the above-mentioned second terminal; when the above-mentioned first identity is the same as the above-mentioned second identity, it is determined that the above-mentioned first terminal and the above-mentioned second terminal are not in a connected state, and after the above-mentioned two detection cycles, another bit of the above-mentioned MAC address is used as the above-mentioned current detection bit to re-determine the above-mentioned first identity of the above-mentioned first terminal, so that the first terminal and the second terminal can determine their respective identities according to the current detection bit of their own MAC addresses, and determine whether data can be transmitted within two detection cycles according to the difference in identities, and establish a connection relationship with the second terminal when the identities of the first terminal and the second terminal are different, and transmit data, thereby achieving the effect of automatically adjusting the terminal's own identity during connection, and improving the data transmission efficiency between terminals. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0017] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0018] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.

[0019] Figure 1 A flowchart of a method for determining the identity of a terminal on an AUTBUS bus provided in an embodiment of the present application;

[0020] Figure 2A schematic diagram of establishing a connection on an AUTBUS bus according to a method for determining the identity of a terminal on an AUTBUS bus provided in an embodiment of the present application;

[0021] Figure 3 A detection diagram of a method for determining the identity of a terminal on an AUTBUS bus provided in an embodiment of the present application;

[0022] Figure 4 A detection diagram of another method for determining the identity of a terminal on an AUTBUS bus provided in an embodiment of the present application;

[0023] Figure 5 A detection diagram of another method for determining the identity of a terminal on an AUTBUS bus provided in an embodiment of the present application;

[0024] Figure 6 A detection diagram of another method for determining the identity of a terminal on an AUTBUS bus provided in an embodiment of the present application;

[0025] Figure 7 A schematic diagram of the structure of a device for determining the identity of a terminal on an AUTBUS bus provided in an embodiment of the present application;

[0026] Figure 8 A schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0027] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0028] The disclosure below provides many different embodiments or examples to implement different structures of the present invention. In order to simplify the disclosure of the present invention, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present invention. In addition, the present invention can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.

[0029] In order to solve the technical problem of low efficiency of data transmission between terminals through the AUTBUS bus in the prior art, the present application provides a method for determining the identity of a terminal on the AUTBUS bus, which can achieve the effect of improving the efficiency of data transmission between terminals.

[0030] Figure 1 A flowchart of a method for determining the identity of a terminal on an AUTBUS bus provided in an embodiment of the present application. Figure 1 As shown, the above method for determining the terminal identity on the AUTBUS bus includes:

[0031] S102, when the first terminal establishes a connection with the second terminal through the AUTBUS bus chip, obtaining a MAC address of the AUTBUS bus chip of the first terminal;

[0032] S104, determining a first identity of the first terminal in the AUTBUS bus according to a value of a current detection bit of the MAC address, wherein the current detection bit is any bit in the MAC address;

[0033] S106, when the first identity of the first terminal is different from the second identity of the second terminal, determining that the first terminal and the second terminal are in a connected state and maintaining two detection cycles; and controlling the first terminal to transmit data with the second terminal through the AUTBUS bus during the two detection cycles;

[0034] S108, when the first identity is the same as the second identity, determine that the first terminal and the second terminal are not in a connected state, and use another bit of the MAC address as the current detection bit to re-determine the first identity of the first terminal after the two detection cycles.

[0035] In the above-mentioned AUTBUS bus of this embodiment, on one AUTBUS bus, all connected terminals have 1 CN node (management node) and one or more TN nodes (terminal nodes), and the CN or TN node is also a role node on the AUTBUS bus. The above-mentioned first terminal and the second terminal are role nodes on the above-mentioned AUTBUS bus, the first identity of the first terminal is one of the CN or TN nodes, and the second identity of the second terminal is the other of the CN or TN nodes.

[0036] like Figure 2 The figure is a schematic diagram of establishing a connection for an exemplary AUTBUS bus. Figure 2 In the embodiment, each terminal and a device with a chip having an Ethernet switching function can be used as a node of the present embodiment. For two nodes connected to an AUTBUS bus, one is a first terminal and the other is a second terminal.

[0037] When the first terminal and the second terminal establish a connection through the AUTBUS bus, one terminal needs to have a TN role and the other terminal needs to have a CN role. In this embodiment, when the first terminal and the second terminal establish a connection, the MAC address of the AUTBUS bus chip of each of the first terminal and the second terminal can be obtained. The AUTBUS bus chip is a chip installed on the first terminal and the second terminal to provide the function of the AUTBUS bus. After obtaining the MAC address, the first terminal and the second terminal determine their respective identities based on the current bits on their respective MAC addresses.

[0038] In this embodiment, the length of the MAC address is not limited. In one example, a MAC address of 6 bytes can be used, and each byte includes 8 bits. Then, each MAC address includes 48 bits. In the following discussion, the first bit of the first byte can be regarded as the leftmost bit, and the last bit of the last byte can be regarded as the rightmost bit to assist in the statement.

[0039] The above-mentioned current detection bit is one of the bits of the first terminal and the second terminal. Since the detection timing is different, the detected bit is also different. The currently detected bit is called the current detection bit. The position of the current detection bit in the MAC address can change.

[0040] For example, for the above 48 bits, the current detection bit of the first terminal may be the 12th bit from left to right, and the current detection bit of the second terminal may be the 3rd bit from left to right (12 or 3 is only an example, used to indicate that the current detection bit of the first terminal is not the same as that of the second terminal).

[0041] After the first terminal and the second terminal have determined their identities according to their own MAC addresses, if both are CN roles (nodes) or TN roles (nodes), then the identities of the two are the same, and the two are not connected, but continue to judge their respective identities according to the MAC addresses. The current detection bit of the MAC address used for detection is different from the last detection. Until the identities of the first terminal and the second terminal, one is a CN role (node) and the other is a TN role (node), so that the identities of the two are different. In this case, it is determined that the first terminal and the second terminal are in a connected state, and data can be transmitted through the AUTBUS bus.

[0042] For example, during the first detection, if the identities of the first terminal and the second terminal are the same, then the first terminal and the second terminal cannot be connected, and the two will perform the next identity determination after waiting for two detection cycles. The bit used for the next identity determination is different from the bit used last time. Until the identities of the first terminal and the second terminal are different, the two can establish a connection and maintain two detection cycles, and data can be transmitted during the two detection cycles. After two detection cycles, the first terminal and the second terminal are disconnected and perform the next identity determination. In every two detection cycles, if the identities of the two are different, data is transmitted in the two detection cycles. If the identities of the two are the same, they wait in the two detection cycles until the next detection bit is used to determine the identity.

[0043] The solution provided by the embodiment of the present application obtains the MAC address of the AUTBUS bus chip of the first terminal when the first terminal establishes a connection with the second terminal through the AUTBUS bus chip; determines the first identity of the first terminal in the AUTBUS bus according to the value of the current detection bit of the MAC address, wherein the current detection bit is any bit in the MAC address; when the first identity of the first terminal is different from the second identity of the second terminal, determines that the first terminal is in a connected state with the second terminal and maintains two detection cycles; controls the first terminal to connect to the second terminal through the AUTBUS bus during the two detection cycles. Transmit data; when the above-mentioned first identity is the same as the above-mentioned second identity, determine that the above-mentioned first terminal and the above-mentioned second terminal are not in a connected state, and use the other bit of the above-mentioned MAC address as the above-mentioned current detection bit to re-determine the above-mentioned first identity of the above-mentioned first terminal after the above-mentioned two detection cycles, so that the first terminal and the second terminal can determine their respective identities according to the current detection bit of their own MAC addresses, and determine whether data can be transmitted within two detection cycles according to the difference in identities, and establish a connection relationship with the second terminal when the identities of the first terminal and the second terminal are different, and transmit data, thereby achieving the effect of automatically adjusting the terminal's own identity during the connection process, and improving the data transmission efficiency between terminals.

[0044] As an optional example, determining the first identity of the first terminal in the AUTBUS bus based on the value of the current detection bit of the MAC address includes: when the value of the current detection bit is a first value, determining that the first identity of the first terminal is a management node identity; when the value of the current detection bit is a second value, determining that the first identity of the first terminal is a terminal node identity, wherein the first identity is a management node identity or a terminal node identity, and the value of the current detection bit of the first terminal is one of the first value and the second value.

[0045] In this embodiment, the identity of the first terminal is determined to be a CN identity or a TN identity according to whether the value of the currently detected bit of the MAC address of the first terminal is the first value or the second value. The CN identity is a management node, and the TN identity is a terminal node. If the value of the currently detected bit of the MAC address is 1, it can be a CN identity. If the value of the currently detected bit is 0, it can be a TN identity.

[0046] In this embodiment, the value of the current detection bit is 0 or 1, and the current detection bit of the first terminal is one of the bits of the byte of the MAC address of the first terminal. For example, the MAC address of the first terminal is 00000000 0010001100100101 00110010 0010001001100111, then the current detection bit may be any one of the 48 bits. For example, if the current detection bit is the 8th bit from left to right, the value of the bit is 0, and if it is the 16th bit from left to right, the value of the bit is 1. Depending on the current detection bit, the obtained value is different. And depending on the value, the first identity of the first terminal obtained is different. After each detection, the position of the current detection bit will change, so that the next detection, the bit detected is not the same bit as the bit detected last time. Detect once every two detection cycles, then in every two detection cycles, according to the above MAC address, the identity of the first terminal will switch between the CN identity and the TN identity.

[0047] In this embodiment, 0 can correspond to the CN role of the first terminal and 1 can correspond to the TN role of the first terminal, or 0 can correspond to the TN role of the first terminal and 1 can correspond to the CN role of the first terminal. Through 0 and 1, the first terminal is determined to be a CN role or a TN role.

[0048] As an optional example, using another bit of the MAC address as the current detection bit to re-determine the first identity of the first terminal after two detection cycles of the predetermined time period includes: using the previous bit of the current detection bit as the new current detection bit; and determining the first identity of the first terminal by the value of the new current detection bit.

[0049] In this embodiment, after each detection, the current detection bit determines the first identity of the first terminal according to the value of the current detection bit. Then, the current detection bit moves one bit to the left. At the next detection, the first identity of the first terminal is detected according to the new bit moved to. As another example, it can also be traversed from left to right, or it can be moved multiple bits each time, etc., which are all feasible. The purpose is that the bit of each traversal is not the same as the bit of the previous traversal. If the same bit is used to determine the identity of the first terminal each time the bit is traversed, then the identity of the first terminal will always be one identity and will not change.

[0050] As an optional example, after obtaining the MAC address of the AUTBUS bus chip of the first terminal, the above method also includes: starting from the starting bit of the MAC address, gradually traversing each bit toward the first bit of the first byte of the MAC address; each time a bit is traversed, the value of the currently traversed bit is determined as the value of the current detection bit, and waiting for two detection cycles, wherein the length of the detection cycle is determined according to the frame length of the AUTBUS bus.

[0051] In this embodiment, when starting to traverse the current detection bit of the MAC address of the first terminal, a starting bit can be determined for the MAC address of the first terminal, and the MAC address can be traversed from the starting bit, for example, starting from the starting bit, and traversing the MAC address from right to left, so that the current detection bit used is different each time the detection is performed. After the first role of the first terminal is determined by the value of the current bit detection bit each time, wait for two detection cycles before performing the next detection. That is to say, there are two detection cycles between each two detections. The time length of the detection cycle is determined according to the frame length of the AUTBUS bus.

[0052] For example, during a certain detection, if the value of the current detection bit is 0, it is determined that the first identity of the first terminal is a CN identity. Then, after an interval of two detection cycles, the bit to the left of the last detected bit is detected. For example, if the value is 1, it is determined that the first identity of the first terminal is a TN identity.

[0053] As an optional example, after traversing each bit step by step from the starting bit of the MAC address to the first bit of the first byte of the MAC address, the above method also includes: after traversing to the first bit of the first byte of the MAC address, re-determining a new starting bit, and starting again from the new starting bit, traversing each bit step by step to the first bit of the first byte of the MAC address.

[0054] In this embodiment, in the process of traversing the MAC address of the first terminal, since the traversal starts from the starting bit and each bit is traversed from right to left, if the leftmost bit is traversed, the starting bit needs to be re-determined and the traversal is repeated to the left again, thereby looping the process. Each time the leftmost bit of the MAC address is traversed, the starting bit is re-determined and the traversal is repeated again. By looping this process, the starting bit of each traversal can be different. If the starting bit is the same each time, then the identity of the first terminal will form a cycle, and if the starting bits of the traversal are different, the identity of the first terminal can be completely random.

[0055] As an optional example, determining the starting bit of the MAC address includes: when traversing the MAC address for the first time, determining the last bit of the last byte of the MAC address as the starting bit; when traversing the MAC address for not the first time, determining any bit of any byte of the MAC address as the starting bit.

[0056] In this embodiment, there are multiple ways to determine the starting bit. As one of the ways, when the starting bit is determined for the first time, the rightmost bit of the MAC address can be determined as the starting bit, and traversed from right to left. After the first traversal, when the starting bit is determined again, a bit can be randomly determined from the MAC address as the starting bit, and then the traversal can be started from the new revelation bit from right to left. As another way, when the starting bit is determined for the first time, the rightmost bit of the MAC address can be determined as the starting bit, and traversed from right to left. After the first traversal, when the starting bit is determined again, a non-zero random value can be increased or decreased based on the number of traversals in the first traversal, and the changed number of times can be used as a reference value, starting from the leftmost side of the MAC address, and moving rightward to the reference value. If the reference value is greater than the number of bits of the MAC address, when moving to the rightmost side of the MAC address, move rightward from the leftmost side of the MAC address again, count to the position of the reference value, and use the position as the starting bit.

[0057] As an optional example, when the first identity of the first terminal is different from the second identity of the second terminal, determining that the first terminal is in a connected state with the second terminal includes:

[0058] When the first identity is a terminal node identity and the second identity is a management node identity, determining that the first identity is different from the second identity, setting the states of the first terminal and the second terminal to a phyUp state, wherein in the phyUp state, the first terminal is connected to the second terminal;

[0059] When the first identity is a management node identity and the second identity is a terminal node identity, it is determined that the first identity is different from the second identity, and the states of the first terminal and the second terminal are set to a phyUp state, wherein in the phyUp state, the first terminal is connected to the second terminal.

[0060] In this embodiment, when the first terminal is a CN node and the second terminal is a TN node, or when the first terminal is a TN node and the second terminal is a CN node, it is determined that the identities of the two are different. At this time, the status of the first terminal and the second terminal can be set to the phyUp state, so that the first terminal and the second terminal can transmit data through the AUTBUS bus.

[0061] The following uses the AUTBUS bus as an example. On an AUTBUS bus, all connected terminals have one CN node (management node) and one or more TN nodes (terminal nodes). The CN or TN node is also a role node on the AUTBUS bus. Figure 2 In the network shown, the terminals and communication exchange nodes in a networking system are connected together through the AUTBUS bus. Each pair of interconnected AUTBUS buses is an independent bus. Figure 2 There are 7 AUTBUS buses in total, and each AUTBUS bus involves two nodes: that is, there must be a CN node and a TN node, and the connection order of each terminal (terminal or communication switching node) is also random, so the method of this embodiment requires automatic negotiation for the selection of TN and CN roles. In this embodiment, through collision, a TN node and a CN node are randomly generated between every two AUTBUS communication nodes.

[0062] In this embodiment, the AUTBUS bus supports four different frame time lengths and symbol time lengths, and the parameter MSP can be used to select one of them. The meanings of the four modes are shown in the following table (1):

[0063] Table (1)

[0064] MSP Symbol time length Frame time length 0 62.5us 4ms 1 31.25us 2ms 2 15.625us 1ms 3 7.8125us 500us

[0065] The value of MSP can correspond to the value of frame and symbol.

[0066] For example, select MSP=1. So when MSP is 1, the length of each frame is 1ms. When the CN and TN roles are determined, the AUTBUS bus will exchange information about the physical link. This information can be stabilized in about 64 frames and notify the upper layer whether the physical link is in the phyUp state at this time. Therefore, when MSP is 1, once the CN and TN are determined, the time for the AUTBUS physical layer to complete the negotiation is about within 64ms. Figure 2 Each pair of AUTBUS nodes can set themselves as CN or TN nodes, and the other end can also set itself as CN or TN node, and then wait for two 64ms cycles of the bus (the reason for waiting for two 64ms cycles is to ensure the reliability of detection and prevent the two from being asynchronous and never being detected. This will be explained below and is referred to as the reliable boundary cycle below). Once the local AUTBUS bus link is detected to be in the phyUp state, the collision stops, indicating that there are already one CN role and one TN role on the bus.

[0067] Each AUTBUS chip is set with a 6-byte MAC address, which is unique. This totals 48 bits. The collision algorithm starts from the rightmost bit of the MAC address. If the value of this bit is 1, it configures itself as a CN role and maintains two detection cycles for a total of 128ms and detects the phyUp status flag within these 128ms. If the value of this bit is 0, it configures itself as a TN role and maintains the detection of the phyUp status flag within 128ms.

[0068] exist Figure 3 In the example, the MAC address of node 1 is 00-23-45-34-22-67, and the MAC address of node 2 is 00-EF-56-22-33-13. The rightmost part of the figure shows the binary representation of the MAC address. From right to left, you can see that the bit value of the second bit is inconsistent.

[0069] For example, if two terminals simultaneously detect the bit values ​​of the rightmost bits of their respective MAC addresses, the collision begins at the same time, and the process is as follows:

[0070] During the first collision, the first bit from right to left is 1, so the first terminal sets itself as the CN role, and the second terminal also sets itself as the CN role, and both wait for 128ms. Since both roles are CN during this period, the phyUp state cannot be detected. After the 128ms timeout, everyone enters the second 128ms cycle.

[0071] When entering the second 128ms cycle, both terminals simultaneously detect the state of the second bit from right to left and find that both are 1. Therefore, the first terminal and the second terminal still set themselves as CN roles and still detect the phyUp state in this 128ms cycle, which is obviously undetectable. After the 128ms timeout, the third detection cycle will be entered.

[0072] After entering the third 128ms cycle, since the values ​​of the third bit from right to left are different, one is 0 and the other is 1, one will set itself as the CN role and the other will set itself as the TN role. In this 128ms, because there is one CN and one TN, both will detect the link status phyUp, indicating that the CN and TN roles have been negotiated correctly, and the negotiation process can be ended at this time.

[0073] The above 128ms, i.e. waiting for two detection cycles, has a reason. This is called the reliable boundary late principle. Under normal circumstances, the link information phyUp state can be detected within one detection cycle, but there is a time asynchrony difference between the two colliding nodes, which makes them never synchronized when they should be synchronized. If you wait for one detection cycle, assuming that the MAC address is 8 bits. Since the two terminals are asynchronous, the start time is different. Figure 4 As shown in the figure, the rightmost bit is regarded as bit0, and the left bits are bit1, bit2, etc. At the first time point, one of the terminals in node 1 and node 2 is within the 1ms, while the other terminal is within the 63ms. Therefore, the role of one terminal is CN and the role of the other terminal is TN. Since the state of one terminal switches only 1ms, neither terminal can detect the phyUp status information of the link at this time. At the second time point, the time axis of one terminal is at 3ms, while the time axis of the other terminal is at 1ms, and it jumps from bit3 to bit4. Therefore, at this time, one terminal is still CN, while the other terminal changes from TN to CN. At this time, since the 64ms detection cycle has not arrived and both are CN roles, the phyUp status information of the link cannot be detected. At the third time point, in fact, a 60ms cycle has been experienced based on time point 2. Therefore, the roles remain unchanged and both have experienced a 60ms cycle. At this time, since the roles are consistent and the time has not reached the 64ms reliable time, neither terminal can detect the phyUp status information. At the fourth time point, the role of one terminal changes from CN to TN, while the other terminal remains in the last 2 ms of CN. At the fifth time point, the role of the other terminal changes from CN to TN due to the expiration of 64 ms. At this time, both the one terminal and the other terminal are in the TN role, so the phyUp status information of the link cannot be detected in the following cycle.

[0074] Therefore, in order to avoid this situation, wait for two detection cycles, that is, 128ms. Figure 5 As shown in the figure, at the first time point, one of the terminals in Node 1 and Node 2 is in the CN role and has just maintained it for 1ms, while the other terminal is in the TN role and has maintained it for 63ms. After a 64ms period, one terminal has maintained the CN role for 65ms, while the other terminal has maintained the TN role for 127ms. The time that the CN and TN roles coexist on the bus reaches a safe time (64ms), so the phyUp state can be detected at this time and the negotiation process ends.

[0075] In addition, there are still extreme cases where negotiation fails during the negotiation process. That is, if each traversal starts from bit 0 and traverses to the left, then Figure 6 As shown, in the first time period, the starting position of one terminal in node 1 and node 2 is bit0, and the starting position of the other terminal is bit1. The values ​​of both bits are 1, so one terminal and the other terminal are both CN roles, and the overlap time is greater than the 64ms period. In the second time period, one terminal and the other terminal are both TN roles, and the overlap time is greater than the 64ms period. In the third time period, one terminal and the other terminal are in the CN role at the same time, and the overlap time is greater than the 64ms period. If a MAC address happens to have this kind of misalignment from bit0 to bit47, then if the next polling cycle is still repeated, it will enter a situation where negotiation cannot be successful. Therefore, in the first traversal, start from bit0 and traverse to the left to bit47, and then in the next traversal, generate 2 random seeds, one is the MAC index start information, and the other is the retention time of bit0. The first random number MAC index position is a random number from 0 to 47, according to Figure 6 It can be seen that the location information of the two terminals always differs by 1. If a random number from 0 to 47 is used, one terminal may start from bit 5, while the other terminal may start from bit 36, and the two will no longer differ by 1. This breaks the situation where negotiation cannot be successful.

[0076] Figure 7 The present invention provides a schematic diagram of a device for determining the identity of a terminal on an AUTBUS bus. Figure 7 As shown, the above-mentioned device for determining the terminal identity on the AUTBUS bus includes:

[0077] The acquisition module 702 is used to acquire the MAC address of the AUTBUS bus chip of the first terminal when the first terminal establishes a connection with the second terminal through the AUTBUS bus chip;

[0078] A first determination module 704 is used to determine a first identity of the first terminal in the AUTBUS bus according to a value of a current detection bit of the MAC address, wherein the current detection bit is any bit in the MAC address;

[0079] The second determination module 706 is used to determine that the first terminal and the second terminal are in a connected state and maintain two detection cycles when the first identity of the first terminal is different from the second identity of the second terminal; control the first terminal to transmit data with the second terminal through the AUTBUS bus during the two detection cycles; when the first identity is the same as the second identity, determine that the first terminal and the second terminal are not in a connected state, and use another bit of the MAC address as the current detection bit to re-determine the first identity of the first terminal after the two detection cycles.

[0080] In the above-mentioned AUTBUS bus of this embodiment, on one AUTBUS bus, all connected terminals have 1 CN node (management node) and one or more TN nodes (terminal nodes), and the CN or TN node is also a role node on the AUTBUS bus. The above-mentioned first terminal and the second terminal are role nodes on the above-mentioned AUTBUS bus, the first identity of the first terminal is one of the CN or TN nodes, and the second identity of the second terminal is the other of the CN or TN nodes.

[0081] like Figure 2 The figure is a schematic diagram of establishing a connection for an exemplary AUTBUS bus. Figure 2 In the embodiment, each terminal and a device with a chip having an Ethernet switching function can be used as a node of the present embodiment. For two nodes connected to an AUTBUS bus, one is a first terminal and the other is a second terminal.

[0082] When the first terminal and the second terminal establish a connection through the AUTBUS bus, one terminal needs to have a TN role and the other terminal needs to have a CN role. In this embodiment, when the first terminal and the second terminal establish a connection, the MAC address of the AUTBUS bus chip of each of the first terminal and the second terminal can be obtained. The AUTBUS bus chip is a chip installed on the first terminal and the second terminal to provide the function of the AUTBUS bus. After obtaining the MAC address, the first terminal and the second terminal determine their respective identities based on the current bits on their respective MAC addresses.

[0083] In this embodiment, the length of the MAC address is not limited. In one example, a MAC address of 6 bytes can be used, and each byte includes 8 bits. Then, each MAC address includes 48 bits. In the following discussion, the first bit of the first byte can be regarded as the leftmost bit, and the last bit of the last byte can be regarded as the rightmost bit to assist in the statement.

[0084] The above-mentioned current detection bit is one of the bits of the first terminal and the second terminal. Since the detection timing is different, the detected bit is also different. The currently detected bit is called the current detection bit. The position of the current detection bit in the MAC address can change.

[0085] For example, for the above 48 bits, the current detection bit of the first terminal may be the 12th bit from left to right, and the current detection bit of the second terminal may be the 3rd bit from left to right (12 or 3 is only an example, used to indicate that the current detection bit of the first terminal is not the same as that of the second terminal).

[0086] After the first terminal and the second terminal have determined their identities according to their own MAC addresses, if both are CN roles (nodes) or TN roles (nodes), then the identities of the two are the same, and the two are not connected, but continue to judge their respective identities according to the MAC addresses. The current detection bit of the MAC address used for detection is different from the last detection. Until the identities of the first terminal and the second terminal, one is a CN role (node) and the other is a TN role (node), so that the identities of the two are different. In this case, it is determined that the first terminal and the second terminal are in a connected state, and data can be transmitted through the AUTBUS bus.

[0087] For example, during the first detection, if the identities of the first terminal and the second terminal are the same, then the first terminal and the second terminal cannot be connected, and the two will perform the next identity determination after waiting for two detection cycles. The bit used for the next identity determination is different from the bit used last time. Until the identities of the first terminal and the second terminal are different, the two can establish a connection and maintain two detection cycles, and data can be transmitted during the two detection cycles. After two detection cycles, the first terminal and the second terminal are disconnected and perform the next identity determination. In every two detection cycles, if the identities of the two are different, data is transmitted in the two detection cycles. If the identities of the two are the same, they wait in the two detection cycles until the next detection bit is used to determine the identity.

[0088] The solution provided by the embodiment of the present application obtains the MAC address of the AUTBUS bus chip of the first terminal when the first terminal establishes a connection with the second terminal through the AUTBUS bus chip; determines the first identity of the first terminal in the AUTBUS bus according to the value of the current detection bit of the MAC address, wherein the current detection bit is any bit in the MAC address; when the first identity of the first terminal is different from the second identity of the second terminal, determines that the first terminal is in a connected state with the second terminal and maintains two detection cycles; controls the first terminal to connect to the second terminal through the AUTBUS bus during the two detection cycles. Transmit data; when the above-mentioned first identity is the same as the above-mentioned second identity, determine that the above-mentioned first terminal and the above-mentioned second terminal are not in a connected state, and use the other bit of the above-mentioned MAC address as the above-mentioned current detection bit to re-determine the above-mentioned first identity of the above-mentioned first terminal after the above-mentioned two detection cycles, so that the first terminal and the second terminal can determine their respective identities according to the current detection bit of their own MAC addresses, and determine whether data can be transmitted within two detection cycles according to the difference in identities, and establish a connection relationship with the second terminal when the identities of the first terminal and the second terminal are different, and transmit data, thereby achieving the effect of automatically adjusting the terminal's own identity during the connection process, and improving the data transmission efficiency between terminals.

[0089] For other examples of this embodiment, please refer to the above examples and will not be described in detail here.

[0090] like Figure 8 As shown, an embodiment of the present application provides an electronic device, including a processor 111, a communication interface 112, a memory 113 and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114.

[0091] A memory 113, for storing computer programs;

[0092] In one embodiment of the present application, the processor 111 is configured to implement the method for determining the identity of a terminal on the AUTBUS bus provided by any one of the aforementioned method embodiments when executing the program stored in the memory 113 .

[0093] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for determining the identity of a terminal on an AUTBUS bus provided in any of the aforementioned method embodiments is implemented.

[0094] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0095] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0096] It should be understood that the terms used herein are only for the purpose of describing specific example embodiments and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used herein may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.

[0097] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A method for determining the identity of a terminal on an AUTBUS bus, characterized in that: include: When a first terminal establishes a connection with a second terminal through an AUTBUS bus chip, obtaining a MAC address of the AUTBUS bus chip of the first terminal; Determine a first identity of the first terminal in the AUTBUS bus according to a value of a current detection bit of the MAC address, wherein the current detection bit is any bit in the MAC address; When the first identity of the first terminal is different from the second identity of the second terminal, determining that the first terminal and the second terminal are in a connected state and maintaining two detection cycles; and controlling the first terminal to transmit data with the second terminal through the AUTBUS bus during the two detection cycles; When the first identity is the same as the second identity, it is determined that the first terminal and the second terminal are not in a connected state, and the first identity of the first terminal is re-determined using another bit of the MAC address as the current detection bit after the two detection cycles.

2. The method according to claim 1, characterized in that The determining the first identity of the first terminal in the AUTBUS bus according to the value of the current detection bit of the MAC address includes: When the value of the current detection bit is a first value, determining that the first identity of the first terminal is a management node identity; When the value of the current detection bit is the second value, the first identity of the first terminal is determined to be a terminal node identity, wherein the first identity is the management node identity or the terminal node identity, and the value of the current detection bit of the first terminal is one of the first value and the second value.

3. The method according to claim 1, characterized in that Using another bit of the MAC address as the current detection bit to re-determine the first identity of the first terminal after two detection cycles of the predetermined time period includes: Using the previous bit of the current detection bit as a new current detection bit; The first identity of the first terminal is determined by the value of the new current detection bit.

4. The method according to claim 1, characterized in that After acquiring the MAC address of the AUTBUS bus chip of the first terminal, the method further includes: Starting from the start bit of the MAC address, and moving toward the first bit of the first byte of the MAC address, traversing each bit step by step; Each time a bit is traversed, the value of the currently traversed bit is determined as the value of the currently detected bit, and two detection cycles are waited, wherein the length of the detection cycle is determined according to the frame length of the AUTBUS bus.

5. The method according to claim 4, characterized in that After gradually traversing each bit from the start bit of the MAC address to the first bit of the first byte of the MAC address, the method further includes: After traversing to the first bit of the first byte of the MAC address, a new starting bit is re-determined, and starting from the new starting bit again, each bit is traversed step by step toward the first bit of the first byte of the MAC address.

6. The method according to claim 4, characterized in that Determining the starting bit of the MAC address includes: When traversing the MAC address for the first time, determining the last bit of the last byte of the MAC address as the start bit; When the MAC address is not traversed for the first time, any bit of any byte of the MAC address is determined as the start bit.

7. The method according to claim 1, characterized in that When the first identity of the first terminal is different from the second identity of the second terminal, determining that the first terminal and the second terminal are in a connected state includes: When the first identity is a terminal node identity and the second identity is a management node identity, determining that the first identity is different from the second identity, and setting the states of the first terminal and the second terminal to a phyUp state, wherein in the phyUp state, the first terminal is connected to the second terminal; When the first identity is a management node identity and the second identity is a terminal node identity, it is determined that the first identity is different from the second identity, and the status of the first terminal and the second terminal are set to a phyUp state, wherein in the phyUp state, the first terminal is connected to the second terminal.

8. A device for determining the identity of a terminal on an AUTBUS bus, characterized in that: include: An acquisition module, used for acquiring a MAC address of the AUTBUS bus chip of the first terminal when the first terminal establishes a connection with the second terminal through the AUTBUS bus chip; A first determination module, configured to determine a first identity of the first terminal in the AUTBUS bus according to a value of a current detection bit of the MAC address, wherein the current detection bit is any bit in the MAC address; The second determination module is used to determine that the first terminal and the second terminal are in a connected state and maintain two detection cycles when the first identity of the first terminal is different from the second identity of the second terminal; control the first terminal to transmit data with the second terminal through the AUTBUS bus during the two detection cycles, and when the first identity is the same as the second identity, determine that the first terminal and the second terminal are not in a connected state, and use another bit of the MAC address as the current detection bit to re-determine the first identity of the first terminal after the two detection cycles.

9. An electronic device, characterized in that: include: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor coupled to the at least one bus; At least one memory connected to the at least one bus, wherein the memory stores a computer program, and when the processor executes the computer program, the method for determining the identity of a terminal on an AUTBUS bus as claimed in any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute the method for determining the identity of a terminal on an AUTBUS bus as described in any one of claims 1 to 7 of the present application.