Communication method and device for bus network, equipment and medium

By introducing a distributed competition process and a centralized arbitration mechanism into the RS-485 bus network, the weight values ​​of slave nodes are dynamically adjusted, solving the problems of poor real-time performance and inevitable conflicts in traditional communication methods, and realizing efficient and reliable interrupted data transmission.

CN121509145APending Publication Date: 2026-02-10TIANJIN KAREL ROBOT TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202610038531.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-13
Publication Date
2026-02-10

AI Technical Summary

Technical Problem

In existing RS-485 bus networks, the traditional polling mechanism results in poor system real-time performance, which cannot meet the requirements for rapid response to events such as fault alarms. Furthermore, the transmission of high-priority information under the CSMA/CD mechanism is uncertain, which can easily lead to conflicts and lacks an effective resolution mechanism, increasing cabling costs.

Method used

By adopting a distributed competition process and a centralized arbitration mechanism, dynamic weight adjustment of slave nodes is achieved by configuring static basic priority and dynamic urgency values ​​for slave nodes and calculating dynamic weight values. Arbitration is then carried out at the master node to avoid conflicts and reduce arbitration costs.

Benefits of technology

It achieves efficient and reliable interrupt data transmission, ensures timely transmission of critical information, reduces arbitration costs, and improves the real-time performance and reliability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121509145A_ABST
    Figure CN121509145A_ABST
Patent Text Reader

Abstract

The invention provides a communication method, device and equipment for a bus network and a medium, the method is applied to a master node and a plurality of slave nodes, and the method comprises the following steps: when at least one slave node in the plurality of slave nodes has interrupt data to be sent; at least one slave node executes a distributed competition process, and enters a corresponding target competition back-off window according to a competition result; at least one slave node sends a message indicating whether the bus is idle or not to the master node; and after receiving the response of the master node, at least one slave node confirms that the bus is idle and sends the interrupt data to the master node. The method provided by the invention can avoid conflicts when the slave nodes send the interrupt data at the same time, reduce the cost of arbitration communication, improve the efficiency of interrupt data transmission, and ensure the reliability of interrupt data transmission.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of bus-based communication technology, and more particularly to a communication method, apparatus, device, and medium for bus networks. Background Technology

[0002] Currently, with the continuous development of communication technology, RS-485 bus-based communication technology is increasingly being applied across various industries. Because of its simple structure, low cost, and strong anti-interference capabilities, the RS-485 bus is widely used in industrial control. Traditional RS-485 master-slave communication uses a polling mechanism, where the master node sequentially queries each slave node, resulting in poor system real-time performance and an inability to meet the rapid response requirements for events such as fault alarms and emergency shutdowns.

[0003] To address this, existing technologies have introduced interrupt mechanisms based on carrier sense and random backoff (such as CSMA / CD), allowing slave nodes to proactively report. However, under a pure CSMA / CD mechanism, all slave nodes are equal, making it impossible to guarantee the priority transmission of high-priority information. When multiple slave nodes initiate interrupts simultaneously, conflicts are inevitable, and high-priority information may experience similar delays to low-priority information due to the randomness of backoff, failing to meet the deterministic requirements for critical information transmission in industrial control.

[0004] Furthermore, in situations where node weights are similar, leading to persistent conflicts, the lack of an effective resolution mechanism could result in the indefinite delay of critical information. While additional arbitration lines could be introduced, this increases the complexity and cost of the wiring.

[0005] Therefore, a new communication method for bus networks is urgently needed to solve the problems existing in the current technology. Summary of the Invention

[0006] This invention provides a communication method, apparatus, device, and medium for bus networks to solve the technical problems in the prior art where interrupt mechanisms easily lead to communication conflicts between slave nodes, making it impossible to determine key information, and where arbitration lines increase wiring costs. The invention aims to adjust the dynamic weight values ​​of slave nodes and allow the master node to perform priority arbitration based on the magnitude of the dynamic weight values ​​to avoid communication conflicts between slave nodes, while also reducing the cost of arbitration.

[0007] In a first aspect, the present invention provides a communication method for a bus network, the method being applied to a master node and multiple slave nodes, the method comprising: When at least one of the plurality of slave nodes has interrupted data to be sent; The at least one slave node executes a distributed competition process and enters the corresponding target competition backoff window based on the competition result; The at least one slave node sends a message to the master node indicating whether the bus is idle; Upon receiving a response from the master node, at least one slave node confirms that the bus is idle and sends the interrupt data to the master node.

[0008] Furthermore, according to the communication method provided by the present invention, before at least one of the plurality of slave nodes has interrupted data to be sent, the method further includes: The master node configures a static base priority for each of the plurality of slave nodes; The multiple slave nodes are grouped differently based on the static basic priority.

[0009] Furthermore, according to the communication method provided by the present invention, before at least one of the plurality of slave nodes has interrupted data to be sent, the method further includes: Pre-confirm the event types and dynamic urgency values ​​of the multiple slave nodes; Based on the event type and dynamic urgency value, a mapping table of event type and dynamic urgency value is obtained.

[0010] Furthermore, according to the communication method provided by the present invention, the at least one slave node executes a distributed contention process and enters the corresponding target contention backoff window according to the contention result, including: The at least one slave node continuously monitors whether the bus is idle; If the bus is determined to be idle, the at least one slave node enters the basic backoff window, calculates the dynamic weight, and obtains the target dynamic weight value. The target contention avoidance window is determined based on the basic avoidance window and the target dynamic weight value, and then the target contention avoidance window is entered.

[0011] Furthermore, according to the communication method provided by the present invention, the calculation of dynamic weights to obtain the corresponding target dynamic weight values ​​includes: The target dynamic weight value is obtained based on the static basic priority and the dynamic urgency value of the interrupted data to be sent; the specific calculation formula is as follows: W = P_base + E, Wherein, W represents the target dynamic weight value, P_base represents the static base priority, and E represents the dynamic urgency value of the interrupt data to be sent; wherein, the dynamic urgency value of the interrupt data to be sent is obtained based on a preset mapping table of event type and dynamic urgency value.

[0012] Furthermore, according to the communication method provided by the present invention, the at least one slave node sends a message to the master node indicating whether the bus is idle; after receiving the response from the master node, the at least one slave node confirms that the bus is idle and sends the interrupt data to the master node, including: The at least one slave node selects a target time point in the target contention backoff window and sends a message to the master node again indicating whether the bus is idle. Upon receiving the response from the master node, and determining that the bus is idle at the target time point, the interrupt data is sent to the master node; If no response is received from the master node, it is determined that the bus is not idle at the target time point, and the binary exponential backoff algorithm is initiated to resend.

[0013] Furthermore, according to the communication method provided by the present invention, the method further includes: The master node listens for interrupt communication messages on the bus; When the master node determines that there is a communication conflict in the same group based on the interrupted communication message, it broadcasts an arbitration polling frame to determine the target group. The first and second slave nodes in the target group that have conflicts report their IDs and first dynamic weight values, and their IDs and second dynamic weight values ​​to the master node, respectively. The master node determines the target slave node based on the first dynamic weight value and the second dynamic weight value; The master node sends a communication authorization frame to the target slave node.

[0014] Furthermore, according to the communication method provided by the present invention, after the at least one slave node sends the interrupt data to the master node upon confirming that the bus is idle, the method further includes: After the interrupted data is successfully transmitted, the dynamic weight value of the at least one slave node is restored to the static base priority.

[0015] Secondly, the present invention provides a communication device for a bus network, the device being applied to a master node and multiple slave nodes, the device comprising: The detection module is used to detect when at least one of the plurality of slave nodes has interrupted data to be sent; The priority configuration module is used by the at least one slave node to execute the distributed competition process and enter the corresponding target competition backoff window according to the competition result; The message sending module is used for the at least one slave node to send a message to the master node indicating whether the bus is idle; A data transmission module is used for the at least one slave node to send the interrupt data to the master node after receiving a response from the master node and confirming that the bus is idle.

[0016] Thirdly, the present invention provides an electronic device comprising: Processor, memory, and bus, among which, The processor and the memory communicate with each other via the bus; The memory stores program instructions that can be executed by the processor, which can invoke the program instructions to perform the steps of the communication method for the bus network as described in any of the preceding items.

[0017] Fourthly, the present invention provides a non-transitory computer-readable storage medium storing computer instructions that cause a computer to perform the steps of the communication method for a bus network described in any of the preceding claims.

[0018] Fifthly, the present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the communication method for a bus network as described in any of the preceding claims.

[0019] This invention provides a communication method for a bus network, applied to a master node and multiple slave nodes. The method includes: when at least one of the slave nodes has interrupt data to be sent; at least one slave node executes a distributed contention process, entering a corresponding target contention backoff window based on the contention result; at least one slave node sends a message to the master node indicating whether the bus is idle; and upon receiving a response from the master node, at least one slave node confirms that the bus is idle and sends the interrupt data to the master node. The method provided by this invention avoids conflicts when slave nodes simultaneously send interrupt data, reduces the cost of arbitration communication, improves the efficiency of interrupt data transmission, and ensures the reliability of interrupt data transmission. Attached Figure Description

[0020] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0021] Figure 1 This is a schematic diagram of the overall process of a communication method for a bus network provided by the present invention; Figure 2 This is a schematic diagram of the circuit principle structure for implementing the communication method provided by this invention; Figure 3 This is a schematic diagram illustrating the overall architecture and communication process of the communication method provided by the present invention; Figure 4 This is a schematic diagram of the distributed contention backoff process provided by the present invention; Figure 5 This is a schematic diagram of the master node centralized arbitration process provided by the present invention; Figure 6 This is a schematic diagram of the sensor hardware architecture and key information provided by the present invention; Figure 7 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation

[0022] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0023] To provide a better understanding of this invention, some of its application techniques and specific application scenarios, as well as the resulting technical effects, will be further introduced below.

[0024] Before introducing the technical solution of this invention, a brief introduction to related technologies will be given first: RS-485 is a typical serial communication standard that defines voltage, impedance, etc., but does not define software protocols.

[0025] Interrupted data: In communication, interrupted data refers to data interaction that occurs during data transmission when an unexpected event requires pausing the current task and switching to handle a higher priority event.

[0026] Interrupt Mechanism: The interrupt mechanism suspends the current task and saves the current state, then handles emergency events (such as power failures, data reception timeouts, etc.) to ensure timely processing of critical information. For example, in UART communication, an interrupt is triggered when data reception times out or an error occurs, preventing data loss.

[0027] Personalized competitive backoff window: This is a strategy that optimizes resource allocation or user experience by dynamically adjusting competitive parameters (such as window size), and is commonly found in network communications, marketing strategies, and intelligent dialogue systems.

[0028] Dynamic urgency value: Usually denoted as E, it is a real-time changing value used to quantify the urgency of an event currently pending on a slave node. It serves as a bridge connecting physical world events and communication scheduling strategies, and is key to the system's "intelligent response."

[0029] E is a variable: unlike the fixed P_base, E changes dynamically with the node's own state and the occurrence of external events.

[0030] E is the increment of weight W: W = P_base + E. The value of E directly determines how much the current weight W can be increased based on P_base.

[0031] E is the result of local decision-making: each node independently determines its current E value based on its own sensor inputs or internal logic.

[0032] The present invention aims to solve the technical problems in the existing RS-485 interrupt communication mechanism, which are caused by the lack of priority scheduling and conflict resolution strategies that are deeply integrated with the hardware, resulting in uncertain delays in the transmission of high-priority information and reduced system reliability under conflict stalemate.

[0033] In one embodiment of the present invention, such as Figure 1 As shown, this invention provides a flowchart of a communication method for a bus network, which is applied to one master node and multiple slave nodes. The method includes: When at least one of the plurality of slave nodes has interrupted data to be sent; The at least one slave node executes a distributed competition process and enters the corresponding target competition backoff window based on the competition result; The at least one slave node sends a message to the master node indicating whether the bus is idle; Upon receiving a response from the master node, at least one slave node confirms that the bus is idle and sends the interrupt data to the master node.

[0034] In this embodiment, the method provided by the present invention is a complete solution from the physical layer to the protocol layer, including a master node and multiple slave nodes. Its core is applied to a layered conflict resolution framework that combines distributed competition and centralized arbitration, and it makes deep use of hardware characteristics to optimize performance.

[0035] Upon detecting that at least one of the multiple slave nodes has interrupt data to be sent, the slave node executes a distributed contention process. Based on the contention result, it enters the corresponding target contention backoff window (personalized contention backoff window). At a certain point in this window, it checks with the master node again whether the bus is idle. If the bus is idle, it sends the interrupt data to the master node via the bus. The specific implementation method can be seen in the following embodiment, which will not be described in detail here.

[0036] The method protected by this invention is based on Figure 2 The circuit structure shown in the schematic diagram is a preferred embodiment and is not specifically limited. The device consists of DIP switches, capacitors, resistors, etc. In this embodiment, the grouping is based on the binary encoding of the DIP switches. Hardware basis: an 8-bit DIP switch (SW1) is used, and some bits (such as SW1-1 and SW1-2) are used to encode 4 groups (00, 01, 10, 11).

[0037] Circuit connection: Connect the selected DIP switch output pin to the GPIO input pin of STM32F030K6T6 (U7) (e.g., PA0, PA1), and ensure the pin level is stable by using pull-up resistors (e.g., R8, R9).

[0038] Software logic: When the system is powered on and initialized, the MCU reads the level status of the GPIO (General Purpose Input / Output).

[0039] Based on a predefined encoding table, the static grouping of the slave node is parsed out.

[0040] PA1=0, PA0=0 → Group A PA1=0, PA0=1 → Group B PA1=1, PA0=0 → Group C PA1=1, PA0=1 → Group D (backup) Advantages: Intuitive configuration, low cost, stable and reliable operation.

[0041] Mapping of static packets in the arbitration algorithm: Packet information will be directly mapped to the core parameters of the communication protocol, mainly reflected in the "basic backoff window".

[0042] Parameterized configuration: The firmware of the master node or each slave node contains a parameter table corresponding to the group. The specific parameters are shown in Table 1 below.

[0043] Table 1. Static grouping parameters of slave nodes: .

[0044] According to the present invention, a communication method for a bus network is provided, which is applied to a master node and multiple slave nodes. The method includes: when at least one of the multiple slave nodes has interrupt data to be sent; at least one slave node executes a distributed contention process, and enters a corresponding target contention backoff window according to the contention result; at least one slave node sends a message to the master node indicating whether the bus is idle; after receiving a response from the master node, at least one slave node confirms that the bus is idle and sends the interrupt data to the master node. The method provided by the present invention can avoid conflicts when slave nodes send interrupt data simultaneously, reduce the cost of arbitration communication, improve the efficiency of interrupt data transmission, and ensure the reliability of interrupt data transmission.

[0045] In another embodiment of the invention, before at least one of the plurality of slave nodes has interrupted data to be sent, the method further includes: The master node configures a static basic priority for each of the plurality of slave nodes; and determines different groups of the plurality of slave nodes according to the static basic priority.

[0046] Before at least one of the plurality of slave nodes has interrupted data to be sent, the method further includes: The event types and dynamic urgency values ​​of the multiple slave nodes are pre-confirmed; based on the event types and dynamic urgency values, a corresponding mapping table of event types and dynamic urgency values ​​is obtained.

[0047] In this embodiment, the master node pre-configures a static base priority P_base for each slave node in the bus network. Each slave node has physical configuration circuitry (as per principle). Figure 2 The SW1 8-bit DIP switch is used to set and store the P_base value of the node in the field via hardware, without modifying the software code. Each slave node maintains a dynamic weight value W, calculated as: W = P_base + E. Here, E is the dynamic urgency value of the data to be sent by the node, which can be triggered by an external event sensor (such as a photoelectric sensor) connected to the STM32F030K6T6 (U7). When the sensor detects a specific event (such as a book arriving), it assigns the highest urgency (e.g., E=3).

[0048] In this embodiment, personalized backoff contention is based on dynamic weight values. When a slave node has interrupted data to be sent, the following distributed contention process is executed: a. Continuously monitor the idle status of the RS-485 bus and use the "idle interrupt" function of the UART module of STM32F030K6T6 (U7) to accurately and with low latency determine whether the bus is idle.

[0049] b. After the bus becomes idle, the slave node enters the basic backoff window corresponding to its static group.

[0050] c. Calculate the current dynamic weight value W from the node, and determine its personalized contention backoff window accordingly: [T_min, T_min + (K / W)]. Where T_min is the minimum waiting time for this group, and K is a system constant.

[0051] The formula for calculating the dynamic weight value W is: W = P_base + E: Where: P_base represents the static base priority, a fixed value that remains unchanged. It is set by a hardware DIP switch and represents the slave node's "identity" and "basic rights." E represents the dynamic urgency value, a variable that changes constantly. It is assigned a different value in real time based on the specific event type the slave node is currently waiting to send. A higher E value indicates a more urgent event.

[0052] In this embodiment, the assignment strategy for E is illustrated by the following example. The system predefines an "event type - dynamic urgency value" mapping table, which is pre-fixed in the firmware of the slave node. The specific mapping relationship is shown in Table 2 below.

[0053] Table 2 Mapping Table of Event Type - Dynamic Urgency: .

[0054] As shown in Table 2 above, an example of the dynamic weight value change process is illustrated by tracking a slave node (node ​​X) connected to a photoelectric sensor and observing how its dynamic weight value W and personalized competition backoff window change dynamically.

[0055] Step 1: Initial state; Slave node X is set to Group B via a DIP switch, with P_base = 60. Slave node X has no data to send and is in an idle listening state. At this time, E = 0, and the dynamic weight value of slave node X is W = 60 + 0 = 60. The personalized contention backoff window is (assuming K = 600, T_min = 5ms): [5, 5 + (600 / 60)] = [5, 15] ms, which is a relatively wide window.

[0056] Step 2: Event Trigger (Weight Surge); If a book blocks the photoelectric sensor (U9), the STM32 detects the change in the sensor's output and generates an interrupt. According to the mapping table, this "book in place" event belongs to "external alarm," E = 30. The dynamic weight value is immediately updated to W = 60 + 30 = 90. At this time, the personalized contention backoff window of node X immediately changes to: [5, 5 + (600 / 90)] ≈ [5, 11.7] ms. The personalized contention backoff window is significantly narrowed.

[0057] Step 3: Node contention and transmission; Once node X detects that the bus is idle, it will randomly select a time point within a new, narrower window [5, 11.7] ms to send data. Because the window is narrower, the probability that node X will send data before ordinary nodes that are still in a wider window (such as [5, 15] ms) is greatly increased.

[0058] The "Books arrived" message was successfully sent.

[0059] Step 4: Return to normal (weights fall back); After the message was successfully sent, the event was processed. Node X cleared the interrupted data to be sent, and the E value was reset to 0. The dynamic weight value W was restored to 60. The basic backoff window was also restored to [5, 15] ms, waiting for the next event.

[0060] According to the communication method provided by the present invention, the priority weight value can be dynamically adjusted to ensure that interruption information of sudden events can be uploaded in a timely manner in the event of a sudden event, thus ensuring the timeliness of information transmission.

[0061] In another embodiment of the present invention, according to the communication method provided by the present invention, the at least one slave node executes a distributed contention process and enters a corresponding target contention backoff window according to the contention result, including: The at least one slave node continuously monitors whether the bus is idle; If the bus is determined to be idle, the at least one slave node enters the basic backoff window, calculates the dynamic weight, and obtains the target dynamic weight value. The target contention avoidance window is determined based on the basic avoidance window and the target dynamic weight value, and then the target contention avoidance window is entered.

[0062] In this embodiment, according to the communication method provided by the present invention, the calculation of dynamic weight to obtain the corresponding target dynamic weight value includes: the target dynamic weight value is obtained based on the static basic priority and the dynamic urgency value of the interrupted data to be sent; the specific calculation formula is as follows: W = P_base + E: Wherein, W represents the target dynamic weight value, P_base represents the static base priority, and E represents the dynamic urgency value of the interrupt data to be sent; wherein, the dynamic urgency value of the interrupt data to be sent is obtained based on a preset mapping table of event type and dynamic urgency value.

[0063] In this embodiment, according to the communication method provided by the present invention, the at least one slave node sends a message to the master node indicating whether the bus is idle; after receiving the master node's response, the at least one slave node confirms that the bus is idle and sends the interrupt data to the master node, including: At least one slave node selects a target time point within the target contention backoff window and resends a message to the master node indicating whether the bus is idle. Upon receiving a response from the master node, the slave node determines that the bus is idle within the target time point and sends the interrupt data to the master node. If no response is received from the master node, the slave node determines that the bus is not idle within the target time point and initiates the binary exponential backoff algorithm to resend the message.

[0064] In this embodiment, the dynamic weight value of a slave node with a triggered event is determined based on a predefined formula for calculating the dynamic weight value of the slave node. After calculating the dynamic weight value of the slave node, the slave node enters a personalized contention backoff window. A high-precision hardware timer (such as TIM1 / TIM3) of the STM32F030K6T6 is used to precisely time this personalized contention backoff window, ensuring consistent timing across different slave nodes. Within the personalized contention backoff window, the slave node randomly selects a time point and, after confirming the bus is idle again at that time point, enables transmission by controlling the DE pin of the RS-485 transceiver SIT3485ESA (U1) to go high, subsequently sending an interrupt request data packet. If a collision is detected after transmission (e.g., no response is received from the master node), a binary exponential backoff algorithm is initiated for retry.

[0065] In this embodiment, a centralized arbitration mechanism assisted by the master node is also required. While performing regular polling, the master node listens for interrupted communication on the bus and executes the following centralized arbitration procedure as a backup: the master node maintains a collision counter for each packet. When communication collisions occur consecutively within a short period of time for the same packet, a contention stalemate is determined to have occurred within that group.

[0066] It should be noted that the grouping of slave nodes is "self-aware," based on the "static base priority (P_base)" set by their own hardware configuration circuits (such as DIP switches). The grouping of master nodes is "global-viewed," a "logical container" created by them for efficient network management, based on the P_base or node ID reported by slave nodes.

[0067] Let's explain this collaborative process in detail: I. Grouping criteria and methods for nodes ("Who am I?"): A node doesn't directly know whether it belongs to "Group A" or "Group B". It only knows one core parameter: its static base priority P_base.

[0068] Grouping criteria: Hardware configuration. As explained in detail in the previous steps, the P_base value of a slave node is determined by the physical state of its onboard DIP switch (SW1) or jumper cap (U10).

[0069] Implementation method: During the system design phase, a mapping relationship between P_base and hardware configuration is predefined and embedded in the firmware of the slave node. For example: SW1[1:0] = 00->P_base = 100, SW1[1:0] = 01->P_base = 60, SW1[1:0] = 10->P_base = 30, When a slave node powers on and initializes, it reads the level of the GPIO pins and obtains the P_base value of that slave node according to the mapping table. The slave node's understanding is: "My P_base is 60," not "I am Group B."

[0070] II. Grouping criteria and methods for master nodes ("Who are you?"): The master node needs to manage all nodes, and in order to implement efficient management strategies (such as conflict detection and differential polling), the concept of "grouping" was created.

[0071] Grouping is based on the range of P_base values ​​of the slave nodes. The master node has a global grouping configuration table that maps consecutive ranges of P_base values ​​to different logical groups.

[0072] Implementation method: Grouping strategy (predefined in the master node program): Group A: 80 <= P_base <= 100 (high-priority nodes) Group B: 50 <= P_base <= 79 (medium priority nodes) Group C:0 <= P_base <= 49 (low-priority nodes) Group discovery: The master node learns the slave node's P_base in two ways and assigns it to the appropriate group: Method 1 (Initial Registration): During the network initialization phase, the master node can query the P_base value of each node.

[0073] Method 2 (Dynamic Learning): When a slave node successfully sends an interrupt request or responds to an arbitration poll for the first time, its data packet or reported information must include its P_base value. Upon receiving this, the master node assigns the slave node to the corresponding logical group based on the P_base value.

[0074] The master node thinks: "All nodes with P_base between 50 and 79 belong to the 'GroupB' that I manage." III. Examples of Collaborative Workflows: Let's use an example to connect the whole process: Scene setting: From node X: the DIP switch is set to 01, and according to its firmware mapping table, P_base = 60 is obtained.

[0075] Master node: Define nodes with P_base between 50 and 79 as Group B.

[0076] When node X joins the network: the master node queries the configuration of node X during the initial polling. Node X replies: "My P_base is 60".

[0077] The master node adds the value 60 to its 'Group B' logical group and creates a conflict counter for this group.

[0078] Collision Occurrence and Detection: Slave node X and another slave node Y (also belonging to Group B) with P_base=55 simultaneously attempt to interrupt transmission, resulting in a collision. They each attempt backoff and retry, but after several attempts, the collision persists, creating a stalemate. The master node listens to the bus and detects multiple transmission errors. By analyzing the source characteristics of the error frames (if identifiable) or based on previous communication records, it determines that the collision occurs between nodes with P_base values ​​in the range of 50-79, i.e., its logical Group B. Therefore, the master node increments the collision counter for Group B. When this counter exceeds a threshold within a short period (e.g., 3 times), the master node determines that a "competitive stalemate has occurred within Group B."

[0079] The master node intervenes in arbitration: The master node broadcasts an arbitration polling frame, explicitly stating that the target is "Group B". Both slave nodes X and Y receive the arbitration polling frame. Slave nodes X and Y check their respective P_base values ​​of 60 and 55, respectively, and find that they are both within the range of 50-79. Therefore, they consider themselves to be the target of arbitration and prepare to respond. Within the specified micro-slot, they report their respective node IDs and current dynamic weight values ​​W to the master node.

[0080] According to the communication method provided by this invention, deterministic low-latency transmission is achieved by setting static packets and dynamic weight values: by combining static packets with dynamic weights and using hardware timers to ensure precise timing, high-priority and high-urgency information always competes within a shorter backoff window, fundamentally guaranteeing the upper bound of its transmission delay. System reliability and flexibility are significantly improved: hardware DIP switches allow for flexible on-site priority configuration; hardware triggering sources such as photoelectric sensors are directly associated with dynamic urgency, enabling the system to intelligently respond to critical events.

[0081] Furthermore, according to the communication method provided by the present invention, the method further includes: The master node listens for interrupt communication messages on the bus; When the master node determines that there is a communication conflict in the same group based on the interrupted communication message, it broadcasts an arbitration polling frame to determine the target group. The first and second slave nodes in the target group that have conflicts report their IDs and first dynamic weight values, and their IDs and second dynamic weight values ​​to the master node, respectively. The master node determines the target slave node based on the first dynamic weight value and the second dynamic weight value; The master node sends a communication authorization frame to the target slave node.

[0082] Furthermore, according to the communication method provided by the present invention, after the at least one slave node sends the interrupt data to the master node upon confirming that the bus is idle, the method further includes: After the interrupted data is successfully transmitted, the dynamic weight value of the at least one slave node is restored to the static base priority.

[0083] In this embodiment, the master node requires arbitration polling: when the master node detects a conflict stalemate among multiple slave nodes, it immediately broadcasts an arbitration polling frame, which specifies the target group to be arbitrated. All slave nodes within the target group that have recently clashed, upon receiving the arbitration polling frame, report their slave node ID and current dynamic weight value W to the master node within a specified micro-timeslot. Authorization communication: the master node compares all collected weight values ​​and sends a communication authorization frame to the slave node with the highest dynamic weight value W. Upon receiving the authorization, this slave node quickly controls the DE pin of its RS-485 transceiver to exclusively control the bus and send its complete interrupt data.

[0084] It should be noted that in this embodiment, the slave node X can actively upload interrupt information to the bus, or the master node can determine the interrupt information by polling the bus. Both situations can exist simultaneously, but they occur in different stages and scenarios.

[0085] Mode 1: Active upload from node X (suitable for dominant, efficient modes): This is the preferred and primary operating mode of the system design, aimed at achieving the lowest possible latency.

[0086] Triggering condition: A high-urgency event E is generated when the photoelectric sensor (U8 / U9) on node X (such as the sensor board) is triggered.

[0087] Action: The slave node X no longer waits for the master node to poll it. The slave node X immediately initiates the "personalized backoff contention process based on dynamic weight values". After winning the contention, it actively and asynchronously sends interruption information (such as "books in place") to the RS-485 bus.

[0088] The role of the master node: The master node is in "listener" mode. Although performing regular polling, its UART is constantly listening for data on the bus. Upon receiving an active interrupt packet from slave node X, it immediately interrupts the current polling process to prioritize handling this urgent message. This is analogous to a meeting where speaking is usually done by list (polling), but anyone with an emergency can immediately raise their hand (request an interrupt) and, if granted permission (winner of the competition), speak first. The purpose of this mode is to achieve "low-latency active reporting" of events.

[0089] Mode 2: Master node round-robin query (suitable for backup and backup modes): This is the system's backup and safety net, designed to resolve conflict impasses and ensure the system's ultimate reliability.

[0090] Triggering condition: When multiple slave nodes simultaneously initiate interruption requests and conflict multiple times during the distributed competition phase, and cannot resolve the issue on their own (i.e., the maximum number of retries has been reached but the attempt still fails).

[0091] Action: Master node detects deadlock: The master node detects by listening that the bus has been filled with conflict fragments (such as CRC errors, incomplete frames) for a period of time, or that a specific packet conflict counter has exceeded its limit.

[0092] Master node initiates arbitration: The master node actively broadcasts a special "arbitration poll" frame.

[0093] Slave node response query: After receiving this frame, the conflicting slave node passively reports its node ID and current dynamic weight value W to the master node within the specified micro-slot.

[0094] Master node decision and authorization: After collecting interruption information, the master node designates the slave node with the highest dynamic weight value to send the message.

[0095] The role of the master node: In this mode, the master node acts as a "referee" or "commander," actively intervening to restore order. For example, in a meeting where multiple people simultaneously raise their hands to speak, making it impossible for anyone to hear clearly, the meeting chair (master node) steps in, allowing the slave nodes to announce their names and reasons in turn, and then designating the person with the most urgent request to speak. The purpose of this mode is to "resolve deadlocks and ensure that critical information is eventually delivered."

[0096] It should be noted that completing the above operations does not usually complete the communication. Receiving authorization from the node and sending complete data only completes the "interruption reporting" phase. A complete industrial communication protocol typically requires a "handshake" or "acknowledgment" mechanism to ensure reliability.

[0097] According to the communication method provided by this invention, network deadlock is effectively avoided through a master node-assisted arbitration mechanism when multiple slave nodes encounter conflict and stalemate. High performance through hardware optimization: Utilizing the MCU's UART idle interrupt and hardware timers, microsecond-level bus status judgment and backoff timing are achieved, far exceeding the accuracy and speed of software polling. Rapid control of the RS-485 transceiver's DE / RE# pins greatly reduces bus switching latency.

[0098] In another specific embodiment of the present invention, taking the book return box sensor board as an example, when a book blocks the photoelectric sensor (U9), the sensor output level changes, triggering an external interrupt of the STM32F030K6T6 (U7). The MCU immediately sets the urgency E of this event to 3, and calculates a high dynamic weight W by combining it with the static priority P_base preset through the DIP switch (SW1). Subsequently, the MCU controls the RS-485 transceiver (U1) to participate in bus contention through its USART2 interface, following the aforementioned S2 steps. Due to the extremely high weight W, its backoff window is extremely short, enabling it to quickly win the right to use the bus and report the event to the master node, thereby achieving millisecond-level emergency event response. The communication method provided in this embodiment is cost-effective, highly compatible, and achieves high-performance multi-master interrupt communication without changing the RS-485 physical layer two-wire wiring or adding additional arbitration lines, by optimizing the usage of existing hardware (MCU, transceiver), with good backward compatibility.

[0099] In another embodiment provided by the present invention, such as Figure 3 This diagram illustrates the overall architecture and communication process of the communication method described in this invention. Its core features two collaborative processes: distributed contention on the slave node side and centralized arbitration on the master node side. The process begins with interrupted data to be sent by the slave node. First, the slave node enters the distributed contention phase: When there is pending interrupted data at the slave node; Calculate the dynamic weight value W of the slave node; Enter the basic backoff window corresponding to its static group; It waits randomly within its personalized competition backoff window [T_min, T_min + K / W].

[0100] If the timeout occurs and the bus remains idle, attempt to send an interrupt request packet.

[0101] The outcome of distributed competition has two branches: Success: Communication is successful and the process ends.

[0102] Failure: Initiate a binary exponential backoff to retry. If unsuccessful within the maximum number of retries, it indicates a conflict stalemate.

[0103] At this point, the process enters the centralized arbitration phase, where the master node intervenes: upon detecting a deadlock, the master node broadcasts an arbitration polling frame. Slave nodes within the conflict group report their identity ID and dynamic weight value W within a specified micro-slot.

[0104] The master node selects the slave node with the highest dynamic weight value and sends a communication authorization frame to it.

[0105] The authorized slave node exclusively uses the bus to send complete data and finally completes the communication.

[0106] This invention optimizes communication efficiency under normal conditions through distributed competition and ensures system reliability under extreme conditions through centralized arbitration. Together, they constitute a complete and robust solution.

[0107] It's important to note that "each static group corresponds to an independent basic backoff window" is a core design principle and one of the key mechanisms for implementing priority differentiation. Definition: A basic backoff window is an initial waiting time range set for all nodes within a group, which they must adhere to after detecting bus idleness. Purpose: To physically isolate groups of different priorities in time, ensuring that high-priority groups always start competing for the bus earlier than low-priority groups, thus laying the foundation for priority scheduling throughout the system.

[0108] In another embodiment of the invention, such as Figure 4 As shown, Figure 4 It demonstrates the detailed process of distributed contention backoff from slave nodes, using a horizontal layout from left to right, clearly showing the complete behavioral logic of slave nodes during communication interruption.

[0109] The process is divided into four main stages: Contention initialization: Slave nodes wait for interrupt events. Once an event is detected, the dynamic weight value W is immediately calculated. Based on static grouping, nodes enter the basic waiting time T_group to ensure basic timing isolation between different groups.

[0110] Backoff window calculation: A personalized competition backoff window [T_min, T_min + K / W] is calculated based on the dynamic weight value W. A specific backoff time is randomly selected within the window, and a timer is started.

[0111] Bus detection and transmission: After the timer expires, check if the bus is idle. If the bus is idle, immediately send an interrupt request packet.

[0112] Sending result processing: If the sending is successful, the process ends.

[0113] If transmission fails (collision), increment the collision count and check if the maximum number of retries has been exceeded. If within the maximum number of retries, perform binary exponential backoff and re-compete. If the maximum number of retries is exceeded, abandon transmission and wait for master node arbitration.

[0114] This flowchart illustrates two key technical aspects of this invention: Personalized competition backoff window: Based on the calculation of dynamic weight value W, it ensures that high-priority data receives a shorter waiting time.

[0115] Binary exponential backoff and arbitration connection: After a distributed competition failure, it can smoothly transition to a centralized arbitration scheme.

[0116] The design in this embodiment ensures that the slave nodes maintain a high degree of autonomy while effectively cooperating with the centralized management of the master node, achieving the best balance between system efficiency and reliability.

[0117] It should be noted that the arbitration polling of the master node is the essence of this invention, combining "distributed competition" with "centralized arbitration," and serves as a "safety net" to ensure that the system will not be completely paralyzed due to partial failures. When a slave node "gives up sending after exceeding the maximum number of attempts," it means that it has exhausted all its efforts, but the distributed competition mechanism has failed in the current environment. At this point, the system faces a "conflict deadlock." If no external intervention is introduced at this time, it will lead to system deadlock, business interruption, and the inability to self-heal from the fault. Therefore, "waiting for the master node to intervene in arbitration" is not a passive abandonment, but an actively triggered, higher-level fault recovery mechanism.

[0118] In another embodiment of the invention, such as Figure 5 As shown, Figure 5 It demonstrates the complete process of centralized arbitration by the master node, using a vertical layout suitable for an A4 page, clearly showing the arbitration process after the master node detects a conflict deadlock.

[0119] The process is divided into four main stages: Arbitration Trigger: During normal polling, the master node continuously monitors the bus status. When it detects consecutive collisions in specific packets, it triggers the arbitration process.

[0120] Arbitration initialization: Broadcast arbitration polling frames, specifying the target group; start the timer and initialize the microslot counter.

[0121] Weight collection phase: Within a preset micro-time slot, receive the weight reports from conflicting nodes and add the valid node IDs and weight information to the candidate list.

[0122] Arbitration decision and execution: Analyze the candidate list, select the slave node with the highest weight, send a communication authorization frame, and wait for the timeout of complete data processing before reselecting.

[0123] After successful arbitration, the system returns to normal polling status.

[0124] It should be noted that the dynamic weight value W changes only when a new interrupt event is triggered.

[0125] Initial state: An idle slave node with dynamic weight W = static base priority P_base (urgency E = 0 at this point). For example, W = 60.

[0126] Event triggering: When a new interrupt event occurs (such as when the photoelectric sensor is blocked), the slave node will immediately set a high E value (e.g., E = 30) according to the urgency of the event.

[0127] W Update: The dynamic weight value W is immediately updated to P_base + E (e.g., 60 + 30 = 90). This is a one-time, significant boost. Throughout the subsequent contention and transmission process, the value of the dynamic weight value W will remain unchanged as long as it is for reporting this specific event.

[0128] It should be noted that the dynamic weight value W remains unchanged under the following conditions.

[0129] Retrying on failure: A failed transmission (collision) does not mean the urgency of the event has decreased. For example, a message like "books arrived" still needs to be reported as soon as possible; therefore, the E value of the slave node remains unchanged, i.e., W remains constant. Binary backoff will be performed with the same dynamic weight value W, and the node will re-engage in the competition with the same competitiveness level.

[0130] While awaiting arbitration: When a slave node relinquishes its competition and awaits arbitration from the master node, it awaits the master node's "arbitration poll" frame. Upon receiving this frame, the slave node needs to report its current node ID and dynamic weight value W to the master node. This W value remains the same as the value calculated when the event was triggered (e.g., 90), because the event it represents has not yet been processed.

[0131] It should be noted that the dynamic weight value W will be reset or updated after one of the following two events occurs.

[0132] Successful transmission: When the master node returns an ACK, confirming that the data has been successfully received, it means that the emergency event has been handled. At this time, the slave node can reset E to 0 and restore the dynamic weight value W to P_base.

[0133] Event Timeout: The system can be designed with a timeout mechanism. If an event cannot be successfully reported within a long period of time, the slave node can consider the event to have expired, thus actively canceling it and restoring W to P_base.

[0134] New event trigger: If a more urgent new event occurs during the reporting of the current event, the node will immediately calculate a new dynamic weight value W (based on the E of the new event) and use this new weight value to participate in the competition.

[0135] For example: A slave node (P_base = 60) detects that a book has arrived (E = 30), so W = 90. This slave node competes for the first time and a conflict occurs. At this point, the dynamic weight value W is still 90. After backing away, it competes for the second time and another conflict occurs. At this point, the dynamic weight value W is still 90.

[0136] After reaching the maximum number of retries, the slave node waits for arbitration from the master node. When the master node queries, its reported dynamic weight value W is still 90. Based on this dynamic weight value of 90, the master node authorizes the slave node to send interrupted data.

[0137] After the slave node successfully sends the data, it receives an ACK from the master station. At this point, the "books arrived" event is processed, the slave node resets E to 0, restores the dynamic weight value W to 60, and waits for the next event.

[0138] When a slave node has interrupted data that needs to be uploaded, its dynamic weight value W will immediately increase, and usually by a significant amount.

[0139] The specific implementation of the dynamic weight value W change model is as follows: 1. Idle state (when there is no interrupted data): At this point, the dynamic urgency level E = 0.

[0140] The dynamic weight value of the node is W = P_base + E = P_base + 0.

[0141] At this point, the dynamic weight value W is equal to the static base priority P_base.

[0142] For example, a node belonging to Group B has a P_base = 60. When idle, its dynamic weight value W = 60.

[0143] 2. When an interruption event is triggered (when data is being uploaded): When a node detects an event that requires urgent reporting (such as when a photoelectric sensor is triggered), it will immediately look up the event type in the table and assign a high E value.

[0144] The weight of a node is instantly updated to W = P_base + E.

[0145] For example, if the photoelectric sensor of the above node (P_base = 60) is blocked, this event is defined as E = 30.

[0146] Then, the dynamic weight value W immediately increases from 60 to 90.

[0147] The increased dynamic weight value W will directly affect the personalized competition avoidance window: [T_min, T_min + (K / W)]. As W increases, (K / W) decreases, resulting in a narrower backoff window.

[0148] Substitute the formula and see the effect: When idle (W = 60): window = [5, 5 + (600 / 60)] = [5, 15] ms; During interruption (W = 90): Window = [5, 5 + (600 / 90)] ≈ [5, 11.7] ms; As can be seen from the comparison, when there is interrupted data that needs to be uploaded, the backoff window of the slave node is narrowed from 15ms to approximately 11.7ms. This means that its randomly assigned transmission time will be earlier, and the probability of it winning the right to use the bus will be greatly increased.

[0149] In one embodiment of the present invention, such as Figure 6 The schematic diagram shows an architecture consisting of six main functional modules. The power supply and basic circuitry include: a +5V power supply input from connectors (CN1 / CN2), which is regulated by an LDO chip (AMS1117-3.3V, Q1) to provide a stable 3.3V power supply for the entire system. A decoupling capacitor network (C3-C6) is used to filter out power supply noise, ensuring stable system operation.

[0150] Core control unit: Based on the STM32F030K6T6 (U7) microcontroller, it is responsible for executing all logic of the patented communication protocol. An external 8MHz crystal oscillator (X1) provides a precise clock reference. The reset and debug interfaces (NRST, SWDIO, SWCLK) are used for system initialization and program burning.

[0151] Priority configuration module: The 8-bit DIP switch (SW1) is a key innovative hardware component. It inputs the static base priority (P_base) to the MCU via GPIO, enabling flexible field configuration without code modification.

[0152] Sensor input module: Two photoelectric sensors (EE-SPY402, U8 / U9) serve as external event trigger sources, and their signals are directly connected to the interrupt pin of the MCU to generate events with high dynamic urgency (E).

[0153] RS-485 Communication Module: The RS-485 transceiver (SIT3485ESA, U1) is the physical interface for network communication. The MCU exchanges data with it through USART2_TX / USART2_RX and quickly controls its direction (DE / RE# pins) through the 485CS signal. This is the hardware key to achieving low-latency bus preemption and release.

[0154] Status indicator module: Multiple LED indicators (LED2-LED4) are controlled by the MCU's GPIO to visually display the node's operating status, communication activity, or fault information.

[0155] Figure 6 The structural diagram shown clearly illustrates the specific hardware carrier upon which the software algorithms such as "dynamic weight value calculation", "precise timing control", and "fast bus switching" in the technical solution of this invention depend, fully demonstrating the software and hardware collaborative innovation characteristics of this invention.

[0156] The structure provided in this embodiment, in an RS-485 master-slave network, configures a dynamic weight value (W) for the slave node, consisting of a static base priority (P_base) set by a hardware DIP switch or jumper cap and a dynamic urgency (E) triggered by an external sensor. Based on this weight, a personalized contention backoff window is calculated. In this invention, the timing of the personalized contention backoff window is implemented by a high-precision hardware timer of a microcontroller unit (MCU). The detection of the bus idle state is implemented by the idle interrupt or receive timeout interrupt function of the MCU's UART module.

[0157] The communication structure provided by this invention mainly consists of a microcontroller unit (MCU), an RS-485 transceiver, physical configuration circuitry for setting the static basic priority of nodes (such as a DIP switch SW1), and at least one external event sensor (such as photoelectric sensors U8 and U9). The transmit enable (DE) and receive enable (RE#) pins of the RS-485 transceiver are directly driven by the MCU's GPIO, and bit-band operation or set / reset register operation is used to achieve the fastest direction switching speed. The master node monitors intra-packet collision deadlock through a collision counter and actively broadcasts arbitration polling frames to collect the dynamic weights of slave nodes before granting arbitration authorization, thus resolving persistent collisions through centralized arbitration.

[0158] Secondly, the present invention provides a communication device for a bus network, the device being applied to a master node and multiple slave nodes, the device comprising: The detection module is used to detect when at least one of the plurality of slave nodes has interrupted data to be sent; The priority configuration module is used by the at least one slave node to execute the distributed competition process and enter the corresponding target competition backoff window according to the competition result; The message sending module is used for the at least one slave node to send a message to the master node indicating whether the bus is idle; A data transmission module is used for the at least one slave node to send the interrupt data to the master node after receiving a response from the master node and confirming that the bus is idle.

[0159] This invention provides a communication device for a bus network, which is applied to a master node and multiple slave nodes. The device provided by this invention can avoid conflicts when slave nodes send interrupt data simultaneously, reduce the cost of arbitration communication, and improve the efficiency of interrupt data transmission.

[0160] The communication device in this embodiment is implemented on the same principle as the method described above, and will not be described in detail here.

[0161] Figure 7 This is a schematic diagram of the physical structure of the electronic device provided in the embodiments of the present invention, such as... Figure 7 As shown, the present invention provides an electronic device, including: a processor 701, a memory 702, and a bus 703; The processor 701 and the memory 702 communicate with each other via the bus 703. The processor 701 is used to call program instructions in the memory 702 to execute the methods provided in the above-described method embodiments, such as: the method is applied to a master node and multiple slave nodes, the method includes: when at least one of the multiple slave nodes has interrupt data to be sent; the at least one slave node executes a distributed contention process and enters the corresponding target contention backoff window according to the contention result; the at least one slave node sends a message to the master node indicating whether the bus is idle; after receiving the response from the master node, the at least one slave node confirms that the bus is idle and sends the interrupt data to the master node.

[0162] This invention provides a non-transitory computer-readable storage medium storing computer instructions that cause the computer to execute the methods provided in the above-described method embodiments. For example, the method includes: applying the method to a master node and multiple slave nodes; the method comprising: when at least one of the multiple slave nodes has interrupt data to be sent; the at least one slave node executes a distributed contention process, entering a corresponding target contention backoff window based on the contention result; the at least one slave node sends a message to the master node indicating whether the bus is idle; and after receiving a response from the master node, the at least one slave node confirms that the bus is idle and sends the interrupt data to the master node.

[0163] The present invention also provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, and when the program instructions are executed by a computer, the computer is able to execute the methods provided in the above embodiments, the method comprising: the method being applied to a master node and multiple slave nodes, the method comprising: when at least one of the multiple slave nodes has interrupt data to be sent; the at least one slave node executing a distributed contention process, entering a corresponding target contention backoff window according to the contention result; the at least one slave node sending a message to the master node indicating whether the bus is idle; and after receiving a response from the master node, the at least one slave node confirming that the bus is idle and sending the interrupt data to the master node.

[0164] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as ROM, RAM, magnetic disk, or optical disk.

[0165] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A communication method for a bus network, the method being applied to a master node and multiple slave nodes, characterized in that, The method includes: When at least one of the plurality of slave nodes has interrupted data to be sent; The at least one slave node executes a distributed competition process and enters the corresponding target competition backoff window based on the competition result; The at least one slave node sends a message to the master node indicating whether the bus is idle; Upon receiving a response from the master node, at least one slave node confirms that the bus is idle and sends the interrupt data to the master node.

2. The communication method according to claim 1, characterized in that, Before at least one of the plurality of slave nodes has interrupted data to be sent, the method further includes: The master node configures a static base priority for each of the plurality of slave nodes; The multiple slave nodes are grouped differently based on the static basic priority.

3. The communication method according to claim 2, characterized in that, Before at least one of the plurality of slave nodes has interrupted data to be sent, the method further includes: Pre-confirm the event types and dynamic urgency values ​​of the multiple slave nodes; Based on the event type and dynamic urgency value, a mapping table of event type and dynamic urgency value is obtained.

4. The communication method according to claim 2, characterized in that, The at least one slave node executes a distributed contention process, and enters the corresponding target contention backoff window based on the contention result, including: The at least one slave node continuously monitors whether the bus is idle; If the bus is determined to be idle, the at least one slave node enters the basic backoff window, calculates the dynamic weight, and obtains the target dynamic weight value. The target contention avoidance window is determined based on the basic avoidance window and the target dynamic weight value, and then the target contention avoidance window is entered.

5. The communication method according to claim 4, characterized in that, The calculation of dynamic weights to obtain the corresponding target dynamic weight values ​​includes: The target dynamic weight value is obtained based on the static basic priority and the dynamic urgency value of the interrupted data to be sent; the specific calculation formula is as follows: W = P_base + E Wherein, W represents the target dynamic weight value, P_base represents the static base priority, and E represents the dynamic urgency value of the interrupt data to be sent; wherein, the dynamic urgency value of the interrupt data to be sent is obtained based on a preset mapping table of event type and dynamic urgency value.

6. The communication method according to claim 1, characterized in that, The at least one slave node sends a message to the master node indicating whether the bus is idle; After receiving a response from the master node, the at least one slave node confirms that the bus is idle and sends the interrupt data to the master node, including: The at least one slave node selects a target time point in the target contention backoff window and sends a message to the master node again indicating whether the bus is idle. Upon receiving the response from the master node, and determining that the bus is idle at the target time point, the interrupt data is sent to the master node; If no response is received from the master node, it is determined that the bus is not idle at the target time point, and the binary exponential backoff algorithm is initiated to resend.

7. The communication method according to claim 1, characterized in that, The method further includes: The master node listens for interrupt communication messages on the bus; When the master node determines that there is a communication conflict in the same group based on the interrupted communication message, it broadcasts an arbitration polling frame to determine the target group. The first and second slave nodes in the target group that have conflicts report their IDs and first dynamic weight values, and their IDs and second dynamic weight values ​​to the master node, respectively. The master node determines the target slave node based on the first dynamic weight value and the second dynamic weight value; The master node sends a communication authorization frame to the target slave node.

8. A communication device for a bus network, characterized in that, The device is applied to a master node and multiple slave nodes, and the device includes: The detection module is used to detect when at least one of the plurality of slave nodes has interrupted data to be sent; The priority configuration module is used by the at least one slave node to execute the distributed competition process and enter the corresponding target competition backoff window according to the competition result; The message sending module is used for the at least one slave node to send a message to the master node indicating whether the bus is idle; A data transmission module is used for the at least one slave node to send the interrupt data to the master node after receiving a response from the master node and confirming that the bus is idle.

9. An electronic device, characterized in that, include: Processor, memory, and bus, among which, The processor and the memory communicate with each other via the bus; The memory stores program instructions that can be executed by the processor, which can invoke the program instructions to perform the steps of the communication method for the bus network as described in any of the preceding items.

10. A non-transitory computer-readable storage medium, characterized in that, The non-transitory computer-readable storage medium stores computer instructions that cause the computer to perform the steps of the communication method for a bus network as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • MAC (media access control) resource management method based on competition

    CN103281731A

  • Link-effective high-dynamic network media access method

    CN111585843A

  • Data transmission method and device of vehicle and electronic equipment

    CN115086907A

  • Dynamic TDMA protocol design method based on SC-FDE waveform

    CN117440054A

  • Data transmission method and system, electronic equipment and storage medium

    CN119292978A